Example #1
0
        /// <summary>
        /// Возвращает смещение по времени от даты заезда срабатывания условия правила отмены
        /// </summary>
        /// <param name="referencePointKind">Тип смещения</param>
        /// <param name="referencePointTime">Время смещения</param>
        /// <param name="provider">Провайдер</param>
        /// <returns>смещение по времени от даты заезда срабатывания условия правила отмены</returns>
        public static TimeSpan GetCancellationDeadlineOffsetOfArrivalTime(CancellationReferencePointKind referencePointKind, Time referencePointTime, Provider provider)
        {
            Time arrivalTime   = provider.ArrivalTime;
            Time departureTime = provider.DepartureTime;

            switch (referencePointKind)
            {
            case CancellationReferencePointKind.ProviderDepartureTime:
                return(new TimeSpan(0, departureTime.Hours - arrivalTime.Hours, departureTime.Minutes - arrivalTime.Minutes, 0));

            case CancellationReferencePointKind.CustomArrivalTime:
                return(new TimeSpan(0, referencePointTime.Hours - arrivalTime.Hours, referencePointTime.Minutes - arrivalTime.Minutes, 0));
            }
            return(new TimeSpan());
        }
Example #2
0
        static Time GetReferencePointTimeForBookingCancellationRule(
            CancellationReferencePointKind referencePointKind,
            Time bookingCancellationRuleReferencePointTime,
            Time guestArrivalTime,
            Time bookingCreationTimeLocalForProvider)
        {
            switch (referencePointKind)
            {
            case CancellationReferencePointKind.ProviderArrivalTime:
            case CancellationReferencePointKind.ProviderDepartureTime:
            case CancellationReferencePointKind.CustomArrivalTime:
                return(bookingCancellationRuleReferencePointTime);

            case CancellationReferencePointKind.GuestArrivalTime:
                return(guestArrivalTime);

            case CancellationReferencePointKind.BookingCreationTime:
                return(bookingCreationTimeLocalForProvider);
            }

            throw new ArgumentOutOfRangeException("referencePointKind", "Invalid ReferencePointKind value");
        }