/// <summary>
        /// Creates a backup of the database specified in the job details.
        /// </summary>
        /// <param name="context">The execution context.</param>
        public void Execute(IJobExecutionContext context)
        {
            Guid databaseId;

            if (Guid.TryParse(context.JobDetail.JobDataMap.GetString(CreateBackupJob.Properties.DatabaseId.ToString()), out databaseId))
            {
                BackupHandler backupHandler = new BackupHandler();
                try
                {
                    backupHandler.CreateBackup(databaseId);
                }
                catch (Exception ex)
                {
                    new LogHandler().LogMessage(LogHandler.MessageType.ERROR, "Job: " + context.JobDetail.Key + Environment.NewLine + ex.ToString());
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Handles the Click event of the MakeManualBackupButton control: Creates a manual backup of the selected database.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void MakeManualBackupButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BackupHandler backupHandler = new BackupHandler();
         if (backupHandler.CreateBackup(CurrentDbInfo.ID))
         {
             FirstFloor.ModernUI.Windows.Controls.ModernDialog.ShowMessage(string.Format("A backup of the database {0} has been created!", CurrentDbInfo.DatabaseName), "Success", MessageBoxButton.OK);
         }
         else
         {
             FirstFloor.ModernUI.Windows.Controls.ModernDialog.ShowMessage(string.Format("The backup of database {0} failed. Please check the log for details", CurrentDbInfo.DatabaseName), "Error", MessageBoxButton.OK);
         }
     }
     catch (Exception ex)
     {
         FirstFloor.ModernUI.Windows.Controls.ModernDialog.ShowMessage(ex.ToString(), "Error", MessageBoxButton.OK);
     }
 }