Exemplo n.º 1
0
int ioHandler::getRoomNo(RoomList& r_list)
{
	int r_no;

	while (1)
	{
		r_no = getInteger("병실 번호 : ", 100, 999);
		Room r = r_list.searchRoom(r_no);
		if (r.room_no != NULL) break;			// if valid room no
		putString("", "Invalid room no!!, Retry!!");
	}
	return r_no;
}
Exemplo n.º 2
0
	int checkBook(const Lodging & lodging)
	{
		Room r;
		RoomList rltemp;
		RoomList rl = lodging.getRoomList();
		int size = rl.getSize();
		Calendar cal = Calendar(true);
		int x = 1;

		cout
			<< " ****************************************************************************** " << endl
			<< "                          숙 박 업 소 관 리 프 로 그 램  " << endl
			<< " ****************************************************************************** " << endl
			<< endl;

		cout << setw(15) << "";
		int m, d;
		for( int plus = 0; plus < 7 ; plus++) //1주 분량의 날짜
		{
			m = cal.getMonth();
			d = cal.getDay();
			cout << setw(2) << m << "/" << setw(2) << d << " ";
			cal.addOneDay();
		}
		cout <<  endl;
		cout << "------------------------------------------------------------" <<endl;


		if(size > 0)
		{
			cal = Calendar(true);
			r = rl.getFirstRoom();

			cout << setw(11) << r.getRNumber() << "호| ";
			for ( int plus = 0 ; plus < 7 ; plus ++)
			{
				Room b;
				int k;

				fileIO::loadBookLodging(rltemp, r.getLNumber(), cal.getYear(), cal.getMonth(), cal.getDay(), 1);
				b = rltemp.searchRoom(r.getRNumber());
				k = b.getRNumber();
				if (k == -1)
					cout << "  O   ";
				else
					cout << "  X   ";
				cal.addOneDay();
			}
			cout << endl;
		}

		while ( x < size )
		{
			cal = Calendar(true);
			r = rl.getNextRoom();
			cout << setw(11) << r.getRNumber() << "호| ";
			for(int plus = 0; plus < 7; plus++)
			{
				Room b;
				int k;
				fileIO::loadBookLodging(rltemp, r.getLNumber(), cal.getYear(), cal.getMonth(), cal.getDay(), 1);
				b = rltemp.searchRoom(r.getRNumber());
				k = b.getRNumber();
				if (k == -1)
					cout << "  O   ";
				else
					cout << "  X   ";
				cal.addOneDay();
			}
			x++;
			cout << endl;
		}

		cal = Calendar(true);
		x = 1;

		cout << endl << " 오늘의 예약 | 인원 | 기간 |     연 락 처     |   이   름 " << endl
			<< "------------------------------------------------------------" <<endl;
		if(size > 0)
		{
			r = rl.getFirstRoom();

			cout << setw(11) << r.getRNumber() << "호| ";
			int k;

			Member m = fileIO::getBookUser(r.getLNumber(), r.getRNumber(), cal.getYear(), cal.getMonth(), cal.getDay());
			k = m.getMNumber();
			if (k == -1)
				cout << " 오늘의 예약이 없습니다.";
			else
				cout << setw(4) << m.getSPerson() << " | " << setw(4) << m.getSPeriod() << " | " << setw(16) << m.getTelephone() << " | " << m.getName();
			cout << endl;
		}

		while ( x < size )
		{
			r = rl.getNextRoom();
			cout << setw(11) << r.getRNumber() << "호| ";
			Room b;
			int k;
			Member m = fileIO::getBookUser(r.getLNumber(), r.getRNumber(), cal.getYear(), cal.getMonth(), cal.getDay());
			k = m.getMNumber();
			if (k == -1)
				cout << " 오늘의 예약이 없습니다.";
			else
				cout << setw(4) << m.getSPerson() << " | " << setw(4) << m.getSPeriod() << " | " << setw(16) << m.getTelephone() << " | " << m.getName();
			x++;
			cout << endl;
		}

		x = 1;

		cout << endl << " 오늘의 룸서비스 : ";
		if(size > 0)
		{
			r = rl.getFirstRoom();

			if(fileIO::getBookRoomStatus(r.getLNumber(), r.getRNumber(), cal.getYear(), cal.getMonth(), cal.getDay()) == 1)
				cout << r.getRNumber() << "호, ";
		}

		while ( x < size )
		{
			r = rl.getNextRoom();
			if(fileIO::getBookRoomStatus(r.getLNumber(), r.getRNumber(), cal.getYear(), cal.getMonth(), cal.getDay()) == 1)
				cout << r.getRNumber() << "호, ";
			x++;
		}
		cout << endl;

		keyIO::getch();

		return M_MENU;
	}
