public override void CheckForChanges() { if (HasUnsavedChanges) { return; } if (PeriodicBackupSettings.Equals(OriginalPeriodicBackupSettings) == false) { HasUnsavedChanges = true; return; } if (PeriodicBackupSetup == null) { if (OriginalPeriodicBackupSetup == null) { return; } HasUnsavedChanges = true; return; } if (PeriodicBackupSetup.Equals(OriginalPeriodicBackupSetup) == false) { HasUnsavedChanges = true; } }
public override void LoadFor(DatabaseDocument document) { PeriodicBackupSettings = new PeriodicBackupSettings(); var session = ApplicationModel.Current.Server.Value.DocumentStore .OpenAsyncSession(ApplicationModel.Current.Server.Value.SelectedDatabase.Value.Name); if (document.Settings.ContainsKey("Raven/AWSAccessKey") && document.SecuredSettings.ContainsKey("Raven/AWSSecretKey")) { PeriodicBackupSettings.AwsAccessKey = document.Settings["Raven/AWSAccessKey"]; PeriodicBackupSettings.AwsSecretKey = document.SecuredSettings["Raven/AWSSecretKey"]; } if (document.Settings.ContainsKey("Raven/AzureStorageAccount") && document.SecuredSettings.ContainsKey("Raven/AzureStorageKey")) { PeriodicBackupSettings.AzureStorageAccount = document.Settings["Raven/AzureStorageAccount"]; PeriodicBackupSettings.AzureStorageKey = document.SecuredSettings["Raven/AzureStorageKey"]; } OriginalPeriodicBackupSettings = new PeriodicBackupSettings { AwsAccessKey = PeriodicBackupSettings.AwsAccessKey, AwsSecretKey = PeriodicBackupSettings.AwsSecretKey, AzureStorageAccount = PeriodicBackupSettings.AzureStorageAccount, AzureStorageKey = PeriodicBackupSettings.AzureStorageKey }; session.LoadAsync<PeriodicBackupSetup>(PeriodicBackupSetup.RavenDocumentKey).ContinueWith(task => { PeriodicBackupSetup = task.Result; if (PeriodicBackupSetup == null) return; OriginalPeriodicBackupSetup = new PeriodicBackupSetup { AwsRegionEndpoint = PeriodicBackupSetup.AwsRegionEndpoint, AzureStorageContainer = PeriodicBackupSetup.AzureStorageContainer, GlacierVaultName = PeriodicBackupSetup.GlacierVaultName, IntervalMilliseconds = PeriodicBackupSetup.IntervalMilliseconds, LocalFolderName = PeriodicBackupSetup.LocalFolderName, S3BucketName = PeriodicBackupSetup.S3BucketName }; HasDocument = true; if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.LocalFolderName) == false) SelectedOption.Value = 0; else if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.GlacierVaultName) == false) SelectedOption.Value = 1; else if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.S3BucketName) == false) SelectedOption.Value = 2; else if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.AzureStorageContainer) == false) SelectedOption.Value = 3; OnPropertyChanged(() => HasDocument); OnPropertyChanged(() => PeriodicBackupSetup); }); }
public override void LoadFor(DatabaseDocument document) { PeriodicBackupSettings = new PeriodicBackupSettings(); var session = ApplicationModel.Current.Server.Value.DocumentStore .OpenAsyncSession(ApplicationModel.Current.Server.Value.SelectedDatabase.Value.Name); if (document.Settings.ContainsKey("Raven/AWSAccessKey") && document.SecuredSettings.ContainsKey("Raven/AWSSecretKey")) { PeriodicBackupSettings.AwsAccessKey = document.Settings["Raven/AWSAccessKey"]; PeriodicBackupSettings.AwsSecretKey = document.SecuredSettings["Raven/AWSSecretKey"]; } if (document.Settings.ContainsKey("Raven/AzureStorageAccount") && document.SecuredSettings.ContainsKey("Raven/AzureStorageKey")) { PeriodicBackupSettings.AzureStorageAccount = document.Settings["Raven/AzureStorageAccount"]; PeriodicBackupSettings.AzureStorageKey = document.SecuredSettings["Raven/AzureStorageKey"]; } OriginalPeriodicBackupSettings = new PeriodicBackupSettings { AwsAccessKey = PeriodicBackupSettings.AwsAccessKey, AwsSecretKey = PeriodicBackupSettings.AwsSecretKey, AzureStorageAccount = PeriodicBackupSettings.AzureStorageAccount, AzureStorageKey = PeriodicBackupSettings.AzureStorageKey }; session.LoadAsync <PeriodicBackupSetup>(PeriodicBackupSetup.RavenDocumentKey).ContinueWith(task => { PeriodicBackupSetup = task.Result; if (PeriodicBackupSetup == null) { return; } OriginalPeriodicBackupSetup = new PeriodicBackupSetup { AwsRegionEndpoint = PeriodicBackupSetup.AwsRegionEndpoint, AzureStorageContainer = PeriodicBackupSetup.AzureStorageContainer, GlacierVaultName = PeriodicBackupSetup.GlacierVaultName, IntervalMilliseconds = PeriodicBackupSetup.IntervalMilliseconds, LocalFolderName = PeriodicBackupSetup.LocalFolderName, S3BucketName = PeriodicBackupSetup.S3BucketName }; HasDocument = true; if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.LocalFolderName) == false) { SelectedOption.Value = 0; } else if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.GlacierVaultName) == false) { SelectedOption.Value = 1; } else if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.S3BucketName) == false) { SelectedOption.Value = 2; } else if (string.IsNullOrWhiteSpace(PeriodicBackupSetup.AzureStorageContainer) == false) { SelectedOption.Value = 3; } OnPropertyChanged(() => HasDocument); OnPropertyChanged(() => PeriodicBackupSetup); }); }
protected bool Equals(PeriodicBackupSettings other) { return(string.Equals(AwsAccessKey, other.AwsAccessKey) && string.Equals(AwsSecretKey, other.AwsSecretKey) && string.Equals(AzureStorageAccount, other.AzureStorageAccount) && string.Equals(AzureStorageKey, other.AzureStorageKey)); }
protected bool Equals(PeriodicBackupSettings other) { return string.Equals(AwsAccessKey, other.AwsAccessKey) && string.Equals(AwsSecretKey, other.AwsSecretKey) && string.Equals(AzureStorageAccount, other.AzureStorageAccount) && string.Equals(AzureStorageKey, other.AzureStorageKey); }