public DateTime?GetExpirationDate(LicensingModelType licensingModelType)
        {
            DateTime?result;

            switch (licensingModelType)
            {
            case LicensingModelType.TwoDays:
                result = DateTime.UtcNow.AddDays(2);
                break;

            case LicensingModelType.LifeLong:
                result = null;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }
Exemple #2
0
        private decimal CalculatePrice(AthleteStatusType athleteStatusType, DateTime?statusExpirationDate, LicensingModelType licensingModelType)
        {
            decimal price;

            switch (licensingModelType)
            {
            case LicensingModelType.TwoDays:
                price = 2;
                break;

            case LicensingModelType.ThirtyDays:
                price = 4;
                break;

            case LicensingModelType.LifeLong:
                price = 8;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            if (athleteStatusType == AthleteStatusType.Advanced && (statusExpirationDate == null || statusExpirationDate.Value >= DateTime.UtcNow))
            {
                price = price * 0.75m;
            }

            return(price);
        }