private void makePayment(Payment payment)
 {
     using (HotelDBEntities hotelDBEntities = new HotelDBEntities())
     {
         hotelDBEntities.Payments.AddObject(payment);
         hotelDBEntities.SaveChanges();
     }
 }
        public void makeGroupReservation(String inputFile)
        {
            List <RoomReservation> reservtaions = parseDocument(inputFile);

            using (HotelDBEntities hotelDBEntities = new HotelDBEntities())
            {
                foreach (RoomReservation reservation in reservtaions)
                {
                    hotelDBEntities.RoomReservations.AddObject(reservation);
                }
                hotelDBEntities.SaveChanges();
            }
        }
Exemplo n.º 3
0
        private static Room createRoom()
        {
            Room room = Room.CreateRoom(0, "1002");
            room.RoomType = RoomType.CreateRoomType(0, "2", 600, "Executive");

            using (HotelDBEntities hotelDBEntities = new HotelDBEntities())
            {

                hotelDBEntities.Rooms.AddObject(room);
                hotelDBEntities.SaveChanges();

            }

            return room;
        }
        public String makeReservation(String roomNo, String guestName, String passport, DateTime startDate, DateTime endDate, int numOfGuest, Payment payment)
        {
            RoomReservation reservtaion = RoomReservation.CreateRoomReservation(0, startDate, endDate, numOfGuest);


            using (HotelDBEntities hotelDBEntities = new HotelDBEntities())
            {
                reservtaion.Room = hotelDBEntities.Rooms.FirstOrDefault(room => room.RoomNo == roomNo);
                var theGuest = hotelDBEntities.Guests.FirstOrDefault(guest => guest.Name == guestName && guest.PassportNo == passport);
                if (theGuest == null)
                {
                    theGuest = Guest.CreateGuest(0, guestName, passport);
                }
                reservtaion.Guest   = theGuest;
                reservtaion.Payment = payment;
                hotelDBEntities.RoomReservations.AddObject(reservtaion);
                hotelDBEntities.SaveChanges();
            }

            return("success");
        }
Exemplo n.º 5
0
        private void createRoomType()
        {
            RoomType roomType = RoomType.CreateRoomType(0, "2", 300, "Deluxe");

            using (HotelDBEntities hotelDBEntities = new HotelDBEntities())
            {

                hotelDBEntities.RoomTypes.AddObject(roomType);
                hotelDBEntities.SaveChanges();

            }
        }
Exemplo n.º 6
0
        private void createReservation()
        {
            RoomReservation reservation = RoomReservation.CreateRoomReservation(0, DateTime.Today, DateTime.Today + new TimeSpan(3, 0, 0, 0), 2);
            reservation.Guest = createGuest();
            reservation.Room = createRoom();

            using (HotelDBEntities hotelDBEntities = new HotelDBEntities())
            {

                hotelDBEntities.RoomReservations.AddObject(reservation);
                hotelDBEntities.SaveChanges();

            }
        }