BKI_DichVuMatDat.HeThong.frm_backup_restore.BackupDataBase C# (CSharp) Method

BackupDataBase() private method

private BackupDataBase ( string databaseName ) : void
databaseName string
return void
        private void BackupDataBase(string databaseName)
        {
            SplashScreenManager.ShowForm(typeof(F_wait_form));
            var destinationPath = "HRM_PVMD_v" + DateTime.Now.Year + "." + DateTime.Now.Month + "." + DateTime.Now.Day + "." + DateTime.Now.Hour + "h." + DateTime.Now.Minute + "p.bak";
            Server myServer = GetServer();
            Backup backup = new Backup();
            backup.Action = BackupActionType.Database;
            backup.Database = databaseName;
            // destinationPath = System.IO.Path.Combine(destinationPath, databaseName);
            backup.Devices.Add(new BackupDeviceItem(destinationPath, DeviceType.File));
            backup.Initialize = true;
            backup.Checksum = true;
            backup.ContinueAfterError = true;
            backup.Incremental = false;
            backup.LogTruncation = BackupTruncateLogType.Truncate;
            // Perform backup.
            US_HT_BACKUP_HISTORY v_us = new US_HT_BACKUP_HISTORY();
            try
            {
                v_us.strNGUOI_BACKUP = CAppContext_201.getCurrentUserName();
                v_us.datNGAY_BACKUP = DateTime.Now.Date;
                v_us.strNOI_LUU = destinationPath;
                v_us.Insert();
                backup.SqlBackup(myServer);
            }
            catch(Exception)
            {
                throw;
            }
            finally
            {
                SplashScreenManager.CloseForm();
            }
            XtraMessageBox.Show("Sao lưu File : " + destinationPath + " thành công!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }