private static YearlyRetentionSchedule GetPSLTRYearlySchedule(ServiceClientModel.YearlyRetentionSchedule serviceClientYearly) { if (serviceClientYearly == null) { return(null); } YearlyRetentionSchedule psYearly = new YearlyRetentionSchedule(); psYearly.DurationCountInYears = GetRetentionDurationInYears(serviceClientYearly.RetentionDuration); psYearly.RetentionTimes = ParseDateTimesToUTC(serviceClientYearly.RetentionTimes); psYearly.RetentionScheduleFormatType = (RetentionScheduleFormat)Enum.Parse(typeof(RetentionScheduleFormat), serviceClientYearly.RetentionScheduleFormatType); psYearly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(serviceClientYearly.RetentionScheduleDaily); psYearly.RetentionScheduleWeekly = GetPSLTRWeeklyRetentionFormat(serviceClientYearly.RetentionScheduleWeekly); psYearly.MonthsOfYear = HelperUtils.GetEnumListFromStringList <Month>(serviceClientYearly.MonthsOfYear); return(psYearly); }
private static YearlyRetentionSchedule GetPSLTRYearlySchedule(ServiceClientModel.YearlyRetentionSchedule serviceClientYearly) { if (serviceClientYearly == null) { return(null); } YearlyRetentionSchedule psYearly = new YearlyRetentionSchedule(); psYearly.DurationCountInYears = GetRetentionDurationInYears(serviceClientYearly.RetentionDuration); psYearly.RetentionTimes = ParseDateTimesToUTC(serviceClientYearly.RetentionTimes); psYearly.RetentionScheduleFormatType = serviceClientYearly.RetentionScheduleFormatType.ToEnum <RetentionScheduleFormat>(); psYearly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(serviceClientYearly.RetentionScheduleDaily); psYearly.RetentionScheduleWeekly = GetPSLTRWeeklyRetentionFormat(serviceClientYearly.RetentionScheduleWeekly); psYearly.MonthsOfYear = HelperUtils.EnumListConverter <ServiceClientModel.MonthOfYear?, Month>( serviceClientYearly.MonthsOfYear); return(psYearly); }
private static ServiceClientModel.YearlyRetentionSchedule GetServiceClientLTRYearlySchedule(YearlyRetentionSchedule psYearly) { if (psYearly == null) { return null; } ServiceClientModel.YearlyRetentionSchedule serviceClientYearly = new ServiceClientModel.YearlyRetentionSchedule(); serviceClientYearly.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psYearly.DurationCountInYears, DurationType = ServiceClientModel.RetentionDurationType.Years }; serviceClientYearly.RetentionTimes = psYearly.RetentionTimes; serviceClientYearly.RetentionScheduleFormatType = psYearly.RetentionScheduleFormatType.ToString(); if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Daily) { serviceClientYearly.RetentionScheduleDaily = GetServiceClientLTRDailyRetentionFormat(psYearly.RetentionScheduleDaily); } else if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Weekly) { serviceClientYearly.RetentionScheduleWeekly = GetServiceClientLTRWeeklyRetentionFormat(psYearly.RetentionScheduleWeekly); } serviceClientYearly.MonthsOfYear = HelperUtils.GetStringListFromEnumList<Month>(psYearly.MonthsOfYear); return serviceClientYearly; }
private static YearlyRetentionSchedule GetPSLTRYearlySchedule(ServiceClientModel.YearlyRetentionSchedule serviceClientYearly) { if (serviceClientYearly == null) { return null; } YearlyRetentionSchedule psYearly = new YearlyRetentionSchedule(); psYearly.DurationCountInYears = GetRetentionDurationInYears(serviceClientYearly.RetentionDuration); psYearly.RetentionTimes = ParseDateTimesToUTC(serviceClientYearly.RetentionTimes); psYearly.RetentionScheduleFormatType = (RetentionScheduleFormat)Enum.Parse(typeof(RetentionScheduleFormat), serviceClientYearly.RetentionScheduleFormatType); psYearly.RetentionScheduleDaily = GetPSLTRDailyRetentionFormat(serviceClientYearly.RetentionScheduleDaily); psYearly.RetentionScheduleWeekly = GetPSLTRWeeklyRetentionFormat(serviceClientYearly.RetentionScheduleWeekly); psYearly.MonthsOfYear = HelperUtils.GetEnumListFromStringList<Month>(serviceClientYearly.MonthsOfYear); return psYearly; }
private static ServiceClientModel.YearlyRetentionSchedule GetServiceClientLTRYearlySchedule(YearlyRetentionSchedule psYearly) { if (psYearly == null) { return(null); } ServiceClientModel.YearlyRetentionSchedule serviceClientYearly = new ServiceClientModel.YearlyRetentionSchedule(); serviceClientYearly.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psYearly.DurationCountInYears, DurationType = ServiceClientModel.RetentionDurationType.Years }; serviceClientYearly.RetentionTimes = GetNullableDateTimeListFromDateTimeList( psYearly.RetentionTimes); serviceClientYearly.RetentionScheduleFormatType = ServiceClientHelpers.GetServiceClientRetentionScheduleFormat( psYearly.RetentionScheduleFormatType); if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Daily) { serviceClientYearly.RetentionScheduleDaily = GetServiceClientLTRDailyRetentionFormat(psYearly.RetentionScheduleDaily); } else if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Weekly) { serviceClientYearly.RetentionScheduleWeekly = GetServiceClientLTRWeeklyRetentionFormat(psYearly.RetentionScheduleWeekly); } serviceClientYearly.MonthsOfYear = HelperUtils.EnumListConverter <Month, ServiceClientModel.MonthOfYear>( psYearly.MonthsOfYear).Cast <ServiceClientModel.MonthOfYear?>().ToList(); return(serviceClientYearly); }
private static ServiceClientModel.YearlyRetentionSchedule GetServiceClientLTRYearlySchedule(YearlyRetentionSchedule psYearly) { if (psYearly == null) { return(null); } ServiceClientModel.YearlyRetentionSchedule serviceClientYearly = new ServiceClientModel.YearlyRetentionSchedule(); serviceClientYearly.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psYearly.DurationCountInYears, DurationType = ServiceClientModel.RetentionDurationType.Years }; serviceClientYearly.RetentionTimes = psYearly.RetentionTimes; serviceClientYearly.RetentionScheduleFormatType = psYearly.RetentionScheduleFormatType.ToString(); if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Daily) { serviceClientYearly.RetentionScheduleDaily = GetServiceClientLTRDailyRetentionFormat(psYearly.RetentionScheduleDaily); } else if (psYearly.RetentionScheduleFormatType == RetentionScheduleFormat.Weekly) { serviceClientYearly.RetentionScheduleWeekly = GetServiceClientLTRWeeklyRetentionFormat(psYearly.RetentionScheduleWeekly); } serviceClientYearly.MonthsOfYear = HelperUtils.GetStringListFromEnumList <Month>(psYearly.MonthsOfYear); return(serviceClientYearly); }
private LongTermRetentionPolicy GetRandomLTRRetentionPolicy() { List <DateTime> retTimes = new List <DateTime> { DateTime.Parse( ConfigurationManager.AppSettings["ScheduleRunTime"]) }; DailyRetentionSchedule dailyRetention = new DailyRetentionSchedule() { RetentionDuration = new RetentionDuration() { Count = 10, DurationType = RetentionDurationType.Days }, RetentionTimes = retTimes }; WeeklyRetentionSchedule weeklyRetention = new WeeklyRetentionSchedule() { RetentionDuration = new RetentionDuration() { Count = 10, DurationType = RetentionDurationType.Weeks }, RetentionTimes = retTimes, DaysOfTheWeek = new List <string> { ConfigurationManager.AppSettings["ScheduleRunDay"] } }; YearlyRetentionSchedule yearlyRetention = new YearlyRetentionSchedule() { RetentionDuration = new RetentionDuration() { Count = 10, DurationType = RetentionDurationType.Weeks }, RetentionTimes = retTimes, RetentionScheduleFormatType = RetentionScheduleFormat.Daily, RetentionScheduleDaily = new DailyRetentionFormat() { DaysOfTheMonth = new List <Day>() { new Day() { Date = 1, IsLast = false }, new Day() { Date = 2, IsLast = true }, } } }; LongTermRetentionPolicy retPolicy = new LongTermRetentionPolicy() { DailySchedule = dailyRetention, WeeklySchedule = weeklyRetention, YearlySchedule = yearlyRetention }; return(retPolicy); }