private void GetLastBackup() { try { PostgresqlUtil pg = new PostgresqlUtil() { PathOutputSqlPrimary = Paths.backups }; DateTime dt = pg.GetLastBackup(); tfDateLastBackup.EditValue = String.Format("{0:dd/MM/yyyy} ás {0:HH:mm:ss}", dt); } catch (Exception ex) { tfDateLastBackup.EditValue = "Não foi possivel obter o ultimo backup criado! / " + ex.Message; } }
private void btnBackup_ItemClick(object sender, ItemClickEventArgs e) { if (String.IsNullOrEmpty(Paths.PathBackupFile) || String.IsNullOrEmpty(Paths.PathPG)) { XtraMessageBox.Show("Existem configurações inclompetas, verifique!"); btnConfigBackup_ItemClick(sender, e); return; } DialogResult rs = XtraMessageBox.Show("Para realizar Backup todos os outros usuários serão desconectados!" + "\nDeseja continuar?", "", MessageBoxButtons.YesNo); if (rs == DialogResult.No) { return; } SplashScreenManager.ShowForm(this, typeof(PleaseWaitForm), false, false, false); PostgresqlUtil pu = new PostgresqlUtil() { CurrentDateTime = user.Now(), PrefixNameFile = "TruckSystem_2.0", Host = ConnectionUtil.Host, Port = ConnectionUtil.Port, User = ConnectionUtil.User, Password = ConnectionUtil.Password, Database = ConnectionUtil.DataBase, PathOutputSqlPrimary = Paths.backups, PathOutputSqlBackup = Paths.PathBackupFile, PathPG = Paths.PathPG }; Thread.Sleep(200); bool flag = pu.StartBackup(); Thread.Sleep(1000); SplashScreenManager.CloseForm(false); if (flag) { XtraMessageBox.Show("Backup realizado com sucesso!"); } }
private void btnBackup_ItemClick(object sender, ItemClickEventArgs e) { if(String.IsNullOrEmpty(Paths.PathBackupFile) || String.IsNullOrEmpty(Paths.PathPG)) { XtraMessageBox.Show("Existem configurações inclompetas, verifique!"); btnConfigBackup_ItemClick(sender, e); return; } DialogResult rs = XtraMessageBox.Show("Para realizar Backup todos os outros usuários serão desconectados!" + "\nDeseja continuar?", "", MessageBoxButtons.YesNo); if (rs == DialogResult.No) return; SplashScreenManager.ShowForm(this, typeof(PleaseWaitForm), false, false, false); PostgresqlUtil pu = new PostgresqlUtil() { CurrentDateTime = user.Now(), PrefixNameFile = "TruckSystem2.0", Host = ConnectionUtil.Host, Port = ConnectionUtil.Port, User = ConnectionUtil.User, Password = ConnectionUtil.Password, Database = ConnectionUtil.DataBase, PathOutputSqlPrimary = Paths.backups, PathOutputSqlBackup = Paths.PathBackupFile, PathPG = Paths.PathPG }; Thread.Sleep(1800); bool flag = pu.StartBackup(); Thread.Sleep(1500); SplashScreenManager.CloseForm(false); if (flag) XtraMessageBox.Show("Backup realizado com sucesso!"); }