Exemplo n.º 3
0
	int viewDetailLodging(Lodging & lodging, Member & member)
	{
		system ("clear");

		int i,j;
		cout << "호텔의 고유 번호를 입력하세요 : " << endl;
		cin >>i;
		j = fileIO::loadLodging(lodging, i);
		if ( j == -1 )
		{
			cin.ignore(1024, '\n');
			cout << " Error " << endl;
			cin.ignore(1024, '\n');
			return 3;}

		else
		{
		cin.ignore(1024, '\n');



		system ("clear");
		cout << "******************************************************************************"<< endl;
		cout << "                               호텔 정보 확인" << endl;
		cout << "****************************************************************************** "
			 << endl << endl;
		cout << "	호텔 이름 : " << lodging.getName() << endl << endl;
		cout << "	호텔 주소 : " << lodging.getAddress() << endl << endl;
		cout << "	호텔 등급 : " << lodging.getStar() << endl <<  endl;
		cout << "	호텔 연락처 : " << lodging.getTelephone() << "/"  << lodging.getCellphone() << endl <<endl;
		cout << " 	방정보 : " << endl << endl;


		RoomList a= lodging.getRoomList();
		int size = a.getSize();




		int x = 1;

		Room r = a.getFirstRoom();
		if (r.getRNumber() == -1)
		{	cin.ignore(1024, '\n');
			cout << " 해당 호텔은 방이 존재하지 않습니다. " <<endl;
			cout << " Go Back " <<endl;
			cin.ignore(1024, '\n');
			return 3;}


		if(size > 0 )
		{
			//Room r = a.getFirstRoom();
			cout << "	--------------------------------" <<endl;
			cout << "	호수 : " << r.getRNumber() << endl;
			cout << "	방 권장 인원 : " << r.getPersonRecomm() << endl;
			cout << "	방 최대 인원 : " << r.getPersonMax() << endl;
			cout << "	권장인원 예약 금액 : " << r.getPrice() <<endl;
			cout << "	인원 초과시 1인당 추가 금액: " << r.getPriceAdd() << endl;
			cout << "	--------------------------------" <<endl << endl;


		}


		while ( x < size )
		{
			r = a.getNextRoom();
			cout << "	--------------------------------" <<endl;
			cout << "	호수 : " << r.getRNumber() << endl;
			cout << "	방 권장 인원 : " << r.getPersonRecomm() << endl;
			cout << "	방 최대 인원 : " << r.getPersonMax() << endl;
			cout << "	권장인원 예약 금액 : " << r.getPrice() <<endl;
			cout << "	인원 초과시 1인당 추가 금액 : " << r.getPriceAdd() << endl;
			cout << "	--------------------------------" <<endl <<endl;
			x++;
		}




		Calendar cal;
		cal = Calendar(true);
		int m, d;
		for( int plus = 0; plus < 14 ; plus++) //2주 분량의 날짜
		{
			m=cal.getMonth();
			d=cal.getDay();
			cout << "	" <<m << "/"<< d << " ";
			cal.addOneDay();
		}
		cout <<  endl;
cout << "	--------------------------------------------------------------------------------------------------------------" <<endl;

		x=1;



		cal = Calendar(true);
		r = a.getFirstRoom();
		RoomList rl;

		cout << r.getRNumber() << "호| ";
		for ( int plus = 0 ; plus < 14 ; plus ++)
		{
		Room b;
		int k;

		fileIO::loadBookLodging(rl, r.getLNumber(), cal.getYear(), cal.getMonth(), cal.getDay(), 1);
		b = rl.searchRoom(r.getRNumber());
		k = b.getRNumber();
		if (k== -1)
			cout << "   O    ";
		else
			cout << "   X    ";
		cal.addOneDay();
		}
		cout << endl;



		while ( x < size )
		{
		cal = Calendar(true);
		r = a.getNextRoom();
		cout << r.getRNumber() << "호| ";
		for ( int plus = 0 ; plus < 14 ; plus ++)
		{
		Room b;
		int k;
		fileIO::loadBookLodging(rl, r.getLNumber(), cal.getYear(), cal.getMonth(), cal.getDay(), 1);
		b = rl.searchRoom(r.getRNumber());
		k = b.getRNumber();
		if (k== -1)
			cout << "   O    ";
		else
			cout << "   X    ";
		cal.addOneDay();
		}
		x++;
		cout << endl;
		}



		cout << endl << endl;
		char j;
		cout << "예약하시겟습니까? (y/n) ";
		cin >> j;
		if ( j == 'y' )
		{
			cin.ignore(1024, '\n');
			bookRoom(lodging, member);
		}
		else if ( j == 'n' )
			return 3;
		else
		{
			cout << "올바른 입력을 해주세요. " << endl;
			reservationMenu(member);
		}

		}

	}