public void BackupDatabase(string fileName) { if (string.IsNullOrWhiteSpace(fileName)) { this.Clients.Caller.backupFailed(Warnings.NoFileSpecified); return; } PostgreSQLServer server = new PostgreSQLServer { BinDirectory = ConfigurationHelper.GetDbServerParameter("PostgreSQLBinDirectory"), DatabaseBackupDirectory = ConfigurationHelper.GetDbServerParameter("DatabaseBackupDirectory"), DatabaseName = AppUsers.GetCurrentUserDB(), HostName = ConfigurationHelper.GetDbServerParameter("Server"), PortNumber = Conversion.TryCastInteger(ConfigurationHelper.GetDbServerParameter("Port")), UserId = ConfigurationHelper.GetDbServerParameter("UserId"), Password = ConfigurationHelper.GetDbServerParameter("Password") }; server.Validate(); if (server.IsValid && !string.IsNullOrWhiteSpace(server.BinDirectory) && !string.IsNullOrWhiteSpace(server.DatabaseBackupDirectory)) { this.Backup(server, fileName); return; } this.Clients.Caller.backupFailed(Warnings.ConfigurationError); }
public void BackupDatabase(string fileName) { if (string.IsNullOrWhiteSpace(fileName)) { this.Clients.Caller.backupFailed(Warnings.NoFileSpecified); return; } PostgreSQLServer server = new PostgreSQLServer(); server.Validate(); if (server.IsValid && !string.IsNullOrWhiteSpace(server.BinDirectory) && !string.IsNullOrWhiteSpace(server.DatabaseBackupDirectory)) { this.Backup(server, fileName); return; } this.Clients.Caller.backupFailed(Warnings.ConfigurationError); }