private void LoadMySQL() { try { MYSQLHelper helper = new MYSQLHelper(); List <MYSQLBackup> items = helper.GetConfigList(); if (items != null && items.Count > 0) { MySQLList = (from t in items select new DatabaseViewModel { Id = t.Id, ServerName = t.ServerName, DatabaseName = t.DatabaseName, _backuptime = t.BackupTime, _lastBackup = t.LastBackupTime, }).ToList(); MySQLList.ForEach(a => a.BackupTime = a._backuptime.ToString("HH:mm")); MySQLList.ForEach(a => a.LastBackup = a._lastBackup == null ? "Never" : ((DateTime)a._lastBackup).ToString("MMM dd, yyyy HH:mm")); } else { MySQLList = new List <DatabaseViewModel>(); } } catch (Exception ex) { string message = Functions.GetErrorFromException(ex); MessageBox.Show("An error occurred while loading MSSQL backup configuration. \n" + message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void GenerateSummary() { AwsS3SettingColor = "LightGray"; EmailSettingColor = "LightGray"; ServiceColor = "LightGray"; try { MSSQLHelper mssqlHelper = new MSSQLHelper(); List<MSSQLBackup> sqlitems = mssqlHelper.GetConfigList(); MSSQLCount = sqlitems != null ? sqlitems.Count() : 0; MYSQLHelper mysqlHelper = new MYSQLHelper(); List<MYSQLBackup> mysqlitems = mysqlHelper.GetConfigList(); MySQLCount = mysqlitems != null ? mysqlitems.Count() : 0; FolderHelper folderHelper = new FolderHelper(); List<FolderBackup> folderitems = folderHelper.GetConfigList(); FolderCount = folderitems != null ? folderitems.Count() : 0; AWSS3Helper awsHelper = new AWSS3Helper(); AWSS3Setting awsSetting = awsHelper.GetConfig(); if (awsSetting == null) { AwsS3SettingStatus = "AWS S3 settings not defined"; } else if (awsSetting.IsValid == false) { AwsS3SettingStatus = "AWS S3 settings are not valid"; } else if (awsSetting.IsActive == false) { AwsS3SettingStatus = "AWS S3 settings are not active"; } else { AwsS3SettingStatus = "AWS S3 settings are valid & active"; AwsS3SettingColor = "Green"; } EmailHelper emailHelper = new EmailHelper(); EmailSetting emailSetting = emailHelper.GetConfig(); if (emailSetting == null) { EmailSettingStatus = "E-Mail settings are not defined"; } else if (emailSetting.IsValid == false) { EmailSettingStatus = "E-Mail settings are not valid"; } else { EmailSettingStatus = "Email settings are valid & active"; EmailSettingColor = "Green"; } ServiceStatus = "Background service is not installed"; GeneralSettingHelper generalHelper = new GeneralSettingHelper(); GeneralSetting generalSetting = generalHelper.GetConfig(); if (generalSetting != null && generalSetting.ServiceInstalled == true) { ServiceStatus = "Background service is installed"; ServiceColor = "Green"; btnInstallService.Visibility = Visibility.Collapsed; btnUnInstallService.Visibility = Visibility.Visible; } } catch (Exception ex) { string message = Functions.GetErrorFromException(ex); MessageBox.Show("An error occurred. \n" + message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }