Exemple #1
0
 public static bool CheckUser(string User, string Password)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var UserInfo = (from c in context.Logins where c.user == User select c).SingleOrDefault();
         try
         {
             if (UserInfo.password == Password)
             {
                 AccountAccess = UserInfo.access;
                 AccountID     = UserInfo.ID;
                 AccountName   = UserInfo.user;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         catch (Exception)
         {
             return(false);
         }
     }
 }
 public AddRoomWindow(HotelDatabaseEntities context, int hotelId)
 {
     InitializeComponent();
     roomViewSource = (CollectionViewSource)FindResource("roomViewSource");
     this.context   = context;
     this.hotelId   = hotelId;
 }
 public AddHotelWindow(HotelDatabaseEntities context)
 {
     InitializeComponent();
     hotelSource   = (CollectionViewSource)FindResource("hotelViewSource");
     addressSource = (CollectionViewSource)FindResource("addressViewSource");
     this.context  = context;
 }
 private void PopulateTextBoxes()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Booking = (from c in context.Bookings where c.ID == Data.Database.UserID select c).FirstOrDefault();
         dtp_From.Value        = Booking.Booking_From;
         dtp_To.Value          = Booking.Booking_To;
         cbx_CheckedIn.Checked = Booking.Checked_In;
     }
 }
Exemple #5
0
 public static void ChangePasword(string Password)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var NewLogin = (from c in context.Logins where c.ID == AccountID select c).FirstOrDefault();
         NewLogin.password = Password;
         context.SaveChanges();
         ClearValues();
     }
 }
Exemple #6
0
 public static void UpdateAccess(int ID, int Access)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var NewLogin = (from c in context.Logins where c.ID == ID select c).FirstOrDefault();
         NewLogin.access = Access;
         context.SaveChanges();
         ClearValues();
     }
 }
Exemple #7
0
 private void PopulateTextBoxes()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Guest = (from c in context.Guest_Info where c.ID == Data.Database.UserID select c).FirstOrDefault();
         txt_Name.Text       = Guest.Name;
         txt_Address.Text    = Guest.Address;
         txt_Mobile.Text     = Guest.Mobile;
         txt_Home_Phone.Text = Guest.Home_Phone;
     }
 }
Exemple #8
0
 private void PopulateTextBoxes()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Room = (from c in context.Rooms where c.ID == Data.Database.RoomID select c).FirstOrDefault();
         txt_Name.Text       = Room.Room_Name;
         nud_single.Value    = Room.Single_Beds;
         nud_double.Value    = Room.Double_Beds;
         txt_Extra_Info.Text = Room.Extra_Info;
     }
 }
Exemple #9
0
 private void PopulateTextBoxes()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Charges = (from c in context.Room_Prices select c).FirstOrDefault();
         nud_Single_Charge.Value = Charges.Single_Price;
         nud_Double_Charge.Value = Charges.Double_Price;
         nud_E_Single.Value      = Charges.Extra_Single_Price;
         nud_E_Double.Value      = Charges.Extra_Double_Price;
     }
 }
Exemple #10
0
 public static void UpdateBooking(DateTime BookingFrom, DateTime BookingTo, bool CheckedIn)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var booking = (from c in context.Bookings where c.ID == UserID select c).FirstOrDefault();
         booking.Booking_From = BookingFrom;
         booking.Booking_To   = BookingTo;
         booking.Checked_In   = CheckedIn;
         context.SaveChanges();
         ClearValues();
     }
 }
Exemple #11
0
 public static void DeleteAccount(int ID)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Account = (from c in context.Logins where c.ID == ID select c).SingleOrDefault();
         {
             context.Logins.Remove(Account);
             context.SaveChanges();
             ClearValues();
         }
     }
 }
Exemple #12
0
 public static void UpdateRoom(string RoomName, int SingleBeds, int DoubleBeds, string ExtraInfo)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Room = (from c in context.Rooms where c.ID == RoomID select c).FirstOrDefault();
         Room.Room_Name   = RoomName;
         Room.Single_Beds = SingleBeds;
         Room.Double_Beds = DoubleBeds;
         Room.Extra_Info  = ExtraInfo;
         context.SaveChanges();
         ClearValues();
     }
 }
 private void PopulateTextBoxes()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Charges = (from c in context.Charges where c.ID == Data.Database.Room_Charge select c).FirstOrDefault();
         nud_Bar.Value            = Charges.Bar_Charge;
         nud_Internet.Value       = Charges.Internet_Charge;
         nud_Phone.Value          = Charges.Phone_Charge;
         nud_Room.Value           = Charges.Room_Charge;
         nud_Additional.Value     = Charges.Additional_Charges;
         txt_Additional_Info.Text = Charges.Additional_Charges_Info;
     }
 }
Exemple #14
0
 public static void CreateAccount(string Name, string Password, int Access)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var New_Account = new Login();
         New_Account.user     = Name;
         New_Account.password = Password;
         New_Account.access   = Access;
         context.Logins.Add(New_Account);
         context.SaveChanges();
         ClearValues();
     }
 }
