Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the LongTermRetentionPolicy class.
 /// </summary>
 /// <param name="dailySchedule">Daily retention schedule of the
 /// protection policy.</param>
 /// <param name="weeklySchedule">Weekly retention schedule of the
 /// protection policy.</param>
 /// <param name="monthlySchedule">Monthly retention schedule of the
 /// protection policy.</param>
 /// <param name="yearlySchedule">Yearly retention schedule of the
 /// protection policy.</param>
 public LongTermRetentionPolicy(DailyRetentionSchedule dailySchedule = default(DailyRetentionSchedule), WeeklyRetentionSchedule weeklySchedule = default(WeeklyRetentionSchedule), MonthlyRetentionSchedule monthlySchedule = default(MonthlyRetentionSchedule), YearlyRetentionSchedule yearlySchedule = default(YearlyRetentionSchedule))
 {
     DailySchedule   = dailySchedule;
     WeeklySchedule  = weeklySchedule;
     MonthlySchedule = monthlySchedule;
     YearlySchedule  = yearlySchedule;
     CustomInit();
 }
Ejemplo n.º 2
0
        private static WeeklyRetentionSchedule GetPSLTRWeeklySchedule(ServiceClientModel.WeeklyRetentionSchedule serviceClientWeekly)
        {
            if (serviceClientWeekly == null)
            {
                return(null);
            }

            WeeklyRetentionSchedule psWeekly = new WeeklyRetentionSchedule();

            psWeekly.DurationCountInWeeks = GetRetentionDurationInWeeks(serviceClientWeekly.RetentionDuration);
            psWeekly.RetentionTimes       = ParseDateTimesToUTC(serviceClientWeekly.RetentionTimes);
            psWeekly.DaysOfTheWeek        = HelperUtils.GetEnumListFromStringList <DayOfWeek>(serviceClientWeekly.DaysOfTheWeek);

            return(psWeekly);
        }
        private static WeeklyRetentionSchedule GetPSLTRWeeklySchedule(ServiceClientModel.WeeklyRetentionSchedule serviceClientWeekly,
                                                                      string timeZone)
        {
            if (serviceClientWeekly == null)
            {
                return(null);
            }

            WeeklyRetentionSchedule psWeekly = new WeeklyRetentionSchedule();

            psWeekly.DurationCountInWeeks = GetRetentionDurationInWeeks(serviceClientWeekly.RetentionDuration);
            psWeekly.RetentionTimes       = ParseDateTimesToUTC(serviceClientWeekly.RetentionTimes, timeZone);
            psWeekly.DaysOfTheWeek        =
                HelperUtils.EnumListConverter <ServiceClientModel.DayOfWeek?, DayOfWeek>(
                    serviceClientWeekly.DaysOfTheWeek);

            return(psWeekly);
        }
Ejemplo n.º 4
0
        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.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 =
                GetNullableDateTimeListFromDateTimeList(psWeekly.RetentionTimes);
            serviceClientWeekly.DaysOfTheWeek =
                HelperUtils.EnumListConverter <DayOfWeek, ServiceClientModel.DayOfWeek>(
                    psWeekly.DaysOfTheWeek).Cast <ServiceClientModel.DayOfWeek?>().ToList();

            return(serviceClientWeekly);
        }
        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;
        }
Ejemplo n.º 7
0
        private LongTermRetentionPolicy GetRandomLTRRetentionPolicy()
        {
            List<DateTime> retTimes = new List<DateTime> { DateTime.UtcNow.AddDays(2) };

            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;
        }