Exemple #1
0
 internal static BackupRestoreView.BasicRetentionPolicy ToBasicRetentionPolicyView(
     BasicRetentionPolicy basicRetentionPolicy)
 {
     BackupRestoreView.BasicRetentionPolicy basicRetentionPolicyView = new BackupRestoreView.BasicRetentionPolicy();
     basicRetentionPolicyView.RetentionDuration      = basicRetentionPolicy.RetentionDuration;
     basicRetentionPolicyView.MinimumNumberOfBackups = basicRetentionPolicy.MinimumNumberOfBackups;
     return(basicRetentionPolicyView);
 }
Exemple #2
0
        internal static BasicRetentionPolicy FromBasicRetentionPolicyView(
            BackupRestoreView.BasicRetentionPolicy basicRetentionPolicyView)
        {
            BasicRetentionPolicy basicRetentionPolicy = new BasicRetentionPolicy();

            TimeSpan timeSpan = basicRetentionPolicyView.RetentionDuration;

            if ((int)timeSpan.TotalHours == 0)
            {
                throw new ArgumentException(StringResources.InvalidInterval);
            }

            timeSpan = TimeSpan.FromHours((double)(int)timeSpan.TotalHours);
            basicRetentionPolicy.RetentionDuration      = timeSpan;
            basicRetentionPolicy.MinimumNumberOfBackups = basicRetentionPolicyView.MinimumNumberOfBackups;
            return(basicRetentionPolicy);
        }