protected void btnCommit_Click(object sender, EventArgs e) { if (GridViewDBBackupList.SelectedIndex == -1) { ScriptManager.RegisterClientScriptBlock(this.Page, GetType(), "", "alert(\"没有选择要恢复的备份!\");", true); } else { DataTable dt = common.getDataTable("select * from prodoc_jc_dbbackuprestore where id=" + GridViewDBBackupList.SelectedDataKey["id"].ToString()); if (dt != null && dt.Rows.Count > 0) { string filePath = @"" + System.Configuration.ConfigurationManager.AppSettings["dbbackuppath"].ToString(); string fileName = dt.Rows[0]["fileName"].ToString(); if (File.Exists(filePath + "\\" + fileName))//d:\dbbackup\db.sql")) { string str = common.CallExe(@"mysql -uroot -p" + System.Configuration.ConfigurationManager.AppSettings["mysqlrootpwd"].ToString() + " " + System.Configuration.ConfigurationManager.AppSettings["mysqldbname"].ToString() + "<" + filePath + "\\" + fileName);//d:\dbbackup\db.sql"); if (str.Equals("OK")) { ScriptManager.RegisterClientScriptBlock(this.Page, GetType(), "", "alert(\"还原成功!\");closeBackupList();", true);// common.popUpMessage(this.Page, ); string sql = string.Empty; sql = "insert into prodoc_jc_dbbackuprestore(type,filePath,fileName,autoORmanu"; if (Session["userRealName"] != null) sql += ",createPerson"; sql += ")"; sql += " values(1,'" + filePath + "','" + fileName + "',1"; if (Session["userRealName"] != null) sql += ",'" + Session["userRealName"].ToString() + "'"; sql += ")"; common.executeNoQuery(sql); bindData(); bindDataForBackupList(); } } else //common.popUpMessage(this.Page, "没有找到备份文件!"); ScriptManager.RegisterClientScriptBlock(this.Page, GetType(), "", "alert(\"没有找到备份文件!\");", true); } } } #region backup button ??? protected void btnBackup_Click(object sender, EventArgs e) ??? { ??????? if (Session.Count == 0) ??????? { ??????????? common.execJavaScript(this.Page, "window.top.location.href='../login.aspx';"); ??????????? return; ??????? } ??????? string filePath = string.Empty; ??????? filePath = @"" + System.Configuration.ConfigurationManager.AppSettings["dbbackuppath"].ToString(); ??????? if (!Directory.Exists(filePath)) ??????????? common.CallExe(@"mkdir " + filePath); ??????? string fileName = "dbbackup" + System.DateTime.Today.ToString("yyyyMMdd") + System.DateTime.Now.ToLongTimeString().Replace(":", "") + ".sql"; ??????? string str = common.CallExe(@"mysqldump -uroot -p" + System.Configuration.ConfigurationManager.AppSettings["mysqlrootpwd"].ToString() + " " + System.Configuration.ConfigurationManager.AppSettings["mysqldbname"].ToString() + " --ignore-table=" + System.Configuration.ConfigurationManager.AppSettings["mysqldbname"].ToString() + ".prodoc_jc_dbbackuprestore>" + filePath + "\\" + fileName); ??????? if (str.Equals("OK")) ??????? { ??????????? ScriptManager.RegisterClientScriptBlock(this.Page, GetType(), "", "alert(\"备份成功!\");closeBackupList();", true); ??????????? string sql = string.Empty; ??????????? sql = "insert into prodoc_jc_dbbackuprestore(filePath,fileName,autoORmanu"; ??????????? if (Session["userRealName"] != null) ??????????????? sql += ",createPerson"; ??????????? sql += ")"; ??????????? sql += " values('" + filePath + "','" + fileName + "',1"; ??????????? if (Session["userRealName"] != null)