protected void btyes_Click(object sender, EventArgs e) { labError.Text = ""; string strID = txtID.Text.Trim(); if (strID == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入用户名"; txtID.BackColor = Color.FromArgb((int)0xFFE1FF); txtID.Focus(); return; } else { txtID.BackColor = Color.White; } string errMsg = ""; if (!luyunfei.lyf_validate.isAZaz09_(strID, 5, 8, out errMsg)) { labError.Text = "用户名由5~8位的数字、英文字母或下划线组成!"; txtID.BackColor = Color.FromArgb((int)0xFFE1FF); txtID.Focus(); return; } else { txtID.BackColor = Color.White; } //bool isMatch = lyf_validate.isIDorPwd(strID); //if (!isMatch) //{ // labError.ForeColor = System.Drawing.Color.Red; // labError.Text = "输入的用户名格式不正确!用户ID只能包含字母、数字、下划线,且不能以数字开头,5~16位。"; // benfactorFrom.BackColor = Color.FromArgb((int)0xFFE1FF); // benfactorFrom.Focus(); // return; //} string strName = txtName.Text.Trim(); if (strName == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入姓名"; txtName.BackColor = Color.FromArgb((int)0xFFE1FF); txtName.Focus(); return; } else { txtName.BackColor = Color.White; } string strUserRole = ddlRole.SelectedValue.ToString(); if (ddlRole.SelectedValue == "请选择") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请选择权限"; return; } string strTEL = TEL.Text.Trim(); if (strTEL == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入联系方式"; TEL.BackColor = Color.FromArgb((int)0xFFE1FF); TEL.Focus(); return; } else { TEL.BackColor = Color.White; } string strPwd = txtPWD.Text.Trim(); if (strPwd == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入密码"; txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD2.BackColor = Color.White; txtPWD.Focus(); return; } else { txtPWD.BackColor = Color.White; } if (!luyunfei.lyf_validate.isAZaz09_(strPwd, 5, 20, out errMsg)) { labError.Text = "密码由5~20位的数字、英文字母或下划线组成!"; txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.Focus(); return; } else { txtPWD.BackColor = Color.White; } string strPwd2 = txtPWD2.Text.Trim(); if (strPwd2 == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请再次输入密码"; txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD2.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.Focus(); return; } else { txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; } if (strPwd != strPwd2) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "两次输入的密码不一致!"; txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD2.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.Focus(); return; } else { txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; } string strFrom = benfactorFrom.Text.Trim(); HybridDictionary hd = new HybridDictionary(); hd.Add(sPMS_CTG_ID, strID); // dtUsers = entityUsers.ExecuteDataTable2(CommandType.Text, "SelectById", hd); string sqldate = string.Format("select * from e_user where user='******'", strID); mysqlconn mys = new mysqlconn(); MySqlDataAdapter sda = new MySqlDataAdapter(sqldate, mys.getmysqlcon()); DataSet ds = MySqlHelper.ExecuteDataset(mys.getmysqlcon(), sqldate); DataView dv = new DataView(ds.Tables[0]); if (dv.Count > 0) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "该用户已存在!"; return; } try { //DataTable schemaMeter = entityUsers.GetSchema(); //DataRow dr = schemaMeter.NewRow(); //dr[sPMS_CTG_ID] = strID; //dr[sPMS_CTG_NAME] = strName; //dr[sUSE_IDT] = 0;//用户标记为未启用 //dr[sPwd] = strPwd; //dr[sDES] = ""; //dr[sCRT_DATE] = DateTime.Now; string sqldate1 = string.Format("insert into e_user(user,password,benfactorFrom,name,TEL,userRole) values('{0}','{1}','{2}','{3}','{4}',{5})", strID, strPwd, strFrom, strName, strTEL, strUserRole); // bool result = Convert.ToBoolean(entityUsers.Insert(dr)); int result1 = mys.getmysqlcom(sqldate1); if (result1 > 0) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "注册成功!"; // wl.WriteLogData(PAGE_NAME, "创建", strName, System.Diagnostics.EventLogEntryType.Information); NLogTest nlog = new NLogTest(); string sss = "管理员创建了新用户:" + strID + "(" + strName + ")"; nlog.WriteLog(Session["UserName"].ToString(), sss); } else { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "注册失败!"; // wl.WriteLogData(PAGE_NAME, "创建", strName, System.Diagnostics.EventLogEntryType.Warning); } } catch (Exception ex) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "添加记录失败" + ui.ExceptionMsg(ex); // wl.WriteLogData(PAGE_NAME, "创建", strName + ":" + ex.Message + ex.StackTrace, System.Diagnostics.EventLogEntryType.Error); } }
//public void databind() //{ // MySqlConnection mysqlcon = msq.getmysqlcon(); // DataSet ds = MySqlHelper.ExecuteDataset(mysqlcon, str111); // DataView dv = new DataView(ds.Tables[0]); // benfactorFrom.DataSource = dv; // benfactorFrom.DataTextField = "benfactorFrom"; // benfactorFrom.DataBind(); //} protected void submit_Click(object sender, EventArgs e) { labError.Text = ""; string strID = txtID.Text.Trim(); if (strID == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入用户名!"; txtID.BackColor = Color.FromArgb((int)0xFFE1FF); txtID.Focus(); return; } else { txtID.BackColor = Color.White; } string strName = txtName.Text.Trim(); if (strName == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入姓名!"; txtName.BackColor = Color.FromArgb((int)0xFFE1FF); txtName.Focus(); return; } else { txtName.BackColor = Color.White; } //string strFrom = benfactorFrom.Text.Trim(); string errMsg = ""; if (!luyunfei.lyf_validate.isAZaz09_Ch(strName, 1, 20, out errMsg)) { labError.Text = "输入的" + PAGE_NAME + "名称有误!" + errMsg; return; } string strTEL = TEL.Text.Trim(); if (strTEL == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入联系方式!"; TEL.BackColor = Color.FromArgb((int)0xFFE1FF); TEL.Focus(); return; } else { TEL.BackColor = Color.White; } string strPwdOld = txtPWDOld.Text.Trim(); if (strPwdOld == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入旧密码!"; txtPWDOld.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; txtPWDOld.Focus(); return; } else { txtPWDOld.BackColor = Color.White; } //if (!luyunfei.lyf_validate.isAZaz09_(strPwdOld, 5, 20, out errMsg)) //{ // labError.Text = "输入的旧密码有误!" + errMsg; // txtPWDOld.Focus(); // return; //} string strPwd = txtPWD.Text.Trim(); if (strPwd == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "请输入新密码!"; txtPWDOld.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD2.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWDOld.Focus(); return; } else { txtPWDOld.BackColor = Color.White; txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; } //string errMsg = ""; if (!luyunfei.lyf_validate.isAZaz09_(strPwd, 5, 20, out errMsg)) { labError.Text = "新密码由5~20位的数字、英文字母或下划线组成!"; txtPWDOld.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD2.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWDOld.Focus(); return; } else { txtPWDOld.BackColor = Color.White; txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; } string strPwd2 = txtPWD2.Text.Trim(); if (strPwd2 == "") { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "需要确认新密码!"; txtPWDOld.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD2.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWDOld.Focus(); return; } else { txtPWDOld.BackColor = Color.White; txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; } if (!luyunfei.lyf_validate.isAZaz09_(strPwd2, 5, 20, out errMsg)) { labError.Text = "再次输入的新密码有误!" + errMsg; return; } if (strPwd != strPwd2) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "两次输入的新密码不一致!"; txtPWDOld.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD2.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWDOld.Focus(); return; } else { txtPWDOld.BackColor = Color.White; txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; } //HybridDictionary hd = new HybridDictionary(); //hd.Add(sPMS_CTG_ID, strID); //tableUsers = entityUsers.ExecuteDataTable2(CommandType.Text, "SelectById", hd); //DataView dv = new DataView(tableUsers); mysqlconn msq = new mysqlconn(); string str = string.Format("select * from e_user where user='******'", strID); DataSet ds = MySqlHelper.ExecuteDataset(msq.getmysqlcon(), str); DataView dv = new DataView(ds.Tables[0]); txtName.Text = dv[0][sPMS_CTG_NAME].ToString(); if (dv.Count == 0) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "用户不存在!"; return; } string s = dv[0]["password"].ToString(); if (strPwdOld != s) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "输入的旧密码不正确!"; txtPWDOld.BackColor = Color.FromArgb((int)0xFFE1FF); txtPWD.BackColor = Color.White; txtPWD2.BackColor = Color.White; txtPWDOld.Focus(); return; } else { txtPWDOld.BackColor = Color.White; } try { HybridDictionary myHd = new HybridDictionary(); myHd.Add(sPMS_CTG_ID, strID); myHd.Add(sPMS_CTG_NAME, strName); myHd.Add(sPwd, strPwd); myHd.Add(sUPD_DATE, DateTime.Now); string str1 = string.Format("update e_user set name='{0}',password='******',TEL='{2}' where user='******'", strName, strPwd, strTEL, strID); int result = msq.getmysqlcom(str1); //bool result = Convert.ToBoolean(entityUsers.Update(myHd)); if (result > 0) { labError.ForeColor = System.Drawing.Color.Blue; labError.Text = "资料修改成功! 请牢记!"; // wl.WriteLogData(PAGE_NAME, "修改", strName, System.Diagnostics.EventLogEntryType.Information); NLogTest nlog = new NLogTest(); string sss = "修改了用户" + Session["UserName"].ToString() + "的信息"; nlog.WriteLog(Session["UserName"].ToString(), sss); } else { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "未找到对应记录,修改资料失败"; // wl.WriteLogData(PAGE_NAME, "修改", strName + "未找到对应记录,修改记录失败", System.Diagnostics.EventLogEntryType.Warning); } } catch (Exception ex) { labError.ForeColor = System.Drawing.Color.Red; labError.Text = "修改资料失败" + ui.ExceptionMsg(ex); // wl.WriteLogData(PAGE_NAME, "修改", strName + ":" + ex.Message + ex.StackTrace, System.Diagnostics.EventLogEntryType.Error); } loadBaseInf(); }
protected void Btinput_Click(object sender, EventArgs e) { string strbranchID = ""; //经办单位ID string strBenfactorType; //捐助人类型 string strTEL; //手机号 string strBenfactorID; //捐助人ID //string selectBranchID = "select handlingunitID from e_handlingunit where benfactorFrom='" + ddlBranch.Text.ToString() + "'"; //MySqlDataReader mysqlread1 = msq.getmysqlread(selectBranchID); //while (mysqlread1.Read()) switch (int.Parse(benfactorType.SelectedValue)) { case 1: if (benfactorName.Text.Trim() == "") { labError.Text = "公益组织名称不能为空!"; benfactorName.BackColor = Color.FromArgb((int)0xFFE1FF); benfactorName.Focus(); return; } else { benfactorName.BackColor = Color.White; } if (Contacts.Text.Trim() == "") { labError.Text = "联系人姓名不能为空!"; Contacts.BackColor = Color.FromArgb((int)0xFFE1FF); Contacts.Focus(); return; } else { Contacts.BackColor = Color.White; } if (Contacts.Text.Trim() == "") { labError.Text = "联系人姓名不能为空!"; Contacts.BackColor = Color.FromArgb((int)0xFFE1FF); Contacts.Focus(); return; } else { Contacts.BackColor = Color.White; } break; case 2: if (benfactorName.Text.Trim() == "") { labError.Text = "单位名称不能为空!"; benfactorName.BackColor = Color.FromArgb((int)0xFFE1FF); benfactorName.Focus(); return; } else { benfactorName.BackColor = Color.White; } break; case 3: if (benfactorName.Text.Trim() == "") { labError.Text = "姓名不能为空!"; benfactorName.BackColor = Color.FromArgb((int)0xFFE1FF); benfactorName.Focus(); return; } else { benfactorName.BackColor = Color.White; } break; case 4: if (benfactorName.Text.Trim() == "") { labError.Text = "募捐箱名称不能为空!"; benfactorName.BackColor = Color.FromArgb((int)0xFFE1FF); benfactorName.Focus(); return; } else { benfactorName.BackColor = Color.White; } break; case 5: if (benfactorName.Text.Trim() == "") { labError.Text = "冠名慈善捐助金名称不能为空!"; benfactorName.BackColor = Color.FromArgb((int)0xFFE1FF); benfactorName.Focus(); return; } else { benfactorName.BackColor = Color.White; } break; } //使用正则表达式验证11位手机号是由11位数字组成 Regex mobileReg = new Regex("^[0-9]{11,11}$"); if (TEL.Text.Trim() == "") { labError.Text = "请输入手机号"; TEL.BackColor = Color.FromArgb((int)0xFFE1FF); TEL.Focus(); return; } else if (TEL.Text.Trim().Length != 11) { labError.Text = "11位手机号位数不对"; TEL.BackColor = Color.FromArgb((int)0xFFE1FF); TEL.Focus(); return; } else if (mobileReg.IsMatch(TEL.Text.Trim())) { //验证通过 TEL.BackColor = Color.White; } else { labError.Text = "手机号由11位数字组成"; TEL.BackColor = Color.FromArgb((int)0xFFE1FF); TEL.Focus(); return; } strbranchID = ddlBranch.SelectedValue.ToString(); if (strbranchID == "") { labError.Text = "未找到该经办单位的ID!"; return; } strBenfactorType = benfactorType.SelectedValue; strTEL = TEL.Text.ToString(); strBenfactorID = strbranchID + strBenfactorType + strTEL; try { string strName = Regex.Replace(benfactorName.Text.ToString(), @"\s", ""); if (benfactorType.SelectedValue == "1") //公益组织 { string strgongyi = string.Format("insert into e_benfactor (benfactorID,benfactorName,handlingunitID,benfactorFrom,benfactorType,Contacts,TEL,email,remainMoney) values('{0}','{1}',{2},'{3}',{4},'{5}','{6}','{7}',{8})", strBenfactorID, strName, strbranchID, ddlBranch.SelectedItem.Text.ToString(), strBenfactorType, Contacts.Text.ToString(), strTEL, email.Text.ToString(), "0"); msq.getmysqlcom(strgongyi); if (rdbNaming.Checked) { string strUpdNaming = "update e_benfactor set naming=1,namingSelected='" + ddlNaming.SelectedItem.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdNaming); } if (rdbDirect.Checked) { string strUpdDirect = "update e_benfactor set direction=1,recipientsType='" + recipientsType.SelectedItem.Text.ToString() + "',recipientsDescription='" + description.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdDirect); } } if (benfactorType.SelectedValue == "2") //单位 { string strfaren = string.Format("insert into e_benfactor (benfactorID,benfactorName,handlingunitID,benfactorFrom,benfactorType,Contacts,TEL,email,remainMoney) values('{0}','{1}',{2},'{3}',{4},'{5}','{6}','{7}',{8})", strBenfactorID, strName, strbranchID, ddlBranch.SelectedItem.Text.ToString(), strBenfactorType, Contacts.Text.ToString(), strTEL, email.Text.ToString(), "0"); msq.getmysqlcom(strfaren); if (rdbNaming.Checked) { string strUpdNaming = "update e_benfactor set naming=1,namingSelected='" + ddlNaming.SelectedItem.Text.ToString() + "',recipientsDescription='" + description.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdNaming); } if (rdbDirect.Checked) { string strUpdDirect = "update e_benfactor set direction=1,recipientsType='" + recipientsType.SelectedItem.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdDirect); } } if (benfactorType.SelectedValue == "3") //个人 { string strziran = string.Format("insert into e_benfactor (benfactorID,benfactorName,handlingunitID,benfactorFrom,benfactorType,sex,TEL,email,remainMoney) values('{0}','{1}',{2},'{3}',{4},'{5}','{6}','{7}',{8})", strBenfactorID, strName, strbranchID, ddlBranch.SelectedItem.Text.ToString(), strBenfactorType, ddlSex.SelectedItem.Text.ToString(), strTEL, email.Text.ToString(), "0"); msq.getmysqlcom(strziran); if (rdbNaming.Checked) { string strUpdNaming = "update e_benfactor set naming=1,namingSelected='" + ddlNaming.SelectedItem.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdNaming); } if (rdbDirect.Checked) { string strUpdDirect = "update e_benfactor set direction=1,recipientsType='" + recipientsType.SelectedItem.Text.ToString() + "',recipientsDescription='" + description.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdDirect); } } if (benfactorType.SelectedValue == "4") //募捐箱 { string strmujuan = string.Format("insert into e_benfactor (benfactorID,benfactorName,handlingunitID,benfactorFrom,benfactorType,Contacts,TEL,email,moneyboxNo,remainMoney) values('{0}','{1}',{2},'{3}',{4},'{5}','{6}','{7}','{8}',{9})", strBenfactorID, strName, strbranchID, ddlBranch.SelectedItem.Text.ToString(), strBenfactorType, Contacts.Text.ToString(), strTEL, email.Text.ToString(), moneyboxNo.Text.ToString(), "0"); msq.getmysqlcom(strmujuan); if (rdbNaming.Checked) { string strUpdNaming = "update e_benfactor set naming=1,namingSelected='" + ddlNaming.SelectedItem.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdNaming); } if (rdbDirect.Checked) { string strUpdDirect = "update e_benfactor set direction=1,recipientsType='" + recipientsType.SelectedItem.Text.ToString() + "',recipientsDescription='" + description.Text.ToString() + "' where benfactorID='" + strBenfactorID + "'"; msq.getmysqlcom(strUpdDirect); } } if (benfactorType.SelectedValue == "5") //冠名捐助金 { string strgongyi = string.Format("insert into e_benfactor (benfactorID,benfactorName,handlingunitID,benfactorFrom,benfactorType,Contacts,TEL,email,namingAge,deadline,bftRange,bftRemark,remainMoney) values('{0}','{1}',{2},'{3}',{4},'{5}','{6}','{7}',{8},'{9}','{10}','{11}',{12})", strBenfactorID, strName, strbranchID, ddlBranch.SelectedItem.Text.ToString(), strBenfactorType, Contacts.Text.ToString(), strTEL, email.Text.ToString(), ddlAge.Text.ToString(), ViewState["deadline"].ToString(), txtRange.Text.ToString(), txtRemark.Text.ToString(), "0"); msq.getmysqlcom(strgongyi); if (ddlCycle.SelectedValue != "0") { string strRemind = string.Format("insert into e_remind (benfactorID,cycle,flag) values ('{0}',{1},{2})", strBenfactorID, ddlCycle.SelectedValue.ToString(), ddlAge.SelectedValue.ToString()); msq.getmysqlcom(strRemind); } } NLogTest nlog = new NLogTest(); string sss = "添加了捐赠人:" + strName; nlog.WriteLog(Session["UserName"].ToString(), sss); tbReset(); labError.Text = "添加成功!"; //loadPage(); //foreach (System.Web.UI.Control stl in this.Form.Controls) //{ // if (stl is System.Web.UI.WebControls.TextBox) // { // TextBox tb = (TextBox)stl; // tb.Text = ""; // } //} } catch { labError.Text = "添加失败,手机号重复!"; } }
protected void submit_Click(object sender, EventArgs e) { if (benfactorFrom.Text.Length <= 0) { LabelError.Text = "经办单位名称不能为空"; benfactorFrom.BackColor = Color.FromArgb((int)0xFFE1FF); benfactorFrom.Focus(); return; } else { benfactorFrom.BackColor = Color.White; } if (benfactorFrom.Text.Length > 0) {//判断是否重复 string sqldate = string.Format("select * from e_handlingunit where benfactorFrom='{0}'", benfactorFrom.Text.ToString()); mysqlconn mys = new mysqlconn(); MySqlDataAdapter sda = new MySqlDataAdapter(sqldate, mys.getmysqlcon()); DataSet ds = MySqlHelper.ExecuteDataset(mys.getmysqlcon(), sqldate); DataView dv = new DataView(ds.Tables[0]); if (dv.Count > 0) { //LabelError.ForeColor = System.Drawing.Color.Red; LabelError.Text = "该经办单位名称已存在!"; benfactorFrom.BackColor = Color.FromArgb((int)0xFFE1FF); benfactorFrom.Focus(); return; } } else { benfactorFrom.BackColor = Color.White; } if (address.Text.Length <= 0) { LabelError.Text = "经办单位地址不能为空!"; address.BackColor = Color.FromArgb((int)0xFFE1FF); address.Focus(); return; } else { address.BackColor = Color.White; } if (contactPerson.Text.Length <= 0) { LabelError.Text = "联系人不能为空!"; contactPerson.BackColor = Color.FromArgb((int)0xFFE1FF); contactPerson.Focus(); return; } else { contactPerson.BackColor = Color.White; } if (TEL.Text.Length <= 0) { LabelError.Text = "联系方式不能为空!"; TEL.BackColor = Color.FromArgb((int)0xFFE1FF); TEL.Focus(); return; } else { TEL.BackColor = Color.White; } if (TEL.Text.Length > 0 && contactPerson.Text.Length > 0 && address.Text.Length > 0 && benfactorFrom.Text.Length > 0) { string str11 = string.Format("insert into e_handlingunit (benfactorFrom,address,contactPerson,TEL) VALUES ('{0}','{1}','{2}','{3}')", benfactorFrom.Text, address.Text, contactPerson.Text, TEL.Text); int res = msq.getmysqlcom(str11); if (res > 0) { NLogTest nlog = new NLogTest(); string sss = "管理员增加了经办单位:" + benfactorFrom.Text.ToString(); nlog.WriteLog(Session["UserName"].ToString(), sss); LabelError.Text = "经办单位增加成功!"; TEL.Text = contactPerson.Text = address.Text = benfactorFrom.Text = ""; } else { LabelError.Text = "经办单位增加失败!"; } } }