public override void Validate()
        {
            base.Validate();

            if (DurationCountInYears <= 0 || DurationCountInYears > PolicyConstants.MaxAllowedRetentionDurationCount)
            {
                throw new ArgumentException(Resources.RetentionDurationCountInvalidException);
            }

            if (MonthsOfYear == null || MonthsOfYear.Count == 0 || MonthsOfYear.Count != MonthsOfYear.Distinct().Count())
            {
                throw new ArgumentException(Resources.YearlyScheduleMonthsOfYearException);
            }

            if (RetentionScheduleFormatType == RetentionScheduleFormat.Daily)
            {
                if (RetentionScheduleDaily == null)
                {
                    throw new ArgumentException(Resources.MonthlyYearlyRetentionDailySchedulePolicyNULLException);
                }

                RetentionScheduleDaily.Validate();
            }

            if (RetentionScheduleFormatType == RetentionScheduleFormat.Weekly)
            {
                if (RetentionScheduleWeekly == null)
                {
                    throw new ArgumentException(Resources.MonthlyYearlyRetentionWeeklySchedulePolicyNULLException);
                }

                RetentionScheduleWeekly.Validate();
            }
        }
Пример #2
0
 public override string ToString()
 {
     return(string.Format("RetentionScheduleType:{0}, {1}, RetentionScheduleDaily:{2}," +
                          "RetentionScheduleWeekly:{3}, {4}", RetentionScheduleFormatType, base.ToString(),
                          RetentionScheduleDaily == null ? "NULL" : RetentionScheduleDaily.ToString(),
                          RetentionScheduleWeekly == null ? "NULL" : RetentionScheduleWeekly.ToString(),
                          base.ToString()));
 }
 public override string ToString()
 {
     return(string.Format("DurationCountInYears:{0}, RetentionScheduleType:{1}, {2}, RetentionScheduleDaily:{3}," +
                          "RetentionScheduleWeekly:{4}, MonthsOfYear: {5}, {6}",
                          DurationCountInYears, RetentionScheduleFormatType.ToString(), base.ToString(),
                          RetentionScheduleDaily == null ? "NULL" : RetentionScheduleDaily.ToString(),
                          RetentionScheduleWeekly == null ? "NULL" : RetentionScheduleWeekly.ToString(),
                          TraceUtils.GetString <Month>(MonthsOfYear), base.ToString()));
 }
 public override string ToString()
 {
     return(string.Format("DurationCountInMonths:{0}, RetentionScheduleType:{1}, {2}, RetentionScheduleDaily:{3}," +
                          "RetentionScheduleWeekly:{4}, {5}",
                          DurationCountInMonths, RetentionScheduleFormatType, base.ToString(),
                          RetentionScheduleDaily == null ? "NULL" : RetentionScheduleDaily.ToString(),
                          RetentionScheduleWeekly == null ? "NULL" : RetentionScheduleWeekly.ToString(),
                          base.ToString()));
 }
Пример #5
0
        public override void Validate()
        {
            base.Validate();

            int MinDurationCountInYears = 1, MaxDurationCountInYears = PolicyConstants.MaxAllowedRetentionDurationCountYearly;

            if (BackupManagementType == Management.RecoveryServices.Backup.Models.BackupManagementType.AzureStorage)
            {
                MinDurationCountInYears = PolicyConstants.AfsYearlyRetentionMin;
                MaxDurationCountInYears = PolicyConstants.AfsYearlyRetentionMax;
            }
            if (DurationCountInYears < MinDurationCountInYears || DurationCountInYears > MaxDurationCountInYears)
            {
                throw new ArgumentException(Resources.RetentionDurationCountInvalidException);
            }

            if (MonthsOfYear == null || MonthsOfYear.Count == 0 || MonthsOfYear.Count != MonthsOfYear.Distinct().Count())
            {
                throw new ArgumentException(Resources.YearlyScheduleMonthsOfYearException);
            }

            if (RetentionScheduleFormatType == RetentionScheduleFormat.Daily)
            {
                if (RetentionScheduleDaily == null)
                {
                    throw new ArgumentException(Resources.MonthlyYearlyRetentionDailySchedulePolicyNULLException);
                }

                RetentionScheduleDaily.Validate();
            }

            if (RetentionScheduleFormatType == RetentionScheduleFormat.Weekly)
            {
                if (RetentionScheduleWeekly == null)
                {
                    throw new ArgumentException(Resources.MonthlyYearlyRetentionWeeklySchedulePolicyNULLException);
                }

                RetentionScheduleWeekly.Validate();
            }
        }
        public override void Validate(ScheduleRunType ScheduleRunFrequency = 0)
        {
            base.Validate(ScheduleRunFrequency);

            int MinDurationCountInMonths = 1, MaxDurationCountInMonths = PolicyConstants.MaxAllowedRetentionDurationCountMonthly;

            if (BackupManagementType == Management.RecoveryServices.Backup.Models.BackupManagementType.AzureStorage)
            {
                MinDurationCountInMonths = PolicyConstants.AfsMonthlyRetentionMin;
                MaxDurationCountInMonths = PolicyConstants.AfsMonthlyRetentionMax;
            }

            if (DurationCountInMonths < MinDurationCountInMonths || DurationCountInMonths > MaxDurationCountInMonths)
            {
                throw new ArgumentException(Resources.RetentionDurationCountInvalidException);
            }

            if (RetentionScheduleFormatType == RetentionScheduleFormat.Daily)
            {
                if (RetentionScheduleDaily == null)
                {
                    throw new ArgumentException(Resources.MonthlyYearlyRetentionDailySchedulePolicyNULLException);
                }

                RetentionScheduleDaily.Validate();
            }

            if (RetentionScheduleFormatType == RetentionScheduleFormat.Weekly)
            {
                if (RetentionScheduleWeekly == null)
                {
                    throw new ArgumentException(Resources.MonthlyYearlyRetentionWeeklySchedulePolicyNULLException);
                }

                RetentionScheduleWeekly.Validate();
            }
        }