Exemplo n.º 1
0
int Studio_UI_Modify(int id) {
	studio_t rec;
	int rtn = 0;
	int newrow, newcolumn;
	seat_list_t list;
	int seatcount;

	/*Load record*/
	if (!Studio_Srv_FetchByID(id, &rec)) {
		printf("The room does not exist!\nPress [Enter] key to return!\n");
		getchar();
		return 0;
	}

	printf("\n=======================================================\n");
	printf("****************  Update Projection Room  ****************\n");
	printf("-------------------------------------------------------\n");
	printf("Room ID:%d\n", rec.id);
	printf("Room Name[%s]:", rec.name);
	fflush(stdin);
	gets(rec.name);

	List_Init(list, seat_node_t);
	seatcount = Seat_Srv_FetchByRoomID(list, rec.id);
	if(seatcount){
		do{			
			printf("Row Count of Seats should >= [%d]:", rec.rowsCount);
			scanf("%d", &(newrow));
			printf("Column Count of Seats should >= [%d]:", rec.colsCount);
			scanf("%d", &(newcolumn));
		}while(	newrow<rec.rowsCount||newcolumn<rec.colsCount);
		rec.rowsCount=newrow;
		rec.colsCount=newcolumn;
		rec.seatsCount=seatcount;
	}
	else{
		printf("Row Count of Seats:");
		scanf("%d", &rec.rowsCount);
		printf("Column Count of Seats:");
		scanf("%d", &rec.colsCount);
		rec.seatsCount=0;
	}

	printf("-------------------------------------------------------\n");

	if (Studio_Srv_Modify(&rec)) {
		rtn = 1;
		printf(
				"The room data updated successfully!\nPress [Enter] key to return!\n");
	} else
		printf("The room data updated failed!\nPress [Enter] key to return!\n");

	getchar();
	return rtn;
}
Exemplo n.º 2
0
//根据计划ID,显示演出票
void Sale_UI_ShowTicket(int schID){
	char choice;int i;
	ticket_list_t list;
	ticket_list_t pTemp;
	char status[10];
	play_t play;
	schedule_t sch;
	studio_t stu;
	seat_list_t seat_l;
	seat_t seat;
	Pagination_t paging;

	List_Init(seat_l,seat_node_t);
	List_Init(list,ticket_node_t);
	
	Schedule_Srv_FetchByID(schID, &sch);
	Play_Srv_FetchByID(sch.play_id, &play);
	Studio_Srv_FetchByID(sch.studio_id, &stu);
	Seat_Srv_FetchByRoomID(seat_l,sch.studio_id);
	paging.offset = 0;
	paging.pageSize = 10;
	paging.totalRecords = Ticket_Srv_FetchBySchID(list,schID);
	Paging_Locate_FirstPage(list, paging);
	do{
		system("clear");
	printf("|=============================================================================================================================|\n");
	printf("|-------------------------------------------------------票 信 息 输 出--------------------------------------------------------|\n");
	printf("|-----------------------------------------------------------------------------------------------------------------------------|\n");
                printf("%10s%20s%20s%20s%20s%20s%20s%20s\n","票ID","演出计划ID","剧目名称","演出厅名称","座位ID","座位行列号","票价","座位状态");
	printf("|-----------------------------------------------------------------------------------------------------------------------------|\n");
	Paging_ViewPage_ForEach(list, paging, ticket_node_t, pTemp, i)
	{
		Seat_Srv_FetchByID(pTemp->data.seat_id,&seat);
		if (pTemp->data.status == (ticket_status_t)0)
      			strcpy(status,"待售");
		else if (pTemp->data.status == (ticket_status_t)1)
       			strcpy(status,"已售");
		else if (pTemp->data.status == (ticket_status_t)9)
              		strcpy(status,"预留");
		printf("%9d%12d%18s%15s%18d          (%d,%d) %18d%16s\n",pTemp->data.id,pTemp->data.schedule_id,play.name,stu.name,pTemp->data.seat_id,seat.row,seat.column,pTemp->data.price,status);
	}
		printf("|------------------------ 总条数:%2d ------------------------------------------------------ 页码 %2d/%2d ------------------------|\n",
				paging.totalRecords, Pageing_CurPage(paging),
				Pageing_TotalPages(paging));
		printf("|-----------------------------[P]上一页   |  [N]下一页   |   [r]返回上一级 | [b]售票---------------------------------------|\n");
		printf("|=============================================================================================================================|\n");
		printf("请选择:");
	        scanf("%c",&choice);	flu();
		switch(choice)
		{
			case 'b':
			case 'B':
				if(Sale_UI_SellTicket(list,seat_l))
				{
					printf("正在重载票....\n");
					if (Ticket_Srv_FetchBySchID(list,schID))
						printf("票信息重载成功!\n");
				}
				printf("输入Enter返回...");	flu();
				break;
			case 'p':
			case 'P':
				if (!Pageing_IsFirstPage(paging)) {
					Paging_Locate_OffsetPage(list, paging, -1, ticket_node_t);
				}
				break;
			case 'N':
			case 'n':
				if (!Pageing_IsLastPage(paging)) {
					Paging_Locate_OffsetPage(list, paging, 1, ticket_node_t);
				}
				break;
			//case 'r':
			//case 'R':
			//	return;
		}
	}while(choice != 'R' && choice != 'r');