Exemplo n.º 1
0
 public String AddEmployeesToHotel(UserTypes.Employee emp)
 {
     if (hotelInstance == null)
     {
         return("hotel instance not initiated");
     }
     else
     {
         return(runQuery(constructQuery(emp)));
     }
 }
        private void Button_Add_HotelEmp_Click(object sender, EventArgs e)
        {
            UserTypes.Employee Emp = new UserTypes.Employee();
            Emp.Addr          = Hotel_Staff_Address.Text;
            Emp.Date_Of_Birth = Hotel_Staff_DOB.Text;
            Emp.Email         = Hotel_Staff_EmailAddresss.Text;
            Emp.First_Name    = Hotel_Staff_First_Name.Text;
            Emp.Last_name     = Hotel_Staff_LastName.Text;
            Emp.Hotel_ID      = Int32.Parse(Hotel_id.Text);
            Emp.Staff_Id      = Int32.Parse(Hotel_Staff_ID.Text);
            Emp.Phone_Num     = Int32.Parse(Hotel_Staff_PhoneNum.Text);
            AdminHotelListManipulationClass HMInstance = new AdminHotelListManipulationClass();
            string log = HMInstance.AddEmployeesToHotel(Emp);

            MessageBox.Show(log);
        }
Exemplo n.º 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("");
        }