Ejemplo n.º 1
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;
	}
Ejemplo n.º 2
0
	void resultSearch(const LodgingList & lodginglist, SFilter & sf, Member & member)
	{
		LodgingList llresult;
		LodgingList ll = lodginglist;
		int i = 1;
		int size = ll.getSize();

		if(size > 0)
		{
			Room r;
			Lodging l = ll.getFirstLodging();
			RoomList rl = l.getRoomList();
			RoomList rldel;
			fileIO::loadBookLodging(rldel, l.getLNumber(), sf.getYear(), sf.getMonth(), sf.getDay(), sf.getPeriod());
			int delsize = rldel.getSize();
			int j = 1;
			int money = 2000000000;

			if(rl.getSize() != delsize)
			{
				if(delsize > 0)
					rl.delRoom(rldel.getFirstRoom().getRNumber());
				while(delsize > j++)
					rl.delRoom(rldel.getNextRoom().getRNumber());

				int rlsize = rl.getSize();
				j = 1;

				if(rlsize > 0)
				{
					r = rl.getFirstRoom();
					if(r.getPersonMax() >= sf.getPerson() && money > r.calcPrice(sf.getPerson()))
							money = r.calcPrice(sf.getPerson());
				}
				while(rlsize > j)
				{
					r = rl.getNextRoom();
					if(r.getPersonMax() >= sf.getPerson() && money > r.calcPrice(sf.getPerson()))
						money = r.calcPrice(sf.getPerson());
					j++;
				}

				l.setSMoney(money);

				if(money != 2000000000)
					llresult.addLodging(l);
			}
		}

		while(size > i)
		{
			Room r;
			Lodging l = ll.getNextLodging();
			RoomList rl = l.getRoomList();
			RoomList rldel;
			fileIO::loadBookLodging(rldel, l.getLNumber(), sf.getYear(), sf.getMonth(), sf.getDay(), sf.getPeriod());
			int delsize = rldel.getSize();
			int j = 1;
			int money = 2000000000;

			if(rl.getSize() != delsize)
			{
				if(delsize > 0)
					rl.delRoom(rldel.getFirstRoom().getRNumber());
				while(delsize > j++)
					rl.delRoom(rldel.getNextRoom().getRNumber());

				int rlsize = rl.getSize();
				j = 1;

				if(rlsize > 0)
				{
					r = rl.getFirstRoom();
					if(r.getPersonMax() >= sf.getPerson() && money > r.calcPrice(sf.getPerson()))
							money = r.calcPrice(sf.getPerson());
				}
				while(rlsize > j)
				{
					r = rl.getNextRoom();
					if(r.getPersonMax() >= sf.getPerson() && money > r.calcPrice(sf.getPerson()))
						money = r.calcPrice(sf.getPerson());
					j++;
				}

				l.setSMoney(money);

				if(money != 2000000000)
					llresult.addLodging(l);
			}
			i++;
		}

		llresult = sort(llresult, CR_MONEY);

		cout
		<< " ****************************************************************************** " << endl
		<< " *                           숙 박 예 약 프 로 그 램                          * " << endl
		<< " ****************************************************************************** " << endl
		<< endl
		<< setw(7) << sf.getYear() << "년 " << setw(2) << sf.getMonth() << "월 " << setw(2) << sf.getDay() << "일부터 " << sf.getPeriod() << "일간 예약 가능한 " << sf.getPerson() << "명 이상의 방입니다." << endl
		<< endl
		<< "     번호 /         숙소 이름         /    위치    /  등급  /    가격" << endl;

		int sizellr = llresult.getSize();
		int k = 1;

		if(sizellr > 0)
		{
			Lodging l = llresult.getFirstLodging();
			cout << setw(9) << 1 << " / " << setw(25) << l.getName() <<  " / ";
			switch(l.getLocation())
			{
			case 1:
				cout << "   서울   ";
				break;
			case 2:
				cout << "   부산   ";
				break;
			case 3:
				cout << "  제주도  ";
				break;
			default:
				cout << "          ";
			}

			cout << " / ";
			for(int x = 0; x < 5; x++)
			{
				if(x < l.getStar())
					cout << "★";
				else
					cout << " ";
			}
			cout << "  /" << setw(11) << l.getSMoney() << endl;
		}

		while(sizellr > k)
		{
			Lodging l = llresult.getNextLodging();
			cout << setw(9) << k + 1 << " / " << setw(25) << l.getName() <<  " / ";
			switch(l.getLocation())
			{
			case 1:
				cout << "   서울   ";
				break;
			case 2:
				cout << "   부산   ";
				break;
			case 3:
				cout << "  제주도  ";
				break;
			default:
				cout << "          ";
			}

			cout << " / ";
			for(int x = 0; x < 5; x++)
			{
				if(x < l.getStar())
					cout << "★";
				else
					cout << " ";
			}
			cout << "  /" << setw(11) << l.getSMoney() << endl;
			k++;
		}
		cin.ignore(1024, '\n');
		cout << endl << "   확인할 번호를 입력하세요." << endl
			<< "입력(1~" << sizellr << "):";
		int y = keyIO::inputNumList(1, sizellr);

		Lodging lresult = llresult.searchIndexLodging(y-1);
		reservation::viewDetailLodging(lresult, sf, member);
	}
Ejemplo n.º 3
0
	int viewLodging(Member & member) //예약확인
	{

		system("clear");
		


		RoomList rl;
		int memnum;
		memnum = member.getMNumber();
		fileIO::loadBookUser(rl, memnum);
		Room a = rl.getFirstRoom();
		int size = rl.getSize();
			


		int y,m,d,p, r, l, person;
		int x = 1;	

		cout << "******************************************************************************" <<endl;
		cout << "              			나의 예약 현황" <<endl;
		cout << "******************************************************************************" <<endl;



	
		if( size > 0 )
		{

	 		y = a.getMYear();
			m = a.getMMonth();
			d = a.getMDay();
			p = a.getMPeriod();
			r = a.getRNumber();
			person = a.getMPerson();
			l = a.getLNumber();
			cout << "			Hotel Number : " << l <<endl;
			cout << "			RNUMBER : " << r << endl;
			cout << "			HEAD COUNT : " << person << endl;
			cout << "			DATE : "<< y << " " << m << " " << d << "부터 " << p << "일 동안" << endl;
			cout << "----------------------------------------------------------------------------" <<endl;

		}

		while ( x < size )
		{
	 		Room b = rl.getNextRoom();
			y = b.getMYear();
			m = b.getMMonth();
			d = b.getMDay();
			p = b.getMPeriod();
			r = b.getRNumber();
			l = a.getLNumber();
			cout << "			Hotel Number : " << l <<endl;			
			cout << "			RNUMBER : " << r << endl;
			cout << "			HEAD COUNT : " << person << endl;
			cout << "			DATE : "<< y << " " << m << " " << d << "부터 " << p << "일 동안" << endl;
			cout << "----------------------------------------------------------------------------" <<endl;

			x++;

		}
	


	cin.ignore(1024, '\n');
	
	}