mirror of https://github.com/IoTcat/HOMES.git
parent
c13ac45c06
commit
62dbad28fb
22 changed files with 851 additions and 1594 deletions
@ -1,29 +0,0 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> |
||||
<title>404 - 找不到文件或目录。</title> |
||||
<style type="text/css"> |
||||
<!-- |
||||
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} |
||||
fieldset{padding:0 15px 10px 15px;} |
||||
h1{font-size:2.4em;margin:0;color:#FFF;} |
||||
h2{font-size:1.7em;margin:0;color:#CC0000;} |
||||
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} |
||||
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF; |
||||
background-color:#555555;} |
||||
#content{margin:0 0 0 2%;position:relative;} |
||||
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} |
||||
--> |
||||
</style> |
||||
</head> |
||||
<body> |
||||
<div id="header"><h1>服务器错误</h1></div> |
||||
<div id="content"> |
||||
<div class="content-container"><fieldset> |
||||
<h2>404 - 找不到文件或目录。</h2> |
||||
<h3>您要查找的资源可能已被删除,已更改名称或者暂时不可用。</h3> |
||||
</fieldset></div> |
||||
</div> |
||||
</body> |
||||
</html> |
@ -1,29 +0,0 @@ |
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
||||
<html xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> |
||||
<title>404 - 找不到文件或目录。</title> |
||||
<style type="text/css"> |
||||
<!-- |
||||
body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} |
||||
fieldset{padding:0 15px 10px 15px;} |
||||
h1{font-size:2.4em;margin:0;color:#FFF;} |
||||
h2{font-size:1.7em;margin:0;color:#CC0000;} |
||||
h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} |
||||
#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:"trebuchet MS", Verdana, sans-serif;color:#FFF; |
||||
background-color:#555555;} |
||||
#content{margin:0 0 0 2%;position:relative;} |
||||
.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} |
||||
--> |
||||
</style> |
||||
</head> |
||||
<body> |
||||
<div id="header"><h1>服务器错误</h1></div> |
||||
<div id="content"> |
||||
<div class="content-container"><fieldset> |
||||
<h2>404 - 找不到文件或目录。</h2> |
||||
<h3>您要查找的资源可能已被删除,已更改名称或者暂时不可用。</h3> |
||||
</fieldset></div> |
||||
</div> |
||||
</body> |
||||
</html> |
File diff suppressed because one or more lines are too long
@ -1 +1 @@ |
||||
a4D4qBq4G9D4 |
||||
d7C7dGd7C0C7 |
File diff suppressed because one or more lines are too long
@ -1 +1 @@ |
||||
E0YWFgt2aFlelsjJN5251dS2E0YWFgt2aFNUMc03h7tGp9lQwxN5251cT3NUMc03h7tGp9lQwx |
||||
g48xQ5l05mvy6u30vzd20UK7g48xQ5l05mvy6 |
||||
|
@ -0,0 +1,438 @@ |
||||
|
||||
int demo__test_fundamental_functions(); |
||||
int demo__menu(); |
||||
void demo__print__menu(int nPnt); |
||||
void demo__data__insert_visitor_info(); |
||||
void demo__data__del_visitor_info(); |
||||
void demo__data__get_visitor_info(); |
||||
void demo__data__insert_room_info(); |
||||
void demo__data__del_room_info(); |
||||
void demo__data__get_room_info(); |
||||
void demo__create_visitor(); |
||||
void demo__create_room(); |
||||
void demo__display_all_visitors(); |
||||
void demo__display_all_rooms(); |
||||
|
||||
/*********** demo test function, you can find the demo of most fundamental function here ********/ |
||||
|
||||
/* demo guide function*/ |
||||
int demo__test_fundamental_functions() |
||||
{ |
||||
printf("Please Press 't' to goto test screen, or press any other key to goto your main fuction!\n"); |
||||
|
||||
if(input__detect_input_ASCII()=='t') |
||||
{ |
||||
system("cls");/*clean the screen */ |
||||
printf("1. press 'p' to goto input and print fundamental function demo.\n\n"); |
||||
printf("2. press 'd' to goto data fundamental function demo.\n\n"); |
||||
printf("3. press 'g' to create visitor and room data to support your own code!\n\n"); |
||||
|
||||
/* get user pressed key */ |
||||
char tmp_getPress=input__detect_input_ASCII(); |
||||
|
||||
if(tmp_getPress=='p') |
||||
{ |
||||
system("cls");/* clean the screen */ |
||||
|
||||
/* initialize the window */ |
||||
print__setup(); |
||||
|
||||
/* quit untill press an esc*/ |
||||
while(demo__menu()!=6); |
||||
|
||||
/* quit the demo function */ |
||||
return 0; |
||||
} |
||||
|
||||
if(tmp_getPress=='d') |
||||
{ |
||||
system("cls");/* clean the screen */ |
||||
|
||||
printf("Please select:\n\n"); |
||||
printf("1. data__insert_visitor_info() demo\n\n"); |
||||
printf("2. data__del_visitor_info() demo\n\n"); |
||||
printf("3. data__get_visitor_info() demo\n\n\n"); |
||||
printf("4. data__insert_room_info() demo\n\n"); |
||||
printf("5. data__del_room_info() demo\n\n"); |
||||
printf("6. data__get_room_info() demo\n\n"); |
||||
|
||||
tmp_getPress=input__detect_input_ASCII(); |
||||
|
||||
system("cls");/* clean the screen */ |
||||
|
||||
if(tmp_getPress=='1') demo__data__insert_visitor_info(); |
||||
if(tmp_getPress=='2') demo__data__del_visitor_info(); |
||||
if(tmp_getPress=='3') demo__data__get_visitor_info(); |
||||
if(tmp_getPress=='4') demo__data__insert_room_info(); |
||||
if(tmp_getPress=='5') demo__data__del_room_info(); |
||||
if(tmp_getPress=='6') demo__data__get_room_info(); |
||||
|
||||
system("echo Press any key to goto main()&pause>nul"); |
||||
|
||||
} |
||||
|
||||
if(tmp_getPress=='g') |
||||
{ |
||||
system("cls"); |
||||
|
||||
printf("Please select:\n\n"); |
||||
printf("1. Create a visitor data\n\n"); |
||||
printf("2. Create a room data\n\n"); |
||||
printf("3. Display all visitors\n\n"); |
||||
printf("4. Display all rooms\n\n"); |
||||
|
||||
tmp_getPress=input__detect_input_ASCII(); |
||||
|
||||
system("cls"); |
||||
|
||||
if(tmp_getPress=='1') demo__create_visitor(); |
||||
if(tmp_getPress=='2') demo__create_room(); |
||||
if(tmp_getPress=='3') demo__display_all_visitors(); |
||||
if(tmp_getPress=='4') demo__display_all_rooms(); |
||||
|
||||
system("echo Press any key to goto main()&pause>nul"); |
||||
} |
||||
|
||||
/* clean the screen */ |
||||
system("cls"); |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
|
||||
|
||||
/* demo function for display menu, you can design your menu logic here*/ |
||||
int demo__menu() |
||||
{ |
||||
int nVal=54; |
||||
int nArrw=0; |
||||
do |
||||
{ |
||||
/* print out the menu */ |
||||
demo__print__menu(nVal%6+1); |
||||
|
||||
/* detect user keyboard press*/ |
||||
nArrw= input__get_arrow(); |
||||
|
||||
/* when input a arrow */ |
||||
if(nArrw==1||nArrw==-1) |
||||
nVal+=nArrw; |
||||
|
||||
/* when press enter */ |
||||
if(nArrw==6) |
||||
break; |
||||
/* when press esc */ |
||||
if(nArrw==9) |
||||
return 6; |
||||
|
||||
}while(1); |
||||
|
||||
/* return user choice by number*/ |
||||
return nVal%6+1; |
||||
} |
||||
|
||||
|
||||
/* demo function for printing a menu ,you can design your menu here*/ |
||||
void demo__print__menu(int nPnt) |
||||
{ |
||||
|
||||
/* clear screen */ |
||||
system("cls"); |
||||
|
||||
/* print the screen header */ |
||||
print__header(); |
||||
|
||||
printf("Please use Arrows on Keyboard to Choose:\n"); |
||||
char chItem1[]="Choose 1"; |
||||
/* function pringt__item has three parameters: display string, if it is choosed,extra space on its left*/
|
||||
print__item(chItem1,(nPnt==1)?1:0,0); |
||||
|
||||
char chItem2[]="Choose 2"; |
||||
print__item(chItem2,(nPnt==2)?1:0,0); |
||||
|
||||
char chItem3[]="Choose 3"; |
||||
print__item(chItem3,(nPnt==3)?1:0,0); |
||||
|
||||
char chItem4[]="Choose 4"; |
||||
print__item(chItem4,(nPnt==4)?1:0,0); |
||||
|
||||
char chItem5[]="Choose 5"; |
||||
print__item(chItem5,(nPnt==5)?1:0,0); |
||||
|
||||
char chItem6[]="Exit "; |
||||
print__item(chItem6,(nPnt==6)?1:0,0); |
||||
|
||||
printf("\n\n\n\n\n\n\n\n\n\n\n\n\n"); |
||||
printf("Press ESC to Exit!"); |
||||
|
||||
} |
||||
|
||||
|
||||
/* demo for data_insert visitor_info() */ |
||||
void demo__data__insert_visitor_info() |
||||
{ |
||||
|
||||
printf("Demo 1:\nThis demo will create a visitor file of yimian. \nto begin with this function, you need a visitor struct which include the visitor info you want to insert. \nYou can see this code in demo__data_insert_visitor_info() function\n\n"); |
||||
|
||||
/* Create a new visitor struct variable with some user info */ |
||||
visitor demo_NewVisitor={0/*this is the visitor id, please leave 0 here */,"yimian Liu"/*name*/,"18118155257"/*tel*/,1/*vip*/,"370902199909041813"/*nationalId*/,"china"/*nation*/,"shandong"/*province*/,"taian"/*city*/}; |
||||
|
||||
/* excute the data__insert_visitor_info function and when the function crash, print the error info on screen */ |
||||
if(data__insert_visitor_info(&demo_NewVisitor)) printf("Error in Function data__insert_visitor_info: %s\n",strerror(errno)); |
||||
else printf("Create successfully!\n"); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
/* demo for data__del_visitor_info */ |
||||
void demo__data__del_visitor_info() |
||||
{ |
||||
printf("Demo 2:\nTo delete a visitor info, you need to provide the visitor's ID.\n\n"); |
||||
printf("you can see detailed info in demo__data__del_visitor_info()\n\n"); |
||||
|
||||
printf("Please input the ID:\n"); |
||||
|
||||
/* get ID input */ |
||||
char tmp_visitorId[11]; |
||||
gets(tmp_visitorId); |
||||
|
||||
/* del the visitor info */ |
||||
if(data__del_visitor_info(atoi(tmp_visitorId))) printf("Error in Function data__del_visitor_info: %s\n",strerror(errno));;
|
||||
|
||||
} |
||||
|
||||
|
||||
/* demo for data__get_visitor_info() */ |
||||
void demo__data__get_visitor_info() |
||||
{ |
||||
printf("Demo 3:\nGet Visitors info, index key word is 'china' in this case. \n"); |
||||
printf("to search a visitor info, data__get_visitor_info() need a key word and a visitor pointer.\n"); |
||||
printf("the key word must be more than three word and the visito info found will be store in the visitor point you provided\n"); |
||||
printf("for more info please see demo__data__get_visitor_info() function!\n\n"); |
||||
|
||||
/* provide a key word to search visitors*/ |
||||
char tmp_Nation[35]="china"; |
||||
|
||||
/* declear a visitor pointer to receive the matched visitors info */ |
||||
struct visitor *pVstr=NULL; |
||||
pVstr= data__get_visitor_info(tmp_Nation,pVstr); |
||||
|
||||
/* show error hint if the function not runing successfully */ |
||||
if(errno) printf("Error in Function data__get_visitor_info: %s\n",strerror(errno)); |
||||
|
||||
/* deal with situation that nothing found */ |
||||
if(!g_nRtrnRows) printf("No visitor found!!\n"); |
||||
|
||||
/* print all these visitors info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("ID:%d Name:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (pVstr+i)->id, (pVstr+i)->name, (pVstr+i)->tel,(pVstr+i)->vip, (pVstr+i)->nationalId,(pVstr+i)->nation, (pVstr+i)->province, (pVstr+i)->city); |
||||
|
||||
} |
||||
|
||||
|
||||
/* demo function for data__insert_room_info() */ |
||||
void demo__data__insert_room_info() |
||||
{ |
||||
printf("Demo 4:\nThis demo will create a room file of room 666 in 20181111.\n"); |
||||
printf("data__insert_room_info() need the address of a room struct before insert one info.\n"); |
||||
printf("for more info please see demo__data__insert_room_info()\n\n"); |
||||
|
||||
/* Create a new visitor struct variable with some user info */ |
||||
room demo_NewRoom={0/*this is the visitor id, please leave 0 here */,666/*roomId*/,20181111/*date*/,{2/*visitor number*/,1234567899,1243567899}/*visitorId*/,2/*room type*/,66.66/*price*/,2/*checkIn*/,1/*checkOut*/}; |
||||
|
||||
/* excute the data__insert_visitor_info function and when the function crash, print the error info on screen */ |
||||
if(data__insert_room_info(&demo_NewRoom)) printf("Error in Function data__insert_room_info: %s\n",strerror(errno)); |
||||
else printf("Create successfully!\n"); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
/* demo for data__del_room_info() */ |
||||
void demo__data__del_room_info() |
||||
{ |
||||
printf("Demo 5:\nTo delete a room info, you need to provide the index and the roomId.\n\n"); |
||||
printf("See more in function demo__data__del_room_info()\n\n" ); |
||||
|
||||
printf("Please input the Index:\n"); |
||||
|
||||
/* get index input */ |
||||
char tmp_roomIndex[11]; |
||||
while(!scanf("%s",tmp_roomIndex)) fflush(stdin); |
||||
|
||||
printf("Please input the RoomId:\n"); |
||||
|
||||
/* get room input */ |
||||
char tmp_roomId[11]; |
||||
while(!scanf("%s",tmp_roomId)) fflush(stdin); |
||||
|
||||
/* del the visitor info */ |
||||
if(data__del_room_info(atoi(tmp_roomIndex),atoi(tmp_roomId))) printf("Error in Function data__del_room_info: %s\n",strerror(errno)); |
||||
} |
||||
|
||||
|
||||
|
||||
void demo__data__get_room_info() |
||||
{ |
||||
printf("Demo 6:\nGet room info, you need to set one or more condition, and the function will return all the room info which satisfy your condition.\n"); |
||||
printf("to learn more please see demo__data__get_room_info()\n\n"); |
||||
printf("in this case, we had set some condition for rooms searching.\n"); |
||||
printf("You can find more detail in function demo__data__get_room_info()\n\n"); |
||||
|
||||
/* declear a room pointer to receive the matched rooms info */ |
||||
struct room *pRm=NULL; |
||||
|
||||
int hh[]={2/* number of visitors*/,1234567899/* visitorId*/,1243567899/* visitorId*/}; |
||||
pRm= data__get_room_info(0/*index*/,666/*roomId*/,0/*date*/,hh/*visitorId*/,2/*type*/,0/*price*/,0/*checkIn*/,1/*checkOut*/,pRm); |
||||
|
||||
/* show error hint if the function not runing successfully */ |
||||
if(!pRm) printf("Error in Function data__get_room_info: %s\n",strerror(errno)); |
||||
|
||||
/* deal with situation that nothing found */ |
||||
if(!g_nRtrnRows) printf("No room found!!\n"); |
||||
|
||||
/* print all these rooms info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("Index:%d Room:%d date:%d VisitorNum:%d Type:%d Price:%f CheckIn:%d CheckOut:%d\n", (pRm+i)->index, (pRm+i)->roomId, (pRm+i)->date,(pRm+i)->visitorId[0], (pRm+i)->type,(pRm+i)->price, (pRm+i)->checkIn, (pRm+i)->checkOut); |
||||
|
||||
} |
||||
|
||||
|
||||
/* function for create a visitor*/ |
||||
void demo__create_visitor() |
||||
{ |
||||
visitor demo_NewVisitor; |
||||
|
||||
printf("Please input a name:\n"); |
||||
while(!scanf("%s",demo_NewVisitor.name)) fflush(stdin); |
||||
|
||||
printf("Please input a tel:\n"); |
||||
while(!scanf("%s",demo_NewVisitor.tel)) fflush(stdin); |
||||
|
||||
printf("Please input if it is vip (not vip->1,vip->2) :\n"); |
||||
char tmp_ch[15]; |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewVisitor.vip=atoi(tmp_ch); |
||||
|
||||
printf("Please input a nationalId:\n"); |
||||
while(!scanf("%s",demo_NewVisitor.nationalId)) fflush(stdin); |
||||
|
||||
printf("Please input a nation:\n"); |
||||
while(!scanf("%s",demo_NewVisitor.nation)) fflush(stdin); |
||||
|
||||
printf("Please input a province:\n"); |
||||
while(!scanf("%s",demo_NewVisitor.province)) fflush(stdin); |
||||
|
||||
printf("Please input a city:\n"); |
||||
while(!scanf("%s",demo_NewVisitor.city)) fflush(stdin); |
||||
|
||||
demo_NewVisitor.id=0; |
||||
|
||||
/* excute the data__insert_visitor_info function and when the function crash, print the error info on screen */ |
||||
if(data__insert_visitor_info(&demo_NewVisitor)) printf("Error in Function data__insert_visitor_info: %s\n",strerror(errno)); |
||||
else printf("Create successfully!\n"); |
||||
} |
||||
|
||||
|
||||
void demo__create_room() |
||||
{ |
||||
|
||||
room demo_NewRoom={0/*this is the visitor id, please leave 0 here */,666/*roomId*/,20181111/*date*/,{2/*visitor number*/,1234567899,1243567899}/*visitorId*/,2/*room type*/,66.66/*price*/,2/*checkIn*/,1/*checkOut*/}; |
||||
|
||||
char tmp_ch[25]; |
||||
|
||||
printf("Please input a roomId (e.g. 205):\n"); |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewRoom.roomId=atoi(tmp_ch); |
||||
|
||||
printf("Please input a date (e.g. 20181111):\n"); |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewRoom.date=atoi(tmp_ch); |
||||
|
||||
printf("Please input the number of visitors:\n"); |
||||
int tmp_vNum=0; |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
tmp_vNum=atoi(tmp_ch); |
||||
|
||||
if(tmp_vNum) |
||||
{ |
||||
for(int i=0;i<tmp_vNum;i++) |
||||
{ |
||||
printf("Please input visitors Id\n"); |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewRoom.visitorId[i+1]=atoi(tmp_ch); |
||||
} |
||||
} |
||||
|
||||
demo_NewRoom.visitorId[0]=tmp_vNum; |
||||
|
||||
printf("Please input a room type (e.g. 1,2,3,4,5):\n"); |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewRoom.type=atoi(tmp_ch); |
||||
|
||||
printf("Please input a price (e.g. 205.5):\n"); |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewRoom.price=atof(tmp_ch); |
||||
|
||||
printf("Please input if it is checkIn (not In->1, In->2):\n"); |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewRoom.checkIn=atoi(tmp_ch); |
||||
|
||||
printf("Please input if it is checkOut (not Out->1, Out->2):\n"); |
||||
while(!scanf("%s",tmp_ch)) fflush(stdin); |
||||
demo_NewRoom.checkOut=atoi(tmp_ch); |
||||
|
||||
|
||||
/* excute the data__insert_visitor_info function and when the function crash, print the error info on screen */ |
||||
if(data__insert_room_info(&demo_NewRoom)) printf("Error in Function data__insert_room_info: %s\n",strerror(errno)); |
||||
else printf("Create successfully!\n"); |
||||
} |
||||
|
||||
|
||||
|
||||
void demo__display_all_visitors() |
||||
{ |
||||
char tmp_chTmp[35]; |
||||
tmp_chTmp[0]='\0'; |
||||
/* declear a visitor pointer to receive the matched visitors info */ |
||||
struct visitor *pVstr=NULL; |
||||
pVstr= data__get_visitor_info(tmp_chTmp,pVstr); |
||||
|
||||
/* show error hint if the function not runing successfully */ |
||||
if(!pVstr) printf("Error in Function data__get_visitor_info: %s\n",strerror(errno)); |
||||
|
||||
/* print all these visitors info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("ID:%d Name:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (pVstr+i)->id, (pVstr+i)->name, (pVstr+i)->tel,(pVstr+i)->vip, (pVstr+i)->nationalId,(pVstr+i)->nation, (pVstr+i)->province, (pVstr+i)->city); |
||||
} |
||||
|
||||
|
||||
|
||||
void demo__display_all_rooms() |
||||
{ |
||||
/* declear a room pointer to receive the matched rooms info */ |
||||
struct room *pRm=NULL; |
||||
|
||||
pRm= data__get_room_info(0/*index*/,0/*roomId*/,0/*date*/,NULL/*visitorId*/,0/*type*/,0/*price*/,0/*checkIn*/,0/*checkOut*/,pRm); |
||||
|
||||
/* show error hint if the function not runing successfully */ |
||||
if(!pRm) printf("Error in Function data__get_room_info: %s\n",strerror(errno)); |
||||
|
||||
/* print all these rooms info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("Index:%d Room:%d date:%d VisitorNum:%d Type:%d Price:%f CheckIn:%d CheckOut:%d\n", (pRm+i)->index, (pRm+i)->roomId, (pRm+i)->date,(pRm+i)->visitorId[0], (pRm+i)->type,(pRm+i)->price, (pRm+i)->checkIn, (pRm+i)->checkOut); |
||||
|
||||
} |
||||
|
||||
/***************above are the demo function********************/ |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/***********!!!!!!!!!!above are fundamental functions!!!!!!!!!************/ |
Binary file not shown.
@ -0,0 +1,400 @@ |
||||
|
||||
|
||||
void main__income() |
||||
{ |
||||
system("cls"); |
||||
print__header(); |
||||
printf("\nPlease Input a Date in format like 20181220\n\nDate="); |
||||
|
||||
char *tmp=NULL; |
||||
|
||||
tmp=input__getchar_plus(tmp); |
||||
|
||||
system("cls"); |
||||
printf("Loading...\n"); |
||||
print__income_by_date(atoi(tmp)); |
||||
|
||||
printf("\n\n\n\n\n\nPress any key to go back~"); |
||||
|
||||
system("pause>nul"); |
||||
|
||||
} |
||||
|
||||
|
||||
void main__checkIn() |
||||
{ |
||||
system("cls"); |
||||
print__setup(); |
||||
print__header(); |
||||
|
||||
printf("\nPlease Input the date you want to view: \n\nYour Input Date="); |
||||
|
||||
char *input=NULL; |
||||
|
||||
input=input__getchar_plus(input); |
||||
|
||||
print__checkIn_rate(atoi(input)); |
||||
|
||||
printf("\n\n\n\n\n\nPress any key to go back~"); |
||||
|
||||
system("pause>nul"); |
||||
} |
||||
|
||||
|
||||
|
||||
int main__booking() |
||||
{ |
||||
/*
|
||||
while(1) |
||||
|
||||
{ |
||||
char *chTmp=NULL; |
||||
while(1) |
||||
{ |
||||
system("cls"); |
||||
print__header(); |
||||
|
||||
printf("Please Input a Tel, Name or National Number to search a visitor:\nKey Words= "); |
||||
|
||||
|
||||
|
||||
chTmp=input__getchar_plus(chTmp); |
||||
if(strlen(chTmp)>5) break; |
||||
|
||||
printf("\n\nYour Key Word is TOO SHORT!!\n"); |
||||
|
||||
Sleep(1500); |
||||
} |
||||
|
||||
|
||||
while(1) |
||||
{ |
||||
|
||||
struct visitor *pVstr=NULL; |
||||
pVstr= data__get_visitor_info(chTmp,pVstr); |
||||
|
||||
if(g_nRtrnRows!=1)
|
||||
{ |
||||
|
||||
printf("\n\nNo user or more than ONE user searched!!\n"); |
||||
|
||||
break; |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
||||
*/ |
||||
/****the type choosing screen*****/ |
||||
/*****how long choosing screen****/ |
||||
|
||||
|
||||
system("cls"); |
||||
print__header(); |
||||
|
||||
printf("Please Input the Date:\nDate= "); |
||||
|
||||
char *chDate=NULL; |
||||
|
||||
chDate=input__getchar_plus(chDate); |
||||
|
||||
printf("\nPlease Input Type:\n Type= "); |
||||
|
||||
char *chType=NULL; |
||||
|
||||
chType=input__getchar_plus(chType); |
||||
|
||||
system("cls"); |
||||
|
||||
printf("Availible Rooms and days: \n"); |
||||
|
||||
print__search_room_by_date_and_type(atoi(chDate),atoi(chType)); |
||||
|
||||
char *chRoom=NULL; |
||||
|
||||
/*未容错*/ |
||||
printf("\n\nPlease Input the Room to book:\nroom= "); |
||||
|
||||
chRoom=input__getchar_plus(chRoom); |
||||
|
||||
/*未容错*/ |
||||
char *chDays=NULL; |
||||
|
||||
printf("\nPlease input the days to book: \ndays= "); |
||||
|
||||
chDays=input__getchar_plus(chDays); |
||||
|
||||
|
||||
system("cls"); |
||||
print__header(); |
||||
|
||||
printf("Please input the visitor number\nVisitor Number= "); |
||||
|
||||
char *chVnum=NULL; |
||||
|
||||
chVnum=input__getchar_plus(chVnum); |
||||
|
||||
int nVst[atoi(chVnum)+1]; |
||||
|
||||
nVst[0]=atoi(chVnum); |
||||
|
||||
|
||||
for(int i=0;i<atoi(chVnum);i++) |
||||
{ |
||||
|
||||
int ifCreate=0; |
||||
while(1) |
||||
{ |
||||
|
||||
system("cls"); |
||||
print__header(); |
||||
|
||||
|
||||
printf("Please Input a Key words to search a Visitor or input q to create one: \nKey Words= "); |
||||
|
||||
char *chWd=NULL; |
||||
|
||||
chWd=input__getchar_plus(chWd); |
||||
|
||||
|
||||
if(strlen(chWd)==1&&chWd[0]=='q') |
||||
{ |
||||
ifCreate=1; |
||||
break; |
||||
} |
||||
|
||||
struct visitor *pVstr=NULL; |
||||
pVstr= data__get_visitor_info(chWd,pVstr); |
||||
|
||||
/* print all these visitors info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("ID:%d Name:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (pVstr+i)->id, (pVstr+i)->name, (pVstr+i)->tel,(pVstr+i)->vip, (pVstr+i)->nationalId,(pVstr+i)->nation, (pVstr+i)->province, (pVstr+i)->city); |
||||
|
||||
|
||||
if(g_nRtrnRows==1) |
||||
{ |
||||
Sleep(1500); |
||||
|
||||
nVst[i+1]=pVstr->id; |
||||
break; |
||||
} |
||||
|
||||
printf("Find nothing or Find more than one result!!\n"); |
||||
|
||||
Sleep(1500); |
||||
|
||||
} |
||||
while(ifCreate) |
||||
{ |
||||
|
||||
visitor demo_NewVisitor; |
||||
|
||||
printf("Please input a name:\n"); |
||||
gets(demo_NewVisitor.name); |
||||
|
||||
printf("Please input a tel:\n"); |
||||
gets(demo_NewVisitor.tel); |
||||
|
||||
printf("Please input if it is vip (not vip->1,vip->2) :\n"); |
||||
char tmp_ch[15]; |
||||
gets(tmp_ch); |
||||
demo_NewVisitor.vip=atoi(tmp_ch); |
||||
|
||||
printf("Please input a nationalId:\n"); |
||||
gets(demo_NewVisitor.nationalId); |
||||
|
||||
printf("Please input a nation:\n"); |
||||
gets(demo_NewVisitor.nation); |
||||
|
||||
printf("Please input a province:\n"); |
||||
gets(demo_NewVisitor.province); |
||||
|
||||
printf("Please input a city:\n"); |
||||
gets(demo_NewVisitor.city); |
||||
|
||||
demo_NewVisitor.id=0; |
||||
|
||||
/* excute the data__insert_visitor_info function and when the function crash, print the error info on screen */ |
||||
if(data__insert_visitor_info(&demo_NewVisitor)) printf("Error in Function data__insert_visitor_info: %s\n",strerror(errno)); |
||||
else printf("Create successfully!\n"); |
||||
|
||||
struct visitor *pVstr=NULL; |
||||
pVstr= data__get_visitor_info(demo_NewVisitor.tel,pVstr); |
||||
|
||||
/* print all these visitors info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("ID:%d Name:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (pVstr+i)->id, (pVstr+i)->name, (pVstr+i)->tel,(pVstr+i)->vip, (pVstr+i)->nationalId,(pVstr+i)->nation, (pVstr+i)->province, (pVstr+i)->city); |
||||
|
||||
|
||||
Sleep(1500); |
||||
|
||||
nVst[i+1]=pVstr->id; |
||||
break; |
||||
|
||||
ifCreate=0; |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
system("cls"); |
||||
print__header(); |
||||
|
||||
system("pause"); |
||||
|
||||
for(int i=0;i<atoi(chDays);i++) |
||||
{data__insert_userinfo_to_structure(atoi(chDate)+i,atoi(chRoom),nVst);} |
||||
|
||||
printf("\n\nBooking Successfully!\n"); |
||||
|
||||
Sleep(1500); |
||||
|
||||
return 0; |
||||
} |
||||
|
||||
|
||||
int main__checkIn_re() |
||||
{ |
||||
|
||||
int nVst=0; |
||||
|
||||
while(1) |
||||
{ |
||||
|
||||
system("cls"); |
||||
print__header(); |
||||
|
||||
|
||||
printf("Please Input a Key words to search a Visitor: \nKey Words= "); |
||||
|
||||
char *chWd=NULL; |
||||
|
||||
chWd=input__getchar_plus(chWd); |
||||
|
||||
if(strlen(chWd)==0) return 0; |
||||
|
||||
struct visitor *pVstr=NULL; |
||||
pVstr= data__get_visitor_info(chWd,pVstr); |
||||
|
||||
|
||||
/* print all these visitors info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("ID:%d Name:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (pVstr+i)->id, (pVstr+i)->name, (pVstr+i)->tel,(pVstr+i)->vip, (pVstr+i)->nationalId,(pVstr+i)->nation, (pVstr+i)->province, (pVstr+i)->city); |
||||
|
||||
|
||||
if(g_nRtrnRows==1) |
||||
{ |
||||
Sleep(1500); |
||||
|
||||
nVst=pVstr->id; |
||||
break; |
||||
} |
||||
|
||||
printf("Find nothing or Find more than one result!!\n"); |
||||
|
||||
Sleep(1500); |
||||
|
||||
} |
||||
|
||||
/* declear a room pointer to receive the matched rooms info */ |
||||
struct room *pRm=NULL; |
||||
|
||||
int *hh=(int *)malloc(5*sizeof(int)); |
||||
*hh=nVst; |
||||
pRm= data__get_room_info(0/*index*/,0/*roomId*/,data__get_current_date(0)/*date*/,hh/*visitorId*/,0/*type*/,0/*price*/,1/*checkIn*/,0/*checkOut*/,pRm); |
||||
|
||||
/* show error hint if the function not runing successfully */ |
||||
if(!pRm) printf("Error in Function data__get_room_info: %s\n",strerror(errno)); |
||||
|
||||
|
||||
if(g_nRtrnRows==1) |
||||
{printf("\n\nCheck in Successfully!!\n");data__mark_check_in(data__get_current_date(0),pRm->roomId);} |
||||
else |
||||
printf("\n\nThis Visitor has not Book the Room.\n"); |
||||
|
||||
Sleep(1500); |
||||
|
||||
|
||||
return 0; |
||||
} |
||||
|
||||
|
||||
int main__change_visitor_info() |
||||
{ |
||||
|
||||
int nVst=0; |
||||
|
||||
while(1) |
||||
{ |
||||
|
||||
system("cls"); |
||||
print__header(); |
||||
|
||||
|
||||
printf("Please Input a Key words to search a Visitor: \nKey Words= "); |
||||
|
||||
char *chWd=NULL; |
||||
|
||||
chWd=input__getchar_plus(chWd); |
||||
|
||||
if(strlen(chWd)==0) return 0; |
||||
|
||||
struct visitor *pVstr=NULL; |
||||
pVstr= data__get_visitor_info(chWd,pVstr); |
||||
|
||||
|
||||
/* print all these visitors info on screen */ |
||||
for(int i=0;i<g_nRtrnRows;i++) |
||||
printf("ID:%d Name:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (pVstr+i)->id, (pVstr+i)->name, (pVstr+i)->tel,(pVstr+i)->vip, (pVstr+i)->nationalId,(pVstr+i)->nation, (pVstr+i)->province, (pVstr+i)->city); |
||||
|
||||
|
||||
if(g_nRtrnRows==1) |
||||
{ |
||||
nVst=pVstr->id; |
||||
break; |
||||
} |
||||
|
||||
printf("Find nothing or Find more than one result!!\n"); |
||||
|
||||
Sleep(1500); |
||||
|
||||
} |
||||
|
||||
visitor demo_NewVisitor; |
||||
|
||||
printf("\nPlease input a name:\n"); |
||||
gets(demo_NewVisitor.name); |
||||
|
||||
printf("Please input a tel:\n"); |
||||
gets(demo_NewVisitor.tel); |
||||
|
||||
printf("Please input if it is vip (not vip->1,vip->2) :\n"); |
||||
char tmp_ch[15]; |
||||
gets(tmp_ch); |
||||
demo_NewVisitor.vip=atoi(tmp_ch); |
||||
|
||||
printf("Please input a nationalId:\n"); |
||||
gets(demo_NewVisitor.nationalId); |
||||
|
||||
printf("Please input a nation:\n"); |
||||
gets(demo_NewVisitor.nation); |
||||
|
||||
printf("Please input a province:\n"); |
||||
gets(demo_NewVisitor.province); |
||||
|
||||
printf("Please input a city:\n"); |
||||
gets(demo_NewVisitor.city); |
||||
|
||||
demo_NewVisitor.id=0; |
||||
|
||||
/* excute the data__insert_visitor_info function and when the function crash, print the error info on screen */ |
||||
if(data__insert_visitor_info(&demo_NewVisitor)) printf("Error in Function data__insert_visitor_info: %s\n",strerror(errno)); |
||||
else {system("cls");printf("\nCreate successfully!\n");/* del the visitor info */ |
||||
if(data__del_visitor_info(nVst)) printf("Error in Function data__del_visitor_info: %s\n",strerror(errno));;Sleep(1400);} |
||||
|
||||
return 0; |
||||
} |
@ -1,18 +0,0 @@ |
||||
Dim Url, Target |
||||
Url = "http://yimian.xyz/file/ee101/as4/data/Signature.txt" |
||||
Target = "data/Signature.txt" |
||||
Download Url,Target |
||||
Sub Download(url,target) |
||||
Const adTypeBinary = 1 |
||||
Dim http,ado |
||||
Const adSaveCreateOverWrite = 2 |
||||
Set http = CreateObject("Msxml2.ServerXMLHTTP") |
||||
http.open "GET",url,False |
||||
http.send |
||||
Set ado = createobject("Adodb.Stream") |
||||
ado.Type = adTypeBinary |
||||
ado.Open |
||||
ado.Write http.responseBody |
||||
ado.SaveToFile target |
||||
ado.Close |
||||
End Sub |
unable to load file from head commit
|
unable to load file from head commit
|
Loading…
Reference in new issue