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); }
// <summary> /// Helper function to convert service simple schedule policy from ps scheduel policy. /// </summary> public static ServiceClientModel.SimpleSchedulePolicy GetServiceClientSimpleSchedulePolicy( SimpleSchedulePolicy psPolicy) { if (psPolicy == null) { return(null); } ServiceClientModel.SimpleSchedulePolicy serviceClientPolicy = new ServiceClientModel.SimpleSchedulePolicy(); serviceClientPolicy.ScheduleRunFrequency = psPolicy.ScheduleRunFrequency.ToString(); if (psPolicy.ScheduleRunFrequency == ScheduleRunType.Weekly) { serviceClientPolicy.ScheduleRunDays = HelperUtils.GetStringListFromEnumList <DayOfWeek>(psPolicy.ScheduleRunDays); } serviceClientPolicy.ScheduleRunTimes = psPolicy.ScheduleRunTimes; return(serviceClientPolicy); }
private static ServiceClientModel.WeeklyRetentionSchedule GetServiceClientLTRWeeklySchedule(WeeklyRetentionSchedule psWeekly) { if (psWeekly == null) { return(null); } ServiceClientModel.WeeklyRetentionSchedule serviceClientWeekly = new ServiceClientModel.WeeklyRetentionSchedule(); serviceClientWeekly.RetentionDuration = new ServiceClientModel.RetentionDuration() { Count = psWeekly.DurationCountInWeeks, DurationType = ServiceClientModel.RetentionDurationType.Weeks }; serviceClientWeekly.RetentionTimes = psWeekly.RetentionTimes; serviceClientWeekly.DaysOfTheWeek = HelperUtils.GetStringListFromEnumList <DayOfWeek>(psWeekly.DaysOfTheWeek); return(serviceClientWeekly); }
private static ServiceClientModel.WeeklyRetentionFormat GetServiceClientLTRWeeklyRetentionFormat( WeeklyRetentionFormat psFormat) { if (psFormat == null) { return(null); } ServiceClientModel.WeeklyRetentionFormat serviceClientFormat = new ServiceClientModel.WeeklyRetentionFormat(); if (psFormat.DaysOfTheWeek != null) { serviceClientFormat.DaysOfTheWeek = HelperUtils.GetStringListFromEnumList <DayOfWeek>(psFormat.DaysOfTheWeek); } if (psFormat.WeeksOfTheMonth != null) { serviceClientFormat.WeeksOfTheMonth = HelperUtils.GetStringListFromEnumList <WeekOfMonth>(psFormat.WeeksOfTheMonth); } return(serviceClientFormat); }