コード例 #1
0
        public RevenueApprovalStatus?BacktrackWorkflowAll(DateTime month, string propertyCode, RevenueApprovalStatus state)
        {
            try
            {
                var reservationProvider = new ReservationProvider(_context);

                DateTime startDate    = new DateTime(month.Year, month.Month, 1);
                DateTime endDate      = new DateTime(month.Year, month.Month, DateTime.DaysInMonth(month.Year, month.Month));
                var      reservations = reservationProvider.Retrieve(startDate, endDate, propertyCode);
                var      prevState    = PrevState(state);
                if (reservations != null && prevState != null)
                {
                    foreach (var reservation in reservations)
                    {
                        if (reservation.ApprovalStatus >= prevState)
                        {
                            reservation.ApprovalStatus = prevState.Value;
                            RetrackWorkflowSignature(reservation, state);
                            reservationProvider.Update(reservation.ReservationId, reservation);
                        }
                    }
                    reservationProvider.Commit();
                    return(prevState);
                }
            }
            catch
            {
                throw;
            }
            return(null);
        }
コード例 #2
0
 public RevenueApprovalStatus?BacktrackWorkflow(int reservationId, RevenueApprovalStatus state)
 {
     try
     {
         var reservationProvider = new ReservationProvider(_context);
         var reservation         = reservationProvider.Retrieve(reservationId);
         var prevState           = PrevState(state);
         if (reservation != null && prevState != null)
         {
             reservation.ApprovalStatus = prevState.Value;
             RetrackWorkflowSignature(reservation, state);
             reservationProvider.Update(reservationId, reservation);
             reservationProvider.Commit();
             return(prevState);
         }
     }
     catch
     {
         throw;
     }
     return(null);
 }
コード例 #3
0
 public RevenueApprovalStatus?MoveWorkflow(int reservationId, RevenueApprovalStatus state)
 {
     try
     {
         var reservationProvider = new ReservationProvider(_context);
         var reservation         = reservationProvider.Retrieve(reservationId);
         var nextState           = NextState(state);
         if (reservation != null && nextState != null)
         {
             reservation.ApprovalStatus = state;
             SetWorkflowSignature(reservation, state);
             reservationProvider.Update(reservationId, reservation);
             reservationProvider.Commit();
             return(nextState);
         }
     }
     catch
     {
         throw;
     }
     return(null);
 }
コード例 #4
0
        public bool SetFieldStatus(int reservationId, string fieldname, double taxrate, bool included)
        {
            try
            {
                var reservationProvider = new ReservationProvider(_context);
                var reservation         = reservationProvider.Retrieve(reservationId);
                if (reservation != null)
                {
                    if (fieldname == "IncludeOnStatement")
                    {
                        reservation.IncludeOnStatement = included;
                    }
                    else if (fieldname == "IsTaxed")
                    {
                        reservation.TaxRate = (float)taxrate;
                        reservation.IsTaxed = included;
                        UpdateTotalRevenue(reservation);
                    }
                    else if (fieldname == "IsFutureBooking")
                    {
                        reservation.IsFutureBooking = included;
                    }
                    else // not supported field; just ignore for now...
                    {
                        return(true);
                    }

                    reservationProvider.Update(reservation.ReservationId, reservation);
                    reservationProvider.Commit();
                    return(true);
                }
            }
            catch
            {
                throw;
            }
            return(false);
        }