예제 #1
0
파일: Schedule_UI.c 프로젝트: wangto/src
void Schedule_UI_Add()
{
 Schedule_Srv_Add();
    
}
예제 #2
0
int Schedule_UI_Add(int play_id) {
	int er=0,sid,newRecCount=0;
       	char choice;
	schedule_t data;
	studio_t sdata;	
	play_t pdata;
    cl_stdin();
		do { 

				system("clear");
				printf("\n\n\n\t\t		=================================================================");
        			printf("\n\t\t		***************************添加演出计划**************************");
          			printf("\n\t\t		=================================================================");
				data.id = EntKey_Srv_CompNewKey("schedule");
				data.play_id=play_id;
				while(1){
				printf("\n\t\t		|     请输入演出厅ID:");
					if(scanf("%d",&sid)==1){
					 cl_stdin(); 
					 
					 if(!Studio_Srv_FetchByID(sid, &sdata)){
					 	printf("\n\t\t\t\t                    **没有演出厅信息!请重新输入**        ");
					 	continue;
					 }
					 
					data.studio_id=sdata.id;
                    data.price=pdata.price;
					data.seat_count=Seat_Number_Count(data.studio_id);
					 
					 break;
					}
					else{ cl_stdin(); printf("\n\t\t\t您的输入有误!请重新输入**  "); }
				}
				while(1){
				printf("\n\t\t		|     请输入演出日期:");
					if(scanf("%d%d%d",&(data.date.year), &(data.date.month), &(data.date.day))==3){
						 cl_stdin();
						 if(data.date.month>12 || data.date.day>31){
						 	printf("\n\t\t		                      **您输入的日期有误!请重新输入**     ");
						 	continue;
						 }
						 if(DateCmp(data.date, DateNow())==-1){
						 	printf("\n\t\t		                      **您输入的日期太早!请重新输入**     ");
						 	continue;
						 
						 }
						 
						 break;
					}
					else{ cl_stdin();printf("\n\t		                        **您的输入有误!请重新输入**     "); }
				}
				
				

				while(1){ 
				printf("\n\t\t		|     请输入演出时间(h min):");
					if(scanf("%d %d",&(data.time.hour), &(data.time.minute))==2){
						data.time.second=0;
						cl_stdin();
						if(data.time.hour>24 || data.time.minute>60){
						 	printf("\n\t\t		                        **您的输入有误!请重新输入**     "); 
						 	continue;
						 }
						
						 break;
					}
					else{ cl_stdin(); printf("\n\t		                        **您的输入有误!请重新输入**     ");  }
				}
				
				
				printf("\n\t\t		==================================================================");		

				if(Schedule_Srv_Add(&data)){
					//Ticket_Srv_AddBatch(data.id, data.studio_id);
					newRecCount++;
					printf("\n\t\t		------------------------添加计划成功!--------------------------");
					printf("\n\t\t		******************************************************************");
				}else{
					
				}
				printf("\n\t\t		==================================================================");
       				printf("\n\t\t		|         [A]dd More               |             [R]eturn        |");
        			printf("\n\t\t		******************************************************************");
        			printf("\n\t\t		Iput Your choice:");
		
				choice=l_getc();
		} while ('a' == choice || 'A' == choice);
	return newRecCount;
			
     
}