private void btnOperName_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //修改用户名称 Oper oper = (Oper)Session[ConstValue.LOGIN_USER_SESSION]; try { oper.cnvcOperName = txtOperName.Text; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改操作员名称:" + oper.cnvcOperName; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); CommonStatic.LoadOperDictionary(); Session[ConstValue.LOGIN_USER_SESSION] = oper; Popup("用户名称已修改!"); } catch (BusinessException bex) { Popup(bex.Message); return; } }
private void btnLogin_Click(object sender, System.Web.UI.ImageClickEventArgs e) { try { //调用业务规则 ArrayList lstPurview = null; ArrayList lstPage = null; Oper operLogin = OperFacade.OperLogin(tbxAdminUser.Text.Trim(), tbxAdminPass.Text, Request.UserHostAddress, Request.Browser.Browser, out lstPurview, out lstPage); //将用户信息保存到Session变量 Session[ConstValue.LOGIN_USER_SESSION] = operLogin; //将用户菜单权限保存到Session变量 Session[ConstValue.LOGIN_USER_PURVIEW_SESSION] = lstPurview; //将用户页面权限保存到Session变量 Session[ConstValue.LOGIN_USER_PAGE_SESSION] = lstPage; tblInput.Visible = false; // 置用户信息输入框为不可见 //tblAvi.Visible = true; // 置登录成功动画为可见,在登录成功动画的最后一帧将页面导航至Main.aspx this.Response.Redirect("main.aspx"); } catch (BusinessException be) { string strScript = "<script language='javascript'>"; strScript += "alert('" + be.Message + "');"; strScript += "</script>"; Response.Write(strScript); } }
bool UpdateOper() { if (txtOperName.Text.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入操作员姓名"; return(false); } try { DataTable dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnvcOperName = '" + this.txtOperName.Text + "'"); if (dtCount.Rows.Count > 1) { throw new Exception("同名操作员已存在,请修改操作员名称!"); } dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnnOperID = " + this.txtOperID.Text); if (dtCount.Rows.Count == 0) { throw new Exception("操作员信息获取错误!"); } Oper oper = new Oper(dtCount); //oper.cnnOperID = int.Parse(this.txtOperID.Text); oper.cnvcOperName = this.txtOperName.Text; oper.cnbValidate = this.chkValidate.Checked; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改操作员名称:" + this.txtOperName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; return(false); } alertControl.Enable = true; alertControl.Action = AlertControl.ACTION.Script; alertControl.Msg = "成功更新操作员属性"; alertControl.Script = string.Format("window.parent.OnChangeNodeResult('{0}','{1}');", "oper_" + txtOperID.Text, txtOperName.Text); return(true); }
bool UpdatePwd() { if (txtPwd.Value.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入操作员初始化密码"; return(false); } if (!txtPwd.Value.Equals(txtConfirmPwd.Value)) { alertControl.Enable = true; alertControl.Msg = "密码和确认密码不同,请重新输入"; return(false); } try { // dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnnOperID = "+this.txtOperID.Text); // if(dtCount.Rows.Count == 0 ) throw new Exception("操作员信息获取错误!"); // Oper oper = new Oper(dtCount); Oper oper = new Oper(); oper.cnnOperID = int.Parse(this.txtOperID.Text); oper.cnvcPwd = DataSecurity.Encrypt(this.txtPwd.Value); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改密码:" + this.txtOperName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; return(false); } alertControl.Enable = true; alertControl.Action = AlertControl.ACTION.Script; alertControl.Msg = "成功更新操作员密码"; alertControl.Script = string.Format("window.parent.OnChangeNodeResult('{0}','{1}');", "oper_" + txtOperID.Text, txtOperName.Text); return(true); }
// private void BindDept(DropDownList ddl) // { // DataTable dtDept = DeptFacade.GetAllDept(); // ddl.DataSource = dtDept; // ddl.DataTextField = "cnvcDeptName"; // ddl.DataValueField = "cnvcDeptID"; // ddl.DataBind(); // ListItem li = new ListItem("所有","%"); // ddl.Items.Insert(0,li); // } private void rblOper_SelectedIndexChanged(object sender, System.EventArgs e) { try { //更新功能类别 //清楚已选择的功能 foreach (ListItem liFunctionList in this.cblFunctionList.Items) { if (liFunctionList.Selected) { liFunctionList.Selected = false; } } foreach (ListItem liFunctionList in this.cblCSFunctionList.Items) { if (liFunctionList.Selected) { liFunctionList.Selected = false; } } //选择的操作员 string strOperID = this.rblOper.SelectedValue; //查询某操作员已具有的功能 DataTable dtOperFunc = OperFacade.GetOneOperFuncList(strOperID); foreach (ListItem liFunctionList in this.cblFunctionList.Items) { foreach (DataRow drOperFunc in dtOperFunc.Rows) { if (drOperFunc["cnvcFuncName"].ToString().Equals(liFunctionList.Text)) { liFunctionList.Selected = true; } } } foreach (ListItem liFunctionList in this.cblCSFunctionList.Items) { foreach (DataRow drOperFunc in dtOperFunc.Rows) { if (drOperFunc["cnvcFuncName"].ToString().Equals(liFunctionList.Text)) { liFunctionList.Selected = true; } } } } catch (BusinessException bex) { Popup(bex.Message); } }
private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //确定修改密码 try { if (txtOldPwd.Text.Length == 0 || txtNewPwd.Text.Length == 0 || txtConfirmPwd.Text.Length == 0) { throw new BusinessException("UpdatePwd", "不能为空!"); } if (txtOldPwd.Text.Equals(txtNewPwd.Text)) { throw new BusinessException("UpdatePwd", "新老密码一样!"); } if (!txtNewPwd.Text.Equals(txtConfirmPwd.Text)) { throw new BusinessException("UpdatePwd", "确认密码和新密码不一致!"); } if (Session[ConstValue.LOGIN_USER_SESSION] == null) { throw new BusinessException("UpdatePwd", "请先登录!"); } Oper oper = (Oper)Session[ConstValue.LOGIN_USER_SESSION]; if (!txtOldPwd.Text.Equals(DataSecurity.Decrypt(oper.cnvcPwd))) { throw new BusinessException("UpdatePwd", "输入的旧密码错误!"); } oper.cnvcPwd = DataSecurity.Encrypt(txtNewPwd.Text); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改密码:" + oper.cnvcOperName; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); Session[ConstValue.LOGIN_USER_SESSION] = oper; Popup("密码修改成功!"); } catch (Exception ex) { Popup(ex.Message); } }
void LoadOper() { Oper getOper = new Oper(); getOper.cnnOperID = int.Parse(txtOperID.Text); OperFacade.GetOper(getOper); Oper oper = OperFacade.GetOper(getOper); if (oper != null) { hidDept.Value = oper.cnvcDeptID; txtOperName.Text = oper.cnvcOperName; chkValidate.Checked = oper.cnbValidate; } }
/// <summary> /// 加载操作人员字典 /// </summary> public static void LoadOperDictionary() { Hashtable lstOper = new Hashtable(); DataTable tblOper = OperFacade.GetAllOper(); foreach (DataRow row in tblOper.Rows) { Oper objOper = new Oper(row); if (null == lstOper[objOper.cnnOperID]) { lstOper.Add(objOper.cnnOperID, objOper); } } HttpContext.Current.Application[ConstValue.OPER_DICTI_NAME] = lstOper; }
private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //添加用户 try { if (txtOperID.Text.Length == 0 || txtOperName.Text.Length == 0) { throw new BusinessException("AddOper", "不能为空!"); } if (GetLength(txtOperID.Text) > 8) { throw new BusinessException("", "操作员ID过长!"); } if (GetLength(txtOperName.Text) > 20) { throw new BusinessException("", "操作员姓名过长!"); } Oper oper = new Oper(); oper.cnvcOperName = txtOperID.Text; Oper oldOper = OperFacade.GetOper(oper); if (oldOper == null) { oper.cnvcOperName = txtOperName.Text; oper.cnvcPwd = "666666"; //OperFacade.AddOper(oper); Popup("新建用户成功!"); } else { Popup("用户已存在!"); } CommonStatic.LoadOperDictionary(); } catch (BusinessException bex) { Popup(bex.Message); } }
bool AddOper() { int iRet = 0; if (txtOperName.Text.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入操作员姓名"; return(false); } if (txtPwd.Value.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入操作员初始化密码"; return(false); } if (!txtPwd.Value.Equals(txtConfirmPwd.Value)) { alertControl.Enable = true; alertControl.Msg = "密码和确认密码不同,请重新输入"; return(false); } try { DataTable dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnvcOperName = '" + this.txtOperName.Text + "'"); if (dtCount.Rows.Count > 0) { throw new Exception("同名操作员已存在,请添加新操作员!"); } Oper oper = new Oper(); oper.cnvcDeptID = this.hidDept.Value; oper.cnvcOperName = this.txtOperName.Text; oper.cnvcPwd = this.txtPwd.Value; oper.cnbValidate = this.chkValidate.Checked; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "添加操作员:" + this.txtOperName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS005"; busiLog.cnvcSource = "网站"; iRet = OperFacade.AddOper(oper, busiLog); } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; return(false); } alertControl.Action = AlertControl.ACTION.Script; alertControl.Enable = true; alertControl.Msg = "成功添加操作员"; alertControl.Script = string.Format("window.parent.OnAddNodeResult('{0}','{1}','{2}');", "dept_" + hidDept.Value, "oper_" + iRet.ToString(), txtOperName.Text); return(true); }
private void btnSubmit_Click(object sender, System.EventArgs e) { string[] strDests = hidDestID.Value.Split('_'); string[] strSrcs = hidSrcID.Value.Split('_'); if (strSrcs.Length < 2 || strDests.Length < 2) { return; } switch (strSrcs[0]) { case "oper": { bool bRet = false; try { Oper oper = new Oper(); oper.cnnOperID = int.Parse(strSrcs[1]); oper.cnvcDeptID = strDests[1]; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "移动操作员:" + oper.cnnOperID; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS008"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); bRet = true; } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; } if (bRet) { string strScript = string.Format("window.dialogArguments.src='{0}';window.dialogArguments.dest='{1}';", hidSrcID.Value, hidDestID.Value); Close(strScript, "成功移动用户"); } break; } case "dept": { bool bRet = false; try { Dept dept = new Dept(); dept.cnvcDeptID = strSrcs[1]; dept.cnvcParentDeptID = strDests[1]; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "移动部门:" + dept.cnvcDeptID; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS003"; busiLog.cnvcSource = "网站"; DeptFacade.UpdateDept(dept, busiLog); bRet = true; } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; } if (bRet) { string strScript = string.Format("window.dialogArguments.src='{0}';window.dialogArguments.dest='{1}';", hidSrcID.Value, hidDestID.Value); Close(strScript, "成功移动部门"); } break; } } }
private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e) { try { //更新功能列表 if (rblOper.SelectedValue == "") { throw new BusinessException("tbOper", "请选择操作员!"); } string strOperID = rblOper.SelectedValue; //查询某操作员已具有的功能 DataTable dtHaveOperFunc = OperFacade.GetOneOperFuncList(strOperID); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcSource = "网站"; foreach (ListItem liOperFunc in cblFunctionList.Items) { if (liOperFunc.Selected) { OperFunc operFunc = new OperFunc(); operFunc.cnnOperID = int.Parse(strOperID); operFunc.cnvcFuncName = liOperFunc.Text; operFunc.cnvcFuncAddress = liOperFunc.Value; bool bIsAdd = true; if (dtHaveOperFunc.Rows.Count > 0) { foreach (DataRow drHaveOperFunc in dtHaveOperFunc.Rows) { //已有的不做操作 if (drHaveOperFunc["cnvcFuncName"].ToString().Equals(liOperFunc.Text)) { bIsAdd = false; } } } if (bIsAdd) { busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcComments = "添加权限:" + operFunc.cnvcFuncName; busiLog.cnvcOperType = "BS009"; OperFacade.AddOperFunc(operFunc, busiLog); } } else { //已有的取消了的删除 foreach (DataRow drHaveOperFunc in dtHaveOperFunc.Rows) { if (dtHaveOperFunc.Rows.Count > 0) { if (drHaveOperFunc["cnvcFuncName"].ToString().Equals(liOperFunc.Text)) { OperFunc operFunc = new OperFunc(); operFunc.cnnOperID = int.Parse(strOperID); operFunc.cnvcFuncName = liOperFunc.Text; operFunc.cnvcFuncAddress = liOperFunc.Value; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcComments = "删除权限权限:" + operFunc.cnvcFuncName; busiLog.cnvcOperType = "BS010"; OperFacade.DeleteOperFunc(operFunc, busiLog); } } } } } foreach (ListItem liOperFunc in cblCSFunctionList.Items) { if (liOperFunc.Selected) { OperFunc operFunc = new OperFunc(); operFunc.cnnOperID = int.Parse(strOperID); operFunc.cnvcFuncName = liOperFunc.Text; operFunc.cnvcFuncAddress = liOperFunc.Value; bool bIsAdd = true; if (dtHaveOperFunc.Rows.Count > 0) { foreach (DataRow drHaveOperFunc in dtHaveOperFunc.Rows) { //已有的不做操作 if (drHaveOperFunc["cnvcFuncName"].ToString().Equals(liOperFunc.Text)) { bIsAdd = false; } } } if (bIsAdd) { busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcComments = "添加权限:" + operFunc.cnvcFuncName; busiLog.cnvcOperType = "BS009"; OperFacade.AddOperFunc(operFunc, busiLog); } } else { //已有的取消了的删除 foreach (DataRow drHaveOperFunc in dtHaveOperFunc.Rows) { if (dtHaveOperFunc.Rows.Count > 0) { if (drHaveOperFunc["cnvcFuncName"].ToString().Equals(liOperFunc.Text)) { OperFunc operFunc = new OperFunc(); operFunc.cnnOperID = int.Parse(strOperID); operFunc.cnvcFuncName = liOperFunc.Text; operFunc.cnvcFuncAddress = liOperFunc.Value; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcComments = "删除权限权限:" + operFunc.cnvcFuncName; busiLog.cnvcOperType = "BS010"; OperFacade.DeleteOperFunc(operFunc, busiLog); } } } } } Popup("权限修改成功!"); } catch (BusinessException bex) { Popup(bex.Message); } }