示例#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();
 }
示例#2
0
        private static DailyRetentionSchedule GetPSLTRDailySchedule(ServiceClientModel.DailyRetentionSchedule serviceClientDaily)
        {
            if (serviceClientDaily == null)
            {
                return(null);
            }

            DailyRetentionSchedule psDaily = new DailyRetentionSchedule();

            psDaily.DurationCountInDays = GetRetentionDurationInDays(serviceClientDaily.RetentionDuration);
            psDaily.RetentionTimes      = ParseDateTimesToUTC(serviceClientDaily.RetentionTimes);

            return(psDaily);
        }
示例#3
0
        private static ServiceClientModel.DailyRetentionSchedule GetServiceClientLTRDailySchedule(DailyRetentionSchedule psDaily)
        {
            if (psDaily == null)
            {
                return(null);
            }

            ServiceClientModel.DailyRetentionSchedule serviceClientDaily = new ServiceClientModel.DailyRetentionSchedule();

            serviceClientDaily.RetentionDuration = new ServiceClientModel.RetentionDuration()
            {
                Count        = psDaily.DurationCountInDays,
                DurationType = ServiceClientModel.RetentionDurationType.Days
            };

            serviceClientDaily.RetentionTimes = psDaily.RetentionTimes;

            return(serviceClientDaily);
        }
        private static ServiceClientModel.DailyRetentionSchedule GetServiceClientLTRDailySchedule(DailyRetentionSchedule psDaily)
        {
            if (psDaily == null)
            {
                return null;
            }

            ServiceClientModel.DailyRetentionSchedule serviceClientDaily = new ServiceClientModel.DailyRetentionSchedule();

            serviceClientDaily.RetentionDuration = new ServiceClientModel.RetentionDuration()
            {
                Count = psDaily.DurationCountInDays,
                DurationType = ServiceClientModel.RetentionDurationType.Days
            };

            serviceClientDaily.RetentionTimes = psDaily.RetentionTimes;

            return serviceClientDaily;
        }
示例#5
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;
        }