public bool UpdateClientOper(CMSMStruct.ClientOperStruct copernew, CMSMStruct.ClientOperStruct coperold) { string sqlset = ""; if (copernew.strOperName != coperold.strOperName) { sqlset += "vcOperName='" + copernew.strOperName + "',"; } if (copernew.strLimit != coperold.strLimit) { sqlset += "vcLimit='" + copernew.strLimit + "',"; } if (copernew.strDeptID != coperold.strDeptID) { sqlset += "vcDeptID='" + copernew.strDeptID + "',"; } if (sqlset != "") { sqlset = sqlset.Substring(0, sqlset.Length - 1); int recount = opa.UpdateClientOper(coperold.strOperID, sqlset); if (recount <= 0) { return(false); } } return(true); }
private void btAdd_Click(object sender, System.EventArgs e) { CMSMStruct.ClientOperStruct copernew = new CMSMStruct.ClientOperStruct(); copernew.strDeptID = ddlDept.SelectedValue; if (txtOperID.Text.Trim() == "") { this.SetErrorMsgPageBydirHistory("客户端操作员编号不能为空!"); return; } else if (txtOperID.Text.Trim() == "admin" || txtOperID.Text.Trim() == "系统管理员") { this.SetErrorMsgPageBydirHistory("admin或系统管理员为关键词,不允许添加此类操作员!"); return; } else if (m1.ChkClientOperIDDup(txtOperID.Text.Trim())) { copernew.strOperID = txtOperID.Text.Trim(); } else { this.SetErrorMsgPageBydirHistory("该客户端操作员编号已经存在,请重新输入!"); return; } if (txtOperName.Text.Trim() == "") { this.SetErrorMsgPageBydirHistory("客户端操作员名称不能为空!"); return; } else if (txtOperName.Text.Trim() == "admin" || txtOperName.Text.Trim() == "系统管理员") { this.SetErrorMsgPageBydirHistory("admin或系统管理员为关键词,不允许添加此类操作员!"); return; } else if (m1.ChkClientOperNameDup(copernew.strOperID, txtOperName.Text.Trim(), copernew.strDeptID)) { copernew.strOperName = txtOperName.Text.Trim(); } else { this.SetErrorMsgPageBydirHistory("该客户端操作员名称已经存在,请重新输入!"); return; } copernew.strLimit = this.ddlLimit.SelectedValue; if (!m1.InsertClientOper(copernew)) { this.SetErrorMsgPageBydir("添加客户端操作员失败,请重试!"); return; } else { this.SetSuccMsgPageBydir("添加客户端操作员成功!", ""); return; } }
public bool InsertClientOper(CMSMStruct.ClientOperStruct copernew) { int recount = opa.InsertClientOper(copernew); if (recount <= 0) { return(false); } return(true); }
public int InsertClientOper(CMSMStruct.ClientOperStruct copernew) { string sql1 = "insert into tbOper values('" + copernew.strOperID + "','" + copernew.strOperName + "','" + copernew.strLimit + "','000000','" + copernew.strDeptID + "','1','0')"; int recount = SqlHelper.ExecuteNonQuery(con, CommandType.Text, sql1); if (con.State == ConnectionState.Open) { con.Close(); } return(recount); }
private void btMod_Click(object sender, System.EventArgs e) { CMSMStruct.ClientOperStruct coperold = (CMSMStruct.ClientOperStruct)Session["coperold"]; if (coperold.strOperID != txtOperID.Text.Trim()) { this.SetErrorMsgPageBydir("保存失败,请重试!"); return; } CMSMStruct.ClientOperStruct copernew = new CMSMStruct.ClientOperStruct(); copernew.strDeptID = ddlDept.SelectedValue; copernew.strOperID = coperold.strOperID; copernew.strOperName = txtOperName.Text.Trim(); if (copernew.strOperName == "") { this.SetErrorMsgPageBydirHistory("客户端操作员名称不能为空!"); return; } else if (copernew.strOperName == "admin" || copernew.strOperName == "系统管理员") { this.SetErrorMsgPageBydirHistory("admin或系统管理员为关键词,不允许添加此类操作员!"); return; } else if (!m1.ChkClientOperNameDup(coperold.strOperID, copernew.strOperName, copernew.strDeptID)) { this.SetErrorMsgPageBydirHistory("该客户端操作员名称已经存在,请重新输入!"); return; } copernew.strLimit = this.ddlLimit.SelectedValue; if (!m1.UpdateClientOper(copernew, coperold)) { this.SetErrorMsgPageBydir("修改客户端操作员失败,请重试!"); return; } else { this.SetSuccMsgPageBydir("修改客户端操作员成功!", "paraconf/wfmDeptOperManage.aspx"); return; } }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (Session["Login"] != null) { Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; m1 = new Manager(strcons); CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"]; string strid = Request.QueryString["id"]; if (!IsPostBack) { Session.Remove("coperold"); Session.Remove("copernew"); this.FillDropDownList("AllMD", ddlDept, "vcCommSign='MD' and vcCommCode not in('CEN00','FYZX1')"); if (ls1.strDeptID != "CEN00" && ls1.strDeptID != "FYZX1") { ddlDept.Items.FindByValue(ls1.strDeptID).Selected = true; ddlDept.Enabled = false; } this.FillDropDownList("tbCommCode", ddlLimit, "vcCommSign='LM'"); if (strid == "" || strid == null) { this.btAdd.Enabled = true; this.btPwdBegin.Enabled = false; this.btMod.Enabled = false; this.btnFreeze.Enabled = false; lbltitle.Text = "新客户端操作员录入"; } else { this.btAdd.Enabled = false; CMSMStruct.ClientOperStruct coperold = m1.GetClientOperInfo(strid); this.txtOperID.Text = coperold.strOperID; this.txtOperName.Text = coperold.strOperName; ddlLimit.Items.FindByValue(coperold.strLimit).Selected = true; if (coperold.strDeptID == "*") { ddlDept.Items.Clear(); ddlDept.Items.Add("所有门店"); ddlDept.Enabled = false; this.btPwdBegin.Enabled = false; this.txtOperName.Enabled = false; this.ddlLimit.Enabled = false; this.btMod.Enabled = false; } else { ddlDept.Items.FindByValue(coperold.strDeptID).Selected = true; } if (ls1.strLimit != "CL001") { ddlLimit.Enabled = false; ddlDept.Enabled = false; } if (coperold.strActiveFlag != "1") { this.btnFreeze.Enabled = false; this.btMod.Enabled = false; this.btPwdBegin.Enabled = false; this.txtOperName.Enabled = false; this.ddlDept.Enabled = false; this.ddlLimit.Enabled = false; } lbltitle.Text = "客户端操作员修改"; txtOperID.Enabled = false; Session["coperold"] = coperold; } } } else { Response.Redirect("../Exit.aspx"); } }