Пример #1
0
        public static async Task <HouseKeeping> ConfirmCleaned(HouseKeeping houseKeepingInDatabase)
        {
            await Database.WriteAsync(realm =>
            {
                houseKeepingInDatabase.Status = (int)HouseKeeping.StatusEnum.Cleaned;
            });

            return(houseKeepingInDatabase);
        }
Пример #2
0
        public static async Task <HouseKeeping> Add(HouseKeeping houseKeeping)
        {
            await Database.WriteAsync(realm =>
            {
                houseKeeping.Id = NextId;
                houseKeeping    = realm.Add(houseKeeping);
            });

            return(houseKeeping);
        }
Пример #3
0
        public static async Task <HouseKeeping> AssignCleaningService(Employee employee,
                                                                      HouseKeeping houseKeepingInDatabase)
        {
            await Database.WriteAsync(realm =>
            {
                houseKeepingInDatabase.Employee = employee;
                houseKeepingInDatabase.Status   = (int)HouseKeeping.StatusEnum.Cleaning;
            });

            return(houseKeepingInDatabase);
        }
Пример #4
0
        public static async Task <Booking> RequestCheckOut(Employee employee, Booking bookingInDatabase,
                                                           HouseKeeping houseKeeping)
        {
            await Database.WriteAsync(realm =>
            {
                bookingInDatabase.EmployeeCheckOut = employee;
                bookingInDatabase.Status           = (int)Booking.StatusEnum.RequestedCheckOut;

                HouseKeepingDataAccess.Add(realm, houseKeeping);
            });

            return(bookingInDatabase);
        }
Пример #5
0
        public static async Task <Booking> CheckIn(Employee employee, Booking bookingInDatabase,
                                                   HouseKeeping houseKeeping)
        {
            await Database.WriteAsync(realm =>
            {
                bookingInDatabase.EmployeeCheckIn = employee;
                bookingInDatabase.RealCheckInTime = DateTimeOffset.Now;
                bookingInDatabase.Status          = (int)Booking.StatusEnum.CheckedIn;

                HouseKeepingDataAccess.Add(realm, houseKeeping);
            });

            return(bookingInDatabase);
        }
Пример #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please understand the Type Forwarding Concept");
            Clerk        objClerk        = new Clerk();
            Manager      objManager      = new Manager();
            HouseKeeping objHouseKeeping = new HouseKeeping();


            objClerk.DisplayClerk();
            objManager.Display();
            objHouseKeeping.DisplayHouseKeeping();
            Employee.Display();
            Console.ReadLine();
        }
Пример #7
0
        public static async Task <HouseKeeping> ConfirmCleanedAndServices(
            HouseKeeping houseKeepingInDatabase, List <ServicesDetail> servicesDetails)
        {
            await Database.WriteAsync(realm =>
            {
                foreach (var servicesDetail in servicesDetails)
                {
                    servicesDetail.Booking = houseKeepingInDatabase.Booking;
                    ServicesDetailDataAccess.Add(realm, servicesDetail);
                }

                houseKeepingInDatabase.Status = (int)HouseKeeping.StatusEnum.Cleaned;
            });

            return(houseKeepingInDatabase);
        }
Пример #8
0
        public static Booking BookAndCheckIn(Realm realm, Booking booking)
        {
            booking.Id              = NextId;
            booking.CreateTime      = DateTimeOffset.Now;
            booking.BookCheckInTime = DateTimeOffset.Now;
            booking.RealCheckInTime = DateTimeOffset.Now;
            booking.Status          = (int)Booking.StatusEnum.CheckedIn;

            booking = realm.Add(booking);

            var houseKeeping = new HouseKeeping();

            houseKeeping.Type    = (int)HouseKeeping.TypeEnum.ExpectedArrival;
            houseKeeping.Status  = (int)HouseKeeping.StatusEnum.Pending;
            houseKeeping.Booking = booking;

            HouseKeepingDataAccess.Add(realm, houseKeeping);

            return(booking);
        }
Пример #9
0
        public static Task <Booking> RequestCheckOut(Employee employee, int bookingId)
        {
            var bookingInDatabase = Get(bookingId);

            if (bookingInDatabase == null)
            {
                throw new Exception("Mã Booking không tồn tại");
            }
            if (bookingInDatabase.Status != (int)Booking.StatusEnum.CheckedIn)
            {
                throw new Exception("Không thể yêu cầu trả phòng");
            }

            var houseKeeping = new HouseKeeping();

            houseKeeping.Type    = (int)HouseKeeping.TypeEnum.ExpectedDeparture;
            houseKeeping.Status  = (int)HouseKeeping.StatusEnum.Pending;
            houseKeeping.Booking = bookingInDatabase;

            return(BookingDataAccess.RequestCheckOut(employee, bookingInDatabase, houseKeeping));
        }
Пример #10
0
        public static Task <Booking> CheckIn(Employee employee, int bookingId)
        {
            var bookingInDatabase = Get(bookingId);

            if (bookingInDatabase == null)
            {
                throw new Exception("Mã Booking không tồn tại");
            }
            if (bookingInDatabase.Status != (int)Booking.StatusEnum.Booked)
            {
                throw new Exception("Phòng đã được check-in, không thể check-in lại");
            }

            var houseKeeping = new HouseKeeping();

            houseKeeping.Type    = (int)HouseKeeping.TypeEnum.ExpectedArrival;
            houseKeeping.Status  = (int)HouseKeeping.StatusEnum.Pending;
            houseKeeping.Booking = bookingInDatabase;

            return(BookingDataAccess.CheckIn(employee, bookingInDatabase, houseKeeping));
        }
Пример #11
0
 public static HouseKeeping Add(Realm realm, HouseKeeping houseKeeping)
 {
     houseKeeping.Id = NextId;
     return(realm.Add(houseKeeping));
 }