Esempio n. 1
0
 void UCAutoBackupSet_DownLoadEvent(object sender, EventArgs e)
 {
     frmBackupRecord frm = new frmBackupRecord();
     frm.IsSelected = false;
     frm.IsAutoBackupType = true;
     frm.Text = "备份记录";
     frm.ShowDialog();
 }
Esempio n. 2
0
 /// <summary> 还原
 /// </summary>
 void UCAcountSet_RestoreEvent(object sender, EventArgs e)
 {
     if (dgvAccList.CurrentRow == null)
     {
         MessageBoxEx.Show("请选择记录!");
         return;
     }
     string accCode = dgvAccList.CurrentRow.Cells["setbook_code"].Value.ToString();
     string msg = string.Format("将要还原当前选中帐套{0}({1}),还原前请备份,是否继续?", dgvAccList.CurrentRow.Cells["setbook_name"].Value.ToString(), accCode);
     DialogResult result = MessageBoxEx.Show(msg, "系统提示", MessageBoxButtons.YesNo);
     if (result == DialogResult.Yes)
     {
         frmBackupRecord frm = new frmBackupRecord();
         frm.IsSelected = true;
         frm.Acc_Code = accCode;
         frm.Acc_Name = dgvAccList.CurrentRow.Cells["setbook_name"].Value.ToString();
         if (frm.ShowDialog() == DialogResult.OK)
         {
             string errMsg = CommonUtility.RestoreDb(accCode, frm.FileName);
             if (!string.IsNullOrEmpty(errMsg))
             {
                 MessageBoxEx.ShowWarning(errMsg);
                 return;
             }
             MessageBoxEx.ShowInformation("还原成功");
         }
     }
 }
Esempio n. 3
0
 /// <summary> 还原
 /// </summary>
 void UCAcountSet_RestoreEvent(object sender, EventArgs e)
 {
     if (dgvAccList.CurrentRow == null)
     {
         MessageBoxEx.Show("请选择记录!");
         return;
     }
     try
     {
         string accCode = dgvAccList.CurrentRow.Cells["setbook_code"].Value.ToString();
         string msg = string.Format("将要还原当前选中帐套{0}({1}),还原前请备份,是否继续?", dgvAccList.CurrentRow.Cells["setbook_name"].Value.ToString(), accCode);
         DialogResult result = MessageBoxEx.Show(msg, "系统提示", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             frmBackupRecord frm = new frmBackupRecord();
             frm.IsSelected = true;
             frm.Acc_Code = accCode;
             frm.Acc_Name = dgvAccList.CurrentRow.Cells["setbook_name"].Value.ToString();
             if (frm.ShowDialog() == DialogResult.OK)
             {
                 ProcessOperator process = new ProcessOperator();
                 #region 匿名方法,后台线程执行调用
                 process.BackgroundWork = delegate()
                 {
                     string errMsg = CommonUtility.RestoreDb(accCode, frm.FileName);
                     if (!string.IsNullOrEmpty(errMsg))
                     {
                         throw new Exception(errMsg);
                     }
                 };
                 #endregion
                 process.MessageInfo = "正在执行中...";
                 #region 匿名方法,后台线程执行完调用
                 process.BackgroundWorkerCompleted += new EventHandler<BackgroundWorkerEventArgs>(
                         delegate(object osender, BackgroundWorkerEventArgs be)
                         {
                             if (be.BackGroundException == null)
                             {
                                 MessageBoxEx.ShowInformation("还原成功!");
                             }
                             else
                             {
                                 GlobalStaticObj_Server.GlobalLogService.WriteLog("账套设置", be.BackGroundException);
                                 MessageBoxEx.ShowWarning("还原失败!");
                             }
                         }
                     );
                 #endregion
                 process.Start();
             }
         }
     }
     catch (Exception ex)
     {
         GlobalStaticObj_Server.GlobalLogService.WriteLog("帐套设置", ex);
         MessageBoxEx.ShowWarning("程序异常");
     }
 }