Exemple #15
0
 public static void UpdateRoomPricing(int Single, int Double, int ESingle, int EDouble)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Room_Prices = (from c in context.Room_Prices select c).FirstOrDefault();
         Room_Prices.Single_Price       = Single;
         Room_Prices.Double_Price       = Double;
         Room_Prices.Extra_Single_Price = ESingle;
         Room_Prices.Extra_Double_Price = EDouble;
         context.SaveChanges();
         ClearValues();
     }
 }
Exemple #16
0
 public static void UpdateGuest(string Name, string Address, string Mobile, string Home_Phone)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Guest = (from c in context.Guest_Info where c.ID == UserID select c).FirstOrDefault();
         Guest.Name       = Name;
         Guest.Address    = Address;
         Guest.Mobile     = Mobile;
         Guest.Home_Phone = Home_Phone;
         context.SaveChanges();
         ClearValues();
     }
 }
 private void DGV()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Logins = from c in context.Logins
                      select new
         {
             c.ID,
             c.user,
             c.access
         };
         dgv_ChooseGuest.DataSource = Logins.ToList();
     }
 }
Exemple #18
0
 public static void AddRoom(string Name, int Singles, int Doubles, string ExtraInfo)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var New_Room = new Room();
         New_Room.Room_Name   = Name;
         New_Room.Single_Beds = Singles;
         New_Room.Double_Beds = Doubles;
         New_Room.Extra_Info  = ExtraInfo;
         context.Rooms.Add(New_Room);
         context.SaveChanges();
         ClearValues();
     }
 }
Exemple #19
0
 public static void CreatGuest(string Name, string Address, string Mobile, string Home_Phone)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var New_Guest = new Guest_Info();
         New_Guest.Name       = Name;
         New_Guest.Address    = Address;
         New_Guest.Mobile     = Mobile;
         New_Guest.Home_Phone = Home_Phone;
         context.Guest_Info.Add(New_Guest);
         context.SaveChanges();
         ClearValues();
     }
 }
 public List <VacationRequest> GetAllVacationRequests()
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             return((from r in context.VacationRequests select r).ToList());;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return(null);
     }
 }
 private void DGV()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Guest_Info = from c in context.Guest_Info
                          select new
         {
             c.ID,
             c.Name,
             c.Mobile,
             c.Home_Phone
         };
         dgv_ChooseGuest.DataSource = Guest_Info.ToList();
     }
 }
Exemple #22
0
 public void AddEmployee(Employee e)
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             context.Employees.Add(e);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 public VacationRequest GetVacationRequest(int ID)
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             return((from r in context.VacationRequests where r.RequestID == ID select r).FirstOrDefault());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return(null);
     }
 }
 public void AddVacationRequest(VacationRequest vr)
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             context.VacationRequests.Add(vr);
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 public void DeleteVacationRequest(int ID)
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             context.VacationRequests.Remove((from r in context.VacationRequests where r.RequestID == ID select r).FirstOrDefault());
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemple #26
0
 public Employee GetEmployee(int ID)
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             Employee employee = (from e in context.Employees where e.EmployeeID == ID select e).FirstOrDefault();
             return(employee);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return(null);
     }
 }
Exemple #27
0
 public void UpdateEmployee(Employee emp)
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             Employee employee = (from e in context.Employees where e.EmployeeID == emp.EmployeeID select e).FirstOrDefault();
             employee = emp;
             context.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemple #28
0
 public static void UpdateCharges(int Bar, int Internet, int Phone, int Room, int Additional, string Info)
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Charges = (from c in context.Charges where c.ID == Room_Charge select c).FirstOrDefault();
         Charges.Bar_Charge              = Bar;
         Charges.Internet_Charge         = Internet;
         Charges.Phone_Charge            = Phone;
         Charges.Room_Charge             = Room;
         Charges.Additional_Charges      = Additional;
         Charges.Additional_Charges_Info = Info;
         Charges.Total = Bar + Internet + Phone + Room + Additional; // Work out the total cost so that we can charge them at the end of their stay
         context.SaveChanges();
         ClearValues();
     }
 }
 private void DGV()
 {
     using (var context = new HotelDatabaseEntities())
     {
         var Rooms = from c in context.Rooms
                     select new
         {
             c.ID,
             c.Room_Name,
             c.Single_Beds,
             c.Double_Beds,
             c.Extra_Info
         };
         dgv_ChooseRoom.DataSource = Rooms.ToList();
     }
 }
Exemple #30
0
 public List <Employee> GetAllManagers()
 {
     try
     {
         using (HotelDatabaseEntities context = new HotelDatabaseEntities())
         {
             List <Employee> employees = new List <Employee>();
             employees = (from e in context.Employees where e.ProfesionalQualifications != null select e).ToList();
             return(employees);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Exception " + ex.Message.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         return(null);
     }
 }