yimian
string1995 5 years ago
parent ff83fe8f02
commit c8405c8424
  1. 23
      data.h
  2. 2
      login.h
  3. 11
      main.c
  4. BIN
      main.exe
  5. 13
      maincode.h
  6. 8
      print.h

@ -457,15 +457,18 @@ int data__insert_room_info(struct room *pRm)
fp = fopen (chPath, "at+");
/* transform visitorId to string */
char tmp_visitorId[12*(VISITOR_MAX_NUMBER+1)];
char *tmp_visitorId=(char*)malloc(20*(VISITOR_MAX_NUMBER+1)*sizeof(char));
tmp_visitorId[0]='\0';
char tmp_str[12];
for(int i=1;i<=pRm->visitorId[0];i++)
{
sprintf(tmp_str,"%d",pRm->visitorId[i]);
strcat(tmp_visitorId,tmp_str);
}
if(pRm->visitorId[0]==1)
sprintf(tmp_visitorId,"%d",pRm->visitorId[1]);
if(pRm->visitorId[0]==2)
sprintf(tmp_visitorId,"%d%d",pRm->visitorId[1],pRm->visitorId[2]);
if(pRm->visitorId[0]==3)
sprintf(tmp_visitorId,"%d%d%d",pRm->visitorId[1],pRm->visitorId[2],pRm->visitorId[3]);
//strcat(tmp_visitorId,tmp_str);
/* if no visitorId, put 0 in string*/
if(pRm->visitorId[0]==0) sprintf(tmp_visitorId,"%d",0);
@ -1076,7 +1079,7 @@ struct room *data__get_room_info(int index, int roomId, int date, int *visitorId
/* find room info position in File by key words */
a=data__seek_key_word(value, fp,a,2);
a=data__seek_key_word(value, fp,a,2);//printf("%d\n",a[0] );system("pause");
/* if no room found */
if(!a){errno=0; g_nRtrnRows=0; return NULL;}
@ -1506,9 +1509,9 @@ int data__insert_userinfo_to_structure(int Date,int RoomNo,int* Visitordetail)
containerwow.price=pts->price;
containerwow.roomId=pts->roomId;
containerwow.type=pts->type;
for(int i=0;i<2;i++)
for(int i=0;i<4;i++)
{
containerwow.visitorId[i]=Visitordetail[i];
containerwow.visitorId[i]=Visitordetail[i];printf("%d\n",containerwow.visitorId[i] );
}
data__insert_room_info(&containerwow);

@ -275,7 +275,7 @@ void login__setup()
if(fopen(chPath,"r")==NULL)
{
MessageBox( 0, "Password File Broken!!", "AS4 Message", 0 );
MessageBox( 0, "Successful initialized! Please open again to run the program!", "AS4 Message", 0 );
sprintf(chPath,"if exist %s\\%s (echo >nul)else (echo g48xQ5l05mvy6u30vzd20UK7g48xQ5l05mvy6>%s\\%s)>nul",DATA_FOLDER,MANAGER_PASSWD_FILE,DATA_FOLDER,MANAGER_PASSWD_FILE);

@ -168,7 +168,6 @@ int final_main();
/*****************please put your function declearation here!!***********************/
@ -189,7 +188,7 @@ int main(int argc, char *argv[])
/* start monitor event, for the purpose of kill bgm and delete tmp file after user exit */
data__start_monitor(argv[0]);
//demo__test_fundamental_functions(); /* Don't Remove This For Test Purpose!! */
demo__test_fundamental_functions(); /* Don't Remove This For Test Purpose!! */
final_main();
@ -311,10 +310,10 @@ int final_main()
if(nPnt==1) main__income();
if(nPnt==2) main__checkIn();
if(nPnt==3) {system("cls");printf("Loading...\n"); data__export_room_to_excel();}
if(nPnt==4) {system("cls");printf("Loading...\n"); data__export_visitor_to_excel();}
if(nPnt==5) {system("cls");printf("If Windows no feedback for long time, Please close the window with control ^C\n\nUploading...\n");Sleep(2500); download__upload();Sleep(4000);}
if(nPnt==6) {system("cls");printf("Downloading...\n"); download__data(VISITOR_DATA_FILE);download__data(VISITOR_DEL_FILE);download__data(ROOM_DATA_FILE);}
if(nPnt==3) {while(1){system("cls");printf("Loading...\n");if(is_busy) {system("cls");printf("\nThere are data operation conducting, please wait a while..\n");Sleep(1500);break;} data__export_room_to_excel();Sleep(1500);break;}}
if(nPnt==4) {while(1){system("cls");if(is_busy) {system("cls");printf("\nThere are data operation conducting, please wait a while..\n");Sleep(1500);break;}printf("Loading...\n"); data__export_visitor_to_excel();}}
if(nPnt==5) {while(1){system("cls");if(is_busy) {system("cls");printf("\nThere are data operation conducting, please wait a while..\n");Sleep(1500);break;}printf("If Windows no feedback for long time, Please close the window with control ^C\n\nUploading...\n");Sleep(2500); download__upload();Sleep(4000);}}
if(nPnt==6) {while(1){system("cls");if(is_busy) {system("cls");printf("\nThere are data operation conducting, please wait a while..\n");Sleep(1500);break;}printf("Downloading...\n"); download__data(VISITOR_DATA_FILE);download__data(VISITOR_DEL_FILE);download__data(ROOM_DATA_FILE);}}
if(nPnt==0) step=1;

Binary file not shown.

@ -172,7 +172,7 @@ for(int i=0;i<atoi(chVnum);i++)
/* 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);
printf("\n\n Name:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (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)
@ -227,7 +227,7 @@ for(int i=0;i<atoi(chVnum);i++)
/* 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);
printf(" \n\nName:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (pVstr+i)->name, (pVstr+i)->tel,(pVstr+i)->vip, (pVstr+i)->nationalId,(pVstr+i)->nation, (pVstr+i)->province, (pVstr+i)->city);
Sleep(1500);
@ -244,7 +244,6 @@ for(int i=0;i<atoi(chVnum);i++)
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);}
@ -284,7 +283,7 @@ int main__checkIn_re()
/* 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);
printf("\n\nName:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (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)
@ -311,9 +310,9 @@ int main__checkIn_re()
/* show error hint if the function not runing successfully */
if(!pRm) printf("Error in Function data__get_room_info: %s\n",strerror(errno));
data__mark_check_in(data__get_current_date(0),pRm->roomId);
if(g_nRtrnRows==1)
{printf("\n\nCheck in Successfully!!\n");data__mark_check_in(data__get_current_date(0),pRm->roomId);}
{printf("\n\nCheck in Successfully!!\n");}
else
printf("\n\nThis Visitor has not Book the Room.\n");
@ -350,7 +349,7 @@ int main__change_visitor_info()
/* 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);
printf("\n\nName:%s Tel:%s VIP:%d NationalID:%s Nation:%s province:%s City:%s\n", (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)

@ -138,8 +138,16 @@ void print__login(int nPnt)
}
void print__roomId(room *pRm)
{
for (int i = 0; i<g_nRtrnRows-1; i++)
for (int j = 0; j < g_nRtrnRows- i-1 ; j++)
{
if ((pRm+j)->roomId > (pRm+j+1)->roomId ) {
int temp = (pRm+j)->roomId ; (pRm+j)->roomId = (pRm+j+1)->roomId ; (pRm+j+1)->roomId = temp;
}
}
int t=0;
for(int i=0;i<g_nRtrnRows;)

Loading…
Cancel
Save