Esempio n. 1
0
bool HandleDestroy( ChatServer *server, User *user, const ChatPacket *packet )
{
	if( !user->IsMod() )
		return false;

	RoomList *pList = server->GetRoomList();
	const string &sRoom = packet->sMessage;

	// check to make sure that no one's trying to destroy Main
	const string &sDefaultRoom = pList->GetName( pList->GetDefaultRoom() );

	// consequences shall be dire!
	if( sRoom.compare( sDefaultRoom ) == 0 )
	{
		const string HAL = "[Server] I'm afraid I can't let you do that, " + user->GetName() + ".";
		server->Broadcast( ChatPacket(WALL_MESSAGE, BLANK, HAL) );
		user->Kill();
		return true;
	}

	// remove the room and broadcast its destruction
	pList->RemoveRoom( sRoom );
	server->Broadcast( ChatPacket(DESTROY_ROOM, BLANK, sRoom) );

	return true;
}
Esempio n. 2
0
bool HandleForceJoin( ChatServer *server, User *user, const ChatPacket *packet )
{
	if( !user->IsMod() )
		return false;

	const string& sRoom = packet->sMessage;
	RoomList *list = server->GetRoomList();
	Room *room = list->GetRoom( sRoom );

	// doesn't exist, don't let mods send users into oblivion
	if( room == NULL )
		return false;

	User *target = server->GetUserByName( packet->sUsername );

	// can't find the desired target, so can't mess with
	if( target == NULL )
		return false;

	room->AddUser( target );

	// broadcast the new room join
	server->Broadcast( ChatPacket(JOIN_ROOM, target->GetName(), sRoom) );

	const string sMessage = target->GetName() + " was forced to join "
		+ sRoom + " by " + user->GetName();

	server->WallMessage( sMessage );

	return true;
}
Esempio n. 3
0
bool HandleCreate( ChatServer *server, User *user, const ChatPacket *packet )
{
	if( !user->IsMod() )
		return false;

	const string &sRoom = packet->sMessage;

	RoomList *list = server->GetRoomList();
	Room *room = list->GetRoom( sRoom );

	if( room != NULL )
	{
		ChatPacket msg( WALL_MESSAGE, BLANK, "That room already exists!" );
		user->Write( msg.ToString() );
		return false;
	}

	// length check, since really long names make the client freak out
	if( sRoom.length() > 16 )
	{
		ChatPacket msg( WALL_MESSAGE, BLANK, "Room names are limited to 16 characters." );
		user->Write( msg.ToString() );
		return false;
	}

	list->AddRoom( sRoom );

	// this should never fail - we just added it
	room = list->GetRoom( sRoom );
	if( room == NULL )
	{
		LOG->System( "Failed to get newly created room \"%s\"!", sRoom.c_str() );
		return true;	// log it
	}

	room->AddUser( user );

	// broadcast the new room creation and join
	server->Broadcast( ChatPacket(CREATE_ROOM, BLANK, sRoom) );
	server->Broadcast( ChatPacket(JOIN_ROOM, user->GetName(), sRoom) );

	return true;
}
Esempio n. 4
0
void FileHandler::saveRoomList(string fname, RoomList& r_list)
{
	// open file
	ofstream fout;
	fout.open(fname);
	if (!fout)
	{
		cerr << "\n" << "can't open file!!";
		exit(1);
	}

	// save data into file
	int count = r_list.getCount();
	for (int i = 0; i<count; i++)
	{
		Room r = r_list.getRoomList(i);
		fout << r.room_no << " " << r.room_type << " " << r.sex << " " << r.max_patient << " " << r.current_patient << endl;
	}

	// close file
	fout.close();
}
Esempio n. 5
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;
}
Esempio n. 6
0
void FileHandler::loadRoomList(string fname, RoomList& r_list)
{	// open file
	ifstream fin;
	fin.open(fname, ios_base::in);
	if (!fin)
	{
		cerr << "\n" << "can't open file!!";
		return;
	}

	// read data from file
	Room r;
	while (!fin.eof()) // read data
	{
		fin >> r.room_no >> r.room_type >> r.sex >> r.max_patient >> r.current_patient;
		r_list.insertRoom(r);
	}

	// close file
	fin.close();
}
Esempio n. 7
0
void FileHandler::loadRoomList(string fname, RoomList& r_list)
{
	// open file
	ifstream fin;
	fin.open(fname);
	if (!fin) 
	{
		cerr << "\n" << "can't open " << fname << "!!";
		return;
	}

	// read data from file
	Room r;
	while (!fin.eof())	// read data
	{
		fin >> r.room_no >> r.room_type >> r.sex >> r.capacity >> r.p_count;
		r_list.insertRoom(r);
	}

	// close file
	fin.close();
}
Esempio n. 8
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);
	}
