Ejemplo n.º 1
0
 private void btnRestore_Click(object sender, EventArgs e)
 {
     this.Cursor = Cursors.WaitCursor;
     Utils.CS.BackupRestore bk = new Utils.CS.BackupRestore();
     bk.Server      = DAL.SqlHelper.IPAddress;
     bk.UID         = DAL.SqlHelper.UserID;
     bk.PWD         = DAL.SqlHelper.Password;
     bk.Database    = DAL.SqlHelper.DatabaseName;
     bk.RestoreFile = txtPath.Text;
     bk.Bar         = progressBar;
     MessageBox.Show(bk.DbRestore(), "Restore", MessageBoxButtons.OK, MessageBoxIcon.Information);
     lbProgress.Text = bk.Bar.Value.ToString() + "%";
     this.Cursor     = Cursors.Default;
 }
Ejemplo n.º 2
0
        private void btnBackUp_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            Utils.CS.BackupRestore bk = new Utils.CS.BackupRestore();
            bk.Server   = DAL.SqlHelper.IPAddress;
            bk.UID      = DAL.SqlHelper.UserID;
            bk.PWD      = DAL.SqlHelper.Password;
            bk.Database = DAL.SqlHelper.DatabaseName;
            bk.BackPath = txtPath.Text;
            bk.Bar      = progressBar;
            bk.DbBackup();
            if (progressBar.Value == 100)
            {
                btnBackUp.Enabled = false;
                lbProgress.Text   = bk.Bar.Value.ToString() + "%";
                MessageBox.Show("The Database Was Backup Successfully", "Backup", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("The Database Failed Backup", "Backup", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Cursor = Cursors.Default;
        }