public string addHotel(TableTypes.Hotel hotel) { string log = ""; //add Hotel to Hotel table AdminHotelListManipulationClass.hotelInstance = hotel; log += AddHotelToSqlTables(hotel); return(log); }
private void Button_Add_Hotel_Click(object sender, EventArgs e) { TableTypes.Hotel hotel = new TableTypes.Hotel(); hotel.Addr = Hotel_Address.Text; hotel.City = Hotel_City.Text; hotel.Hotel_Id = Int32.Parse(Hotel_id.Text); hotel.Phone_Num = Int32.Parse(Hotel_Phone_Num.Text); hotel.Name = Hotel_Name.Text; AdminHotelListManipulationClass HMInstance = new AdminHotelListManipulationClass(); string log = HMInstance.addHotel(hotel); MessageBox.Show(log); }
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(""); }