예제 #1
0
        public void update(customer cust, String type)
        {
            customer custme = hrs.customers.Where(x => (x.cust_id == cust.cust_id)).FirstOrDefault();
            booking  bkg    = hrs.bookings.Where(x => (x.Booking_id == cust.booking.Booking_id)).FirstOrDefault();

            ;
            if (type == custme.booking.room.room_type)
            {
                hrs.Entry(custme).CurrentValues.SetValues(cust);
                hrs.Entry(bkg).CurrentValues.SetValues(cust.booking);
                hrs.SaveChanges();
            }
            else
            {
                room roo = hrs.rooms.Where(y => (y.room_ == cust.booking.Room_)).FirstOrDefault(); // for changing room ststus

                room rm = hrs.rooms.Where(y => (y.room_type == type && y.status == "unreserved")).FirstOrDefault();
                cust.booking.Room_       = rm.room_;
                rm.status                = "reserved";
                cust.booking.room.status = rm.status;
                hrs.Entry(custme).CurrentValues.SetValues(cust);

                hrs.Entry(bkg).CurrentValues.SetValues(cust.booking);

                roo.status = "unreserved";
                hrs.SaveChanges();
            }
        }
예제 #2
0
        public void addbooking(booking bk, customer cus, String rm_type)

        {
            customer cust = hrs.customers.Where(x => (x.fname == cus.fname && x.lastname == cus.lastname && x.cell_no == cus.cell_no && x.cnic == cus.cnic)).FirstOrDefault();

            bk.cust_id = cust.cust_id;
            room roo = hrs.rooms.Where(x => (x.room_type == rm_type && x.status == "unreserved")).FirstOrDefault();


            bk.Room_ = roo.room_;
            hrs.bookings.Add(bk);
            hrs.SaveChanges();
            roo.status = "reserved";
            hrs.SaveChanges();
            booking bok  = hrs.bookings.Where(x => (x.cust_id == cust.cust_id)).FirstOrDefault();
            int     cbok = bok.Booking_id;

            cust.booking_id = cbok;
            hrs.SaveChanges();
        }
예제 #3
0
 public List <room> checkavaiblty(room rm)
 {
     return(hrsda.checkavaiblty(rm));
 }
예제 #4
0
 public void addroom(room rm)
 {
     hrs.rooms.Add(rm);
     hrs.SaveChanges();
 }
예제 #5
0
 public List <room> checkavaiblty(room rm)
 {
     return(hrs.rooms.Where(x => (x.room_type == rm.room_type && x.status == rm.status)).ToList());
 }