Exemplo n.º 1
0
        private void CreateReservation_Click(object sender, RoutedEventArgs e)
        {
            bookings b = new bookings();

            if (customer_ID != 0 && room_ID != 0)
            {
                if (date_from < date_to)
                {
                    b.customerID = customer_ID;
                    b.roomID     = room_ID;
                    b.dateFrom   = date_from;
                    b.dateTo     = date_to;
                    addBooking(b);
                    MessageBox.Show("Booking of room: " + b.roomID + "is done");
                }
                else
                {
                    MessageBox.Show("Dates are invalid");
                }
            }
            else
            {
                MessageBox.Show("One or more of the values are invalid");
            }
        }
Exemplo n.º 2
0
 private void addBooking(bookings b)
 {
     using (var db = new HotelDBEntities())
     {
         db.bookings.Add(b);
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 private static void deleteBooking(bookings o)
 {
     using (var db = new HotelDBEntities())
     {
         db.Entry(o).State = System.Data.Entity.EntityState.Deleted;
         MessageBox.Show(("Deleted booking reservation on : " + ((bookings)o).roomID.ToString()));
         db.SaveChanges();
     }
 }