private void 备份ToolStripMenuItem_Click(object sender, EventArgs e) { // Hownet.BLL.BaseFile.sample s = new Hownet.BLL.BaseFile.sample(); // MessageBox.Show(s.CheckKey().ToString()); //string ss = Hownet.BLL.GetHDID.md5One(); //MessageBox.Show(ss); try { string str = Dir + @"\Backup\Task_backup_" + DateTime.Now.ToString("yyyyMMddhhmmss"); Hownet.BLL.SysTem bllST = new Hownet.BLL.SysTem(); bllST.Backup(str); MessageBox.Show("备份成功!"); } catch { MessageBox.Show("备份失败,请在SQL管理器中手工备份或联系软件客服。"); } //System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); //watch.Reset(); //watch.Start(); //Hownet.BLL.PermissionsUser bllMat = new Hownet.BLL.PermissionsUser(); //DataTable dt = bllMat.GetAllList().Tables[0]; //watch.Stop(); //MessageBox.Show(watch.ElapsedMilliseconds.ToString()); //Form fr = new frColumns(); //fr.ShowDialog(); }
public object Backup() { string Dir = Directory.GetCurrentDirectory() + @"\Backup\"; if (!Directory.Exists(Dir)) { Directory.CreateDirectory(Dir); } try { string str = Dir + @"Task_backup_" + DateTime.Now.ToString("yyyyMMddhhmmss"); Hownet.BLL.SysTem bllST = new Hownet.BLL.SysTem(); bllST.Backup(str); return(true); } catch { return(false); } }