예제 #1
0
 public String AddRoomsToHotel(TableTypes.Room room)
 {
     if (hotelInstance == null)
     {
         return("hotel instance not initiated");
     }
     else
     {
         return(runQuery(constructQuery(room)));
     }
 }
        private void Button_Add_Room_Click(object sender, EventArgs e)
        {
            TableTypes.Room room = new TableTypes.Room();
            room.Hotel_ID         = Int32.Parse(Hotel_id.Text);
            room.Room_Id          = Int32.Parse(Hotel_Room_ID.Text);
            room.Room_Type        = Hotel_Room_Type.Text;
            room.Room_Description = Hotel_Description.Text;
            AdminHotelListManipulationClass HMInstance = new AdminHotelListManipulationClass();
            string log = HMInstance.AddRoomsToHotel(room);

            MessageBox.Show(log);
        }
예제 #3
0
        private string constructQuery(object queryObject)
        {
            if (queryObject is TableTypes.Hotel)
            {
                TableTypes.Hotel hotel = (TableTypes.Hotel)queryObject;
                return("insert into Hotel(Hotel_Id, HotelName, Addrs, City, Phone_no)" +
                       "values('" + hotelInstance.Hotel_Id + "', '" + hotelInstance.Name + "', '"
                       + hotelInstance.Addr + "', '" + hotelInstance.Addr + "'," + hotelInstance.Phone_Num + ");");
            }

            if (queryObject is UserTypes.Employee)
            {
                UserTypes.Employee employee = (UserTypes.Employee)queryObject;
                return("insert into Employee( Staff_Id,First_name , Last_name , DOB , Addrs , Phone_no , Email , Pass , Hotel_Id )" +
                       "values('" + employee.Staff_Id + "','" + employee.First_Name + "', '" + employee.Last_name + "', '" + employee.Date_Of_Birth + "', '" + employee.Addr + "', '" + employee.Phone_Num + "', '" + employee.Email + "', '" + employee.Pass + "'," + hotelInstance.Hotel_Id + ")");
            }
            if (queryObject is TableTypes.Room)
            {
                TableTypes.Room room = (TableTypes.Room)queryObject;
                return("insert into Room (Room_Id  ,Hotel_ID ,Room_Type ,Room_Description)"
                       + "values(" + room.Room_Id + "," + hotelInstance.Hotel_Id + ", '" + room.Room_Type + "', '" + room.Room_Description + "')");
            }
            return("");
        }