Esempio n. 9
0
	int searchRoom( LodgingList & lodginglist, Member & member)
	{
	string condition;
    		cout<<"search condition"<<endl<<"0:finish"<<endl
        	<<"1:호텔명"<<endl
		<<"2:지역"<<endl
		<<"3:등급"<<endl
		<<"4:최대 인원"<<endl
		<<"5:가격"<<endl
		<<"6:모든 호텔"<<endl
		<<"7:다중 조건 검색"<<endl
		<<"8:날짜, 기간, 인원"<<endl
		<<"검색 조건을 입력 하세요.(0~8):"<<endl;
		int Lnumber;        // 숙박업소 고유번호
		string Name;        // 숙박업소의 이름
		int Location;        // 숙박업소의 위치
		string Address;        // 숙박업소의 주소
		int Star;            // 숙박업소의 등급
		string Tel;    // 숙박업소의 전화번호1
		string Cell;    // 숙박업소의 전화번호2
		RoomList Roomlist;// 방 리스트
		int Cost;int ss;//서치를 카운팅
		int de=1;
		
		while(de)
        	{
            		getline(cin,condition);//search condition
			int cod;
			cod = atoi(condition.c_str());
		    Lodging l= lodginglist.getFirstLodging();
		    switch(cod)
			{
                		case 0:de=0;break;
		        	case 1:ss=0;
		            	{
					cout<<"호텔명"<<endl;
		            		string Sname;int i1 = 1;
		            		getline(cin,Sname);
		            

		            
		            		Name=l.getName();
					int size1=lodginglist.getSize();
					//searching with condition Name
					    if(Sname==Name)
						{
						    Location=l.getLocation();
						    Address=l.getAddress();
						    Tel=l.getTelephone();
						    Cell=l.getCellphone();
						    Cost=l.getSMoney();Star=l.getStar();
						    Lnumber=l.getLNumber();ss++;

						    cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
						    "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
						    }
		            while(i1<size1)
		            {
		                l=lodginglist.getNextLodging();
		                Name=l.getName();

		                if(Sname==Name)
		                {
					Location=l.getLocation();
				        Address=l.getAddress();
				        Tel=l.getTelephone();
				        Cell=l.getCellphone();Star=l.getStar();
				        Cost=l.getSMoney();
				        Lnumber=l.getLNumber();ss++;

				        cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
				        "주소 :"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
		                }
		                i1++;
		            }
		            if(ss==0){cout<<"No result"<<endl;}
		            string t;
				getline(cin,t);return 3;
				}break;
		           //location 
                case 2:{ss=0;
                    cout<<"지역"<<endl;
                    int sLocation;int i2 = 1;
			string slc;
                    getline(cin,slc);
			sLocation=atoi(slc.c_str());
                    
                    Location=l.getLocation();int size2=lodginglist.getSize();
                    
                    if(sLocation==Location)
			{
		            Name=l.getName();
		            Address=l.getAddress();Star=l.getStar();
		            Tel=l.getTelephone();
		            Cell=l.getCellphone();
		            Cost=l.getSMoney();
		            Lnumber=l.getLNumber();ss++;
		            
		            cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
		            "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
		            }
                    while(i2<size2)
                    {
                        l=lodginglist.getNextLodging();
                        Location=l.getLocation();

                        if(sLocation==Location)
                        {
			Name=l.getName();
                        Address=l.getAddress();
                        Tel=l.getTelephone();Star=l.getStar();
                        Cell=l.getCellphone();
                        Cost=l.getSMoney();
                        Lnumber=l.getLNumber();ss++;

                        cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
                        "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
                        }
                        i2++;
                    }
                    if(ss==0){cout<<"No result"<<endl;}
                    string t;
			getline(cin,t);
			return 3;		
}break;
                //grade Star
                case 3:
                    {ss=0;
			cout<<"등급"<<endl;
                    int Sstar;int i3 = 1;int size3=lodginglist.getSize();string sst;
                    getline(cin,sst);
		Sstar=atoi(sst.c_str());
                    

                    Star=l.getStar();

                    if(Sstar<=Star)
			{
		            Name=l.getName();
		            Location=l.getLocation();
		            Address=l.getAddress();
		            Tel=l.getTelephone();
		            Cell=l.getCellphone();
		            Cost=l.getSMoney();
		            Lnumber=l.getLNumber();ss++;

		            cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
		            "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
                    }
                    while(i3<size3)
                    {
                        l=lodginglist.getNextLodging();
                        Name=l.getName();

                        if(Sstar==Star)
                        {Location=l.getLocation();
                        Address=l.getAddress();Name=l.getName();
                        Tel=l.getTelephone();
                        Cell=l.getCellphone();
                        Cost=l.getSMoney();
                        Lnumber=l.getLNumber();ss++;

                        cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
                        "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
                        }
                        i3++;
                    }
                    if(ss==0){cout<<"No result"<<endl;}
			string t;
			getline(cin,t);
			return 3;                    


}break;
//roomcapacity
case 4:{ss=0;
	int Size;
	int i4;
	i4=1;
	int size4;
	size4=lodginglist.getSize();
                    
	cout<<"room capacity"<<endl;int Capacity;
	int sCapacity;int Price;int Rnumber;string scp;
	getline(cin,scp);
	sCapacity= atoi(scp.c_str());
	//fist lodging
	Lodging L=lodginglist.getFirstLodging();
	RoomList rl; 
	rl= L.getRoomList();	
	Room R;
	R=rl.getFirstRoom();
	Capacity=R.getPersonMax();
	if(sCapacity<=Capacity)
	{
		Name=L.getName();
		Location=L.getLocation();
		Address=L.getAddress();
		Tel=L.getTelephone();
		Cell=l.getCellphone();
		Star=L.getStar();
		Capacity=R.getPersonMax();
		cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<"Tell:"<<Tel<<"\tCell:"<<Cell<<endl<<"등급:"<<Star<<endl<<"최대 인원:"<<Capacity<<endl;
	}
	int rsize=L.getRoomList().getSize();
	int mr0=1;
	while(mr0<rsize)
	{	rl=L.getRoomList();
		R=rl.getNextRoom();
		if(sCapacity<=Capacity)
		{
			Name=L.getName();
			Location=L.getLocation();
			Address=L.getAddress();
			Tel=L.getTelephone();
			Cell=l.getCellphone();
			Star=L.getStar();
			Capacity=R.getPersonMax();ss++;
			cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl					 	<<"Tel:"<<Tel<<"\tCell:"<<Cell<<endl<<"등급:"<<Star<<endl<<"최대 인원:"<<Capacity<<endl;
	
		}
		mr0++;
	}
	while(i4<size4)
	{
		L=lodginglist.getNextLodging();
		RoomList rl=L.getRoomList();		
		R=rl.getFirstRoom();
		Capacity=R.getPersonMax();
		if(sCapacity<=Capacity)
		{
			Name=L.getName();
			Location=L.getLocation();
			Address=L.getAddress();
			Tel=L.getTelephone();
			Cell=l.getCellphone();
			Star=L.getStar();
			Capacity=R.getPersonMax();ss++;
			cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl	<<"Tel:"<<Tel<<"\tCell:"<<Cell<<endl<<"등급:"<<Star<<endl<<"최대 인원:"<<Capacity<<endl;
		}
		while(mr0<rsize)
		{	rl=L.getRoomList();
			R=rl.getNextRoom();
			if(sCapacity<=Capacity)
			{
				Name=L.getName();
				Location=L.getLocation();
				Address=L.getAddress();
				Tel=L.getTelephone();
				Cell=l.getCellphone();
				Star=L.getStar();
				Capacity=R.getPersonMax();ss++;
				cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl					 	<<"Tel:"<<Tel<<"\tCell:"<<Cell<<endl<<"등급:"<<Star<<endl<<"최대 인원:"<<Capacity<<endl;
	
			}
			mr0++;
		}
		i4++;
	}if(ss==0)cout<<"NO result!"<<endl;
	string t;getline(cin,t);return 3;
}
break;

case 5:
       {ss=0;  cout<<"가격"<<endl;
                    string ccc;int i5 = 1;int size5=lodginglist.getSize();int sCost;
                    getline(cin,ccc);
                    

                    Cost=l.getSMoney();

                    if(sCost>=Cost)
			{
		            Name=l.getName();
		            Location=l.getLocation();
		            Address=l.getAddress();
		            Tel=l.getTelephone();
		            Cell=l.getCellphone();
		            Star=l.getStar();
		            Lnumber=l.getLNumber();ss++;

		            cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
		            "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
               	 }
                    while(i5<size5)
                    {
                        l=lodginglist.getNextLodging();
                        Name=l.getName();

                        if(sCost>=Cost)
                        {
				Location=l.getLocation();
                       		Address=l.getAddress();Name=l.getName();
                        	Tel=l.getTelephone();
                        	Cell=l.getCellphone();
                        	Star=l.getStar();
                        	Lnumber=l.getLNumber();ss++;

		                cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역 :"<<Location<<endl<<
		                "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
                        }
                        i5++;
                    }
                    if(ss==0){cout<<"No result"<<endl;}
 string t;getline(cin,t);return 3;
                  } break;
                   
case 6:
                    {ss=0;cout<<"all lodging"<<endl;
                    Lodging l = lodginglist.getFirstLodging();
                    Name=l.getName();
                    Location=l.getLocation();
                    Address=l.getAddress();
                    Tel=l.getTelephone();
                    Cell=l.getCellphone();
                    Cost=l.getSMoney();Star=l.getStar();
                    Lnumber=l.getLNumber();
                    cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
                    "주소:"<<Address<<endl<<"가격:"<<Cost<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
                    int i6 = 1;int size6=lodginglist.getSize();
           
while(i6<size6)
{
Lodging l=lodginglist.getNextLodging();
 
       Name=l.getName();
   Location=l.getLocation();
Address=l.getAddress();
Tel=l.getTelephone();
Cell=l.getCellphone();Star=l.getStar();
Cost=l.getSMoney();
Lnumber=l.getLNumber();
                    cout<<Lnumber<<"."<<endl<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<
                    "주소:"<<Address<<endl<<"가격:"<<Cost<<"Telephone:"<<Tel<<endl<<"Cellphone:"<<Cell<<endl;
i6++;
}string t;getline(cin,t);return 3;}break;
case 7:
{	
	ss=0;
	string Locationq,capacityq,costq;
	string smName;
	int Capacity;
	int smLocation,smCost,smCapacity;
	cout<<"condition"<<endl<<"검색할 호텔명:";getline(cin,smName);cout<<"검색할 지역:";getline(cin,Locationq);
	cout<<"상한 가격:";getline(cin,costq);cout<<"수용 인원:";getline(cin,capacityq);
	if(Locationq=="")
	smLocation=0;
	else
	smLocation=atoi(Locationq.c_str());
	if(costq=="")
	smCost=0;
	else
	smCost=atoi(costq.c_str());
	if(capacityq=="")
	smCapacity=0;
	else
	smCapacity=atoi(capacityq.c_str());
	cout<<"검색결과=============================="<<endl;
	

	
	


	Lodging L=lodginglist.getFirstLodging();
	int lsize=lodginglist.getSize();
	int li=1;
	Name=L.getName();Location=L.getLocation();Cost=L.getSMoney();
	RoomList rl; 
	rl= L.getRoomList();	
	Room R;
	R=rl.getFirstRoom();
	Capacity=R.getPersonMax();
	if(smName.empty() || smName==Name)
	{
		if(smLocation==0 || smLocation==Location)
		{
			if(smCost==0|| smCost>=Cost)
			{
				if(smCapacity==0 || smCapacity<=Capacity)
				{
					Tel=L.getTelephone();
					Cell=L.getCellphone();
					Address=L.getAddress();ss++;
					cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<"주소:"<<Address<<endl<<"가격:"<<Cost<<endl
					<<"최대 인원:"<<Capacity<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone"<<Cell<<endl;
				}
			}
		}
	}
	int rsize=L.getRoomList().getSize();
	int ri=1;
	while(ri<rsize)
	{	rl=L.getRoomList();
		R=rl.getNextRoom();
		
		if(smName=="" || smName==Name)
		{
			if(smLocation==0 || smLocation==Location)
			{
				if(smCost==0 || smCost>=Cost)
				{
					if(smCapacity==0 || smCapacity<=Capacity)
					{
						Tel=L.getTelephone();
						Cell=L.getCellphone();
						Address=L.getAddress();ss++;
						cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<"주소:"<<Address<<endl<<"가격:"<<Cost<<endl
						<<"최대 인원:"<<Capacity<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone"<<Cell<<endl;
					}
				}
			}
		}
		ri++;;
	}

	while(li<lsize)
	{
		L=lodginglist.getNextLodging();
		RoomList rl=L.getRoomList();		
		R=rl.getFirstRoom();
		Capacity=R.getPersonMax();
		if(smName=="" || smName==Name)
		{
			if(smLocation==0 || smLocation==Location)
			{
				if(smCost==0 || smCost>=Cost)
				{
					if(smCapacity==0 || smCapacity<=Capacity)
					{
						Tel=L.getTelephone();
						Cell=L.getCellphone();
						Address=L.getAddress();ss++;
						cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<"주소:"<<Address<<endl<<"가격:"<<Cost<<endl
						<<"최대 인원:"<<Capacity<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone"<<Cell<<endl;
					}
				}
			}
		}
		while(ri<rsize)
		{	
			rl=L.getRoomList();
			R=rl.getNextRoom();
			if(smName=="" || smName==Name)
			{
				if(smLocation==0 || smLocation==Location)
				{
					if(smCost==0 || smCost>=Cost)
					{
						if(smCapacity==0 || smCapacity<=Capacity)
						{
							Tel=L.getTelephone();
							Cell=L.getCellphone();
							Address=L.getAddress();ss++;
							cout<<"호텔:"<<Name<<endl<<"지역:"<<Location<<endl<<"주소:"<<Address<<endl<<"가격:"<<Cost<<endl
							<<"최대 인원:"<<Capacity<<endl<<"Telephone:"<<Tel<<endl<<"Cellphone"<<Cell<<endl;
						}
					}
				}
			}
			ri++;
		}
		li++;
	}
	if(ss==0)cout<<"NO result!"<<endl;
	string t;getline(cin,t);
	return 3;	
	
}break;
case 8:
	searchRoom2(lodginglist, member);
	break;
default:{}
	break;
}
          } 
		return 3;
	}
Esempio n. 10
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;
	}
Esempio n. 11
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);
		}

		}

	}
Esempio n. 12
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');
	
	}