Пример #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 addpayment(customer cus, booking bk, payment pay)
        {
            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();

            pay.cust_id    = cust.cust_id;
            pay.Booking_id = cust.booking.Booking_id;
            hrs.payments.Add(pay);
            hrs.SaveChanges();
        }
Пример #3
0
        public void paid(record rcd)
        {
            hrs.records.Add(rcd);

            hrs.SaveChanges();
            customer custm = hrs.customers.Where(x => (x.cnic == rcd.CNIC_)).FirstOrDefault();
            payment  pay   = hrs.payments.Where(x => (x.cust_id == custm.cust_id)).FirstOrDefault();
            booking  bk    = hrs.bookings.Where(x => (x.Booking_id == pay.Booking_id)).FirstOrDefault();

            bk.room.status = "unreserved";
            hrs.SaveChanges();
            hrs.bookings.Remove(bk);
            hrs.payments.Remove(pay);
            hrs.customers.Remove(custm);
            hrs.SaveChanges();
        }
Пример #4
0
        public void deletebooking(customer cust)

        {
            customer custme = hrs.customers.Where(x => (x.cust_id == cust.cust_id)).FirstOrDefault();
            booking  bok    = hrs.bookings.Where(x => (x.Booking_id == cust.booking_id)).FirstOrDefault();

            System.Console.WriteLine(bok.booking_date);
            System.Console.WriteLine(bok.Booking_id);
            System.Console.WriteLine(bok.cust_id);
            System.Console.WriteLine(bok.Room_);
            System.Console.WriteLine(bok.leave_date);
            payment py = hrs.payments.Where(x => (x.cust_id == cust.cust_id)).FirstOrDefault();

            hrs.customers.Remove(custme);
            hrs.SaveChanges();
            hrs.bookings.Remove(bok);
            hrs.payments.Remove(py);
            hrs.SaveChanges();
        }
Пример #5
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();
        }
Пример #6
0
 public void addbooking(booking bk, customer cus, String type)
 {
     hrsda.addbooking(bk, cus, type);
 }
Пример #7
0
 public void addpayment(customer cus, booking bk, payment pay)
 {
     hrsda.addpayment(cus, bk, pay);
 }