private void LoadBackupsData(Client c) { if (!this.BackupsLoaded) { if (this._gridBackupsList.Count > 0) { this._gridBackupsList.Clear(); } ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); foreach (BackupInfo item in client.GetBackupsByClientID(c.ID)) { this._gridBackupsList.Add(item); } this.dataGrid_Backups.ItemsSource = this._gridBackupsList; this._backupTab_DisableComponents(); if (this._gridBackupsList.Count == 0) { this.dataGrid_Backups.SelectedIndex = -1; this.btn_Backup_Edit.IsEnabled = false; } else { this.dataGrid_Backups.SelectedIndex = 0; this.IsBackupEditState = false; this.btn_Backup_Edit.IsEnabled = true; } client.Close(); } }
private void _loadGrid(Filter f, Sort s) { App.Current.Dispatcher.Invoke(delegate { this._gridClientsList.Clear(); }); ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); foreach (Client item in client.GetClients(f, s)) { ; App.Current.Dispatcher.Invoke(delegate { this._gridClientsList.Add(item); }); } if (this._gridClientsList.Count > 0) { App.Current.Dispatcher.Invoke(delegate { this.listBox_Clients.SelectedIndex = 0; }); } App.Current.Dispatcher.Invoke(delegate { this.listBox_Clients.ItemsSource = this._gridClientsList; }); client.Close(); }
private void TabControl_Main_SelectionChanged(object sender, SelectionChangedEventArgs e) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); Client c = this.listBox_Clients.SelectedItem as Client; switch (this.TabControl_Main.SelectedIndex) { case 1: this.LoadTemplatesData(c); break; case 2: this.LoadBackupsData(c); break; case 3: this.radioBtn_Log_Logs.IsChecked = true; this.LoadLogsData(c, true); break; default: break; } client.Close(); }
public void _loadLogInfo(Log log, bool WithBackup) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); if (WithBackup) { this.groupBox_Log_LogsBackup.Visibility = Visibility.Visible; this.groupBox_Log_LogsClient.Visibility = Visibility.Hidden; this.groupBox_Log_Logins.Visibility = Visibility.Hidden; this.textBox_Log_LogsBackup_Client.Text = client.GetClientByID(log.IDClient).Name; this.textBox_Log_LogsBackup_Backup.Text = client.GetBackupByID((long)log.IDBackup).Name; this.comboBox_Log_LogsBackup_Type.SelectedIndex = log.LogType; this.dateTimePicker_Log_LogsBackup_Time.Value = log.UTCTime; this.textBox_Log_LogsBackup_Value.Text = this._formatLogValue(log.Value); } else { this.groupBox_Log_LogsClient.Visibility = Visibility.Visible; this.groupBox_Log_LogsBackup.Visibility = Visibility.Hidden; this.groupBox_Log_Logins.Visibility = Visibility.Hidden; this.textBox_Log_LogsClient_Client.Text = client.GetClientByID(log.IDClient).Name; this.comboBox_Log_LogsClient_Type.SelectedIndex = log.LogType; this.dateTimePicker_Log_LogsClient_Time.Value = log.UTCTime; this.textBox_Log_LogsClient_Value.Text = this._formatLogValue(log.Value); } client.Close(); }
private void LoadLogsData(Client c, bool Logs) { if (c != null) { this._gridLogsList.Clear(); this._gridLoginsList.Clear(); ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); if (Logs) { foreach (Log item in client.GetLogsByClientID(c.ID)) { this._gridLogsList.Add(item); } this.dataGrid_Logs.ItemsSource = this._gridLogsList; } else { foreach (Login item in client.GetLoginsByClient(c.ID)) { this._gridLoginsList.Add(item); } this.dataGrid_Logs.ItemsSource = this._gridLoginsList; } this._logTab_DisableComponents(); this.LogsLoaded = true; client.Close(); } }
private void btn_Client_Edit_Click(object sender, RoutedEventArgs e) { if (this.IsClientEditState) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); Client c = this.listBox_Clients.SelectedItem as Client; c.Description = this.textBox_Client_Description.Text; c.StatusReportEnabled = (bool)this.radioBtn_Client_ConnSet.IsChecked ? true : false; if (c.StatusReportEnabled) { c.ReportInterval = (int)this.IntUpDown_Client_StatusRepeat.Value; } this._clientTab_DisableComponents(); this.btn_Client_Edit.IsEnabled = true; client.UpdateClient(c); client.Close(); this.IsClientEditState = false; } else { this.textBox_Client_Description.IsEnabled = true; this.groupBox_Client_Connection.IsEnabled = true; this.IsClientEditState = true; } }
private void LoadClientInfo(Client c) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); this._clientTab_DisableComponents(); this.textBox_Client_Name.Text = c.Name; this.textBox_Client_Description.Text = c.Description; if (c.StatusReportEnabled) { this.radioBtn_Client_ConnSet.IsChecked = true; this.IntUpDown_Client_StatusRepeat.Value = c.ReportInterval; } else { this.radioBtn_Client_ConnDefault.IsChecked = true; } this.dateTimePicker_Client_LastBackupTime.Value = c.UTCLastBackupTime; this.dateTimePicker_Client_LastReportTime.Value = c.UTCLastStatusReportTime; this.dateTimePicker_Client_RegistrationDate.Value = c.UTCRegistrationDate; client.Close(); }
public void _loadLoginInfo(Login login) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); this.textBox_Log_Login_Client.Text = client.GetClientByID(login.IDClient).Name; this.dateTimePicker_Log_Logins_Time.Value = login.UTCTime; this.textBox_Log_Login_IP.Text = login.IP; client.Close(); }
private void btn_Template_Remove_Click(object sender, RoutedEventArgs e) { if (Xceed.Wpf.Toolkit.MessageBox.Show(this, "Are you sure?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); BackupTemplate bt = this.dataGrid_Templates.SelectedItem as BackupTemplate; this._gridTemplatesList.Remove(bt); client.RemoveBackupTemplate(bt.ID); client.Close(); } }
public void Authorize(string username, string password) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); if (client.Login(username, password)) { MainWindow mw = new MainWindow(client.GetProfile(username)); mw.Show(); this.Close(); } client.Close(); }
private void btn_Ban_Unban_Click(object sender, RoutedEventArgs e) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); Client c = this.listBox_Clients.SelectedItem as Client; c.Status = 1; client.UpdateClient(c); this.SetClientCorrectWindow(c); client.Close(); }
private void btn_Client_Ban_Click(object sender, RoutedEventArgs e) { Client c = this.listBox_Clients.SelectedItem as Client; if (Xceed.Wpf.Toolkit.MessageBox.Show(this, "Do you wish to ban client \"" + c.Name + "\" ?", "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); c.Status = 2; client.UpdateClient(c); this.SetClientCorrectWindow(c); client.Close(); } }
private void btn_Template_StatusChange_Click(object sender, RoutedEventArgs e) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); BackupTemplate template = this.dataGrid_Templates.SelectedItem as BackupTemplate; if (template.Enabled) { this.btn_Template_StatusChange.Content = "Enable"; template.Enabled = false; client.SetTemplateStatus(template.ID, false); } else if (!template.Enabled) { this.btn_Template_StatusChange.Content = "Disable"; template.Enabled = true; client.SetTemplateStatus(template.ID, true); } client.Close(); }
private void btn_Edit_Click(object sender, RoutedEventArgs e) { if (this.IsEditState && this.IsValid()) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); this.Admin.FirstName = this.textBox_FirstName.Text; this.Admin.LastName = this.textBox_LastName.Text; this.Admin.Emails = new List <Email>(this._gridEmailsList); client.UpdateAdministrator(this.Admin); this.DisableComponents(); this.IsEditState = false; client.Close(); } else { this.EnableComponents(); this.IsEditState = true; } }
private void LoadTemplatesData(Client c) { if (!this.TemplatesLoaded) { if (this._gridTemplatesList.Count > 0) { this._gridTemplatesList.Clear(); } ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); this.dataGrid_Template_Source.ItemsSource = this._gridTemplateSourceList; this.dataGrid_Template_Destination.ItemsSource = this._gridTemplateDestinationList; Configuration config = client.GetConfigurationByClientID(c.ID); foreach (BackupTemplate item in config.Templates) { this._gridTemplatesList.Add(item); } this.dataGrid_Templates.ItemsSource = this._gridTemplatesList; this._templateTab_DisableComponents(); if (this._gridTemplatesList.Count == 0) { this.dataGrid_Templates.SelectedIndex = -1; this.btn_Template_Edit.IsEnabled = false; } else { this.dataGrid_Templates.SelectedIndex = 0; this.btn_Template_Edit.IsEnabled = true; } this.TemplatesLoaded = true; client.Close(); } }
private void btn_Backup_Edit_Click(object sender, RoutedEventArgs e) { if (this.IsBackupEditState) { if (this._isBackupExpireDateValid(this.dateTimePicker_Backup_Expire.Value)) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); BackupInfo backup = this.dataGrid_Backups.SelectedItem as BackupInfo; backup.Name = this.textBox_Backup_Name.Text; backup.Description = this.textBox_Backup_Description.Text; backup.UTCExpiration = this.dateTimePicker_Backup_Expire.Value; this._backupTab_DisableComponents(); this.btn_Backup_Edit.IsEnabled = true; client.UpdateBackup(backup); client.Close(); } else { this.label_Backup_ExpireError.Visibility = Visibility.Visible; } } else { if (this.dataGrid_Backups.SelectedIndex >= 0) { this.IsBackupEditState = true; this.textBox_Backup_Name.IsEnabled = true; this.textBox_Backup_Description.IsEnabled = true; this.dateTimePicker_Backup_Expire.IsEnabled = true; } } }
private void btn_Template_Edit_Click(object sender, RoutedEventArgs e) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); if (this.TemplateMode == TemplateInputModes.Add) { Client c = this.listBox_Clients.SelectedItem as Client; BackupTemplate template = new BackupTemplate(); template.IDClient = c.ID; template.Name = this.textBox_Template_Name.Text; template.Description = this.textBox_Template_Description.Text; template.BackupType = this._template_GetTemplateType(); template.Compression = this.radioBtn_Template_Compress.IsChecked == true ? true: false; List <BackupTemplatePath> paths = new List <BackupTemplatePath>(); foreach (SourcePathInfo source in this._gridTemplateSourceList) { foreach (DestinationPathInfo dest in this._gridTemplateDestinationList) { paths.Add(new BackupTemplatePath() { Source = source.Value, Destination = dest.Value, PathOrder = Convert.ToInt16(paths.Count), TargetType = dest.TypeByte }); } } template.Paths = paths; if (this.checkBox_Template_SearchPattern.IsChecked == true) { template.SearchPattern = this.textBox_Template_SearchPattern.Text; } else { template.SearchPattern = ".*"; } template.CRONRepeatInterval = this.textBox_Template_CRON.Text; if (this.dateTimePicker_Template_Expire.Value != null) { template.DaysToExpiration = (uint?)((DateTime)this.dateTimePicker_Template_Expire.Value - DateTime.Now).Days; } template.IsNotificationEnabled = this.radioBtn_Template_NotifEnable.IsChecked == true ? true :false; template.IsEmailNotificationEnabled = this.checkBox_Template_EmailReport.IsChecked == true ? true : false; client.SaveTemplate(template); this._templateTab_DisableComponents(); this.TemplateMode = TemplateInputModes.None; this.TemplatesLoaded = false; this.LoadTemplatesData(c); this.dataGrid_Templates.SelectedIndex = this.dataGrid_Templates.Items.Count - 1; } else if (this.TemplateMode == TemplateInputModes.Edit) { BackupTemplate template = this.dataGrid_Templates.SelectedItem as BackupTemplate; template.Name = this.textBox_Template_Name.Text; template.Description = this.textBox_Template_Description.Text; template.BackupType = this._template_GetTemplateType(); template.Compression = this.radioBtn_Template_Compress.IsChecked == true ? true : false; //TODO: Maybe rework? //List<BackupTemplatePath> paths = new List<BackupTemplatePath>(); //foreach (SourcePathInfo source in this._gridTemplateSourceList) //{ // foreach (DestinationPathInfo dest in this._gridTemplateDestinationList) // { // paths.Add(new BackupTemplatePath() // { // IDBackupTemplate = template.ID, // Source = source.Value, // Destination = dest.Value, // PathOrder = Convert.ToInt16(paths.Count), // TargetType = dest.TypeByte // }); // } //} //template.Paths = paths; if (this.checkBox_Template_SearchPattern.IsChecked == true) { template.SearchPattern = this.textBox_Template_SearchPattern.Text; } else { template.SearchPattern = "*"; } template.CRONRepeatInterval = this.textBox_Template_CRON.Text; if (this.dateTimePicker_Template_Expire.Value != null) { template.DaysToExpiration = (uint?)((DateTime)this.dateTimePicker_Template_Expire.Value - DateTime.Now).Days; } template.IsNotificationEnabled = this.radioBtn_Template_NotifEnable.IsChecked == true ? true : false; template.IsEmailNotificationEnabled = this.checkBox_Template_EmailReport.IsChecked == true ? true : false; client.SaveTemplate(template); this._templateTab_DisableComponents(); this.TemplateMode = TemplateInputModes.None; } else if (this.TemplateMode == TemplateInputModes.None) { this.TemplateMode = TemplateInputModes.Edit; this._templateTab_EnableComponents(); this.groupBox_Template_Path.IsEnabled = false; this.groupBox_Template_Type.IsEnabled = false; } client.Close(); }
private void _loadBackupInfo(BackupInfo b) { this._backupTab_DisableComponents(); if (b != null) { ESBackupServerAdminServiceClient client = new ESBackupServerAdminServiceClient(); this.textBox_Backup_Name.Text = b.Name; this.textBox_Backup_Description.Text = b.Description; this.textBox_Backup_Template.Text = client.GetTemplateByID(Convert.ToInt32(b.IDBackupTemplate)).Name; if (b.BaseBackupID != null) { this.textBox_Backup_BaseBackup.Text = client.GetBackupByID((long)b.BaseBackupID).Name; } if (b.Compressed) { this.radioBtn_Backup_Compress.IsChecked = true; } switch (b.BackupType) { case 0: this.radioBtn_Backup_Full.IsChecked = true; break; case 1: this.radioBtn_Backup_Diff.IsChecked = true; break; case 2: this.radioBtn_Backup_Increm.IsChecked = true; break; default: break; } this.textBox_Backup_Source.Text = b.Source; this.textBox_Backup_Dest.Text = b.Destination; if (b.UTCExpiration == null) { this.dateTimePicker_Backup_Expire.Watermark = "Expire date is not set."; this.dateTimePicker_Backup_Expire.Value = null; } else { this.dateTimePicker_Backup_Expire.Value = b.UTCExpiration; } this.dateTimePicker_Backup_Start.Value = b.UTCStart; if (b.UTCEnd == null) { this.dateTimePicker_Backup_End.Watermark = "End time is not set."; } else { this.dateTimePicker_Backup_End.Value = b.UTCEnd; } if (this.btn_Backup_Edit.IsEnabled == false) { this.btn_Backup_Edit.IsEnabled = true; } client.Close(); this.label_Backup_ExpireError.Visibility = Visibility.Hidden; } else { this._backupTab_SetDefaultValues(); } }