private static int GetRetentionDurationInYears(ServiceClientModel.RetentionDuration retentionDuration) { int yearsCount = 0; switch (retentionDuration.DurationType) { case ServiceClientModel.RetentionDurationType.Days: yearsCount = GetIntegerFromNullableIntgerValue(retentionDuration.Count) / PolicyConstants.NumOfDaysInYear; break; case ServiceClientModel.RetentionDurationType.Weeks: yearsCount = GetIntegerFromNullableIntgerValue(retentionDuration.Count) / PolicyConstants.NumOfWeeksInYear; break; case ServiceClientModel.RetentionDurationType.Months: yearsCount = GetIntegerFromNullableIntgerValue(retentionDuration.Count) / PolicyConstants.NumOfMonthsInYear; break; case ServiceClientModel.RetentionDurationType.Years: yearsCount = GetIntegerFromNullableIntgerValue(retentionDuration.Count); break; default: throw new ArgumentException(Resources.InvalidDurationTypeException, retentionDuration.DurationType.ToString()); } return(yearsCount); }
private static int GetRetentionDurationInDays(ServiceClientModel.RetentionDuration retentionDuration) { int daysCount = 0; switch (retentionDuration.DurationType) { case ServiceClientModel.RetentionDurationType.Days: daysCount = retentionDuration.Count; break; case ServiceClientModel.RetentionDurationType.Weeks: daysCount = retentionDuration.Count * PolicyConstants.NumOfDaysInWeek; break; case ServiceClientModel.RetentionDurationType.Months: daysCount = retentionDuration.Count * PolicyConstants.NumOfDaysInMonth; break; case ServiceClientModel.RetentionDurationType.Years: daysCount = retentionDuration.Count * PolicyConstants.NumOfDaysInYear; break; default: throw new ArgumentException(Resources.InvalidDurationTypeException, retentionDuration.DurationType.ToString()); } return(daysCount); }
/// <summary> /// Initializes a new instance of the WeeklyRetentionSchedule class. /// </summary> /// <param name="daysOfTheWeek">List of days of week for weekly /// retention policy.</param> /// <param name="retentionTimes">Retention times of retention /// policy.</param> /// <param name="retentionDuration">Retention duration of retention /// Policy.</param> public WeeklyRetentionSchedule(IList <DayOfWeek?> daysOfTheWeek = default(IList <DayOfWeek?>), IList <System.DateTime?> retentionTimes = default(IList <System.DateTime?>), RetentionDuration retentionDuration = default(RetentionDuration)) { DaysOfTheWeek = daysOfTheWeek; RetentionTimes = retentionTimes; RetentionDuration = retentionDuration; CustomInit(); }
/// <summary> /// Initializes a new instance of the MonthlyRetentionSchedule class. /// </summary> /// <param name="retentionScheduleFormatType">Retention schedule format /// type for monthly retention policy. Possible values include: /// 'Invalid', 'Daily', 'Weekly'</param> /// <param name="retentionScheduleDaily">Daily retention format for /// monthly retention policy.</param> /// <param name="retentionScheduleWeekly">Weekly retention format for /// monthly retention policy.</param> /// <param name="retentionTimes">Retention times of retention /// policy.</param> /// <param name="retentionDuration">Retention duration of retention /// Policy.</param> public MonthlyRetentionSchedule(string retentionScheduleFormatType = default(string), DailyRetentionFormat retentionScheduleDaily = default(DailyRetentionFormat), WeeklyRetentionFormat retentionScheduleWeekly = default(WeeklyRetentionFormat), IList <System.DateTime?> retentionTimes = default(IList <System.DateTime?>), RetentionDuration retentionDuration = default(RetentionDuration)) { RetentionScheduleFormatType = retentionScheduleFormatType; RetentionScheduleDaily = retentionScheduleDaily; RetentionScheduleWeekly = retentionScheduleWeekly; RetentionTimes = retentionTimes; RetentionDuration = retentionDuration; CustomInit(); }
/// <summary> /// Initializes a new instance of the DailyRetentionSchedule class. /// </summary> /// <param name="retentionTimes">Retention times of retention /// policy.</param> /// <param name="retentionDuration">Retention duration of retention /// Policy.</param> public DailyRetentionSchedule(IList <System.DateTime?> retentionTimes = default(IList <System.DateTime?>), RetentionDuration retentionDuration = default(RetentionDuration)) { RetentionTimes = retentionTimes; RetentionDuration = retentionDuration; CustomInit(); }
/// <summary> /// Initializes a new instance of the SimpleRetentionPolicy class. /// </summary> /// <param name="retentionDuration">Retention duration of the /// protection policy.</param> public SimpleRetentionPolicy(RetentionDuration retentionDuration = default(RetentionDuration)) { RetentionDuration = retentionDuration; CustomInit(); }