protected void btnLogin_Click(object sender, EventArgs e) { try { if (tbxCaptcha.Text.Trim() != Session["HHCaptchaImageText"].ToString()) { Alert.ShowInTop("验证码错误!", String.Empty, tbxCaptcha.GetMarkInvalidReference("验证码错误!") + tbxCaptcha.GetFocusReference()); return; } else { string userName = tbxUserName.Text.Trim(); string password = tbxPassword.Text.Trim(); BLL.tUsers bll = new BLL.tUsers(); List <Model.tUsers> userList = bll.GetModelList("usersName='" + userName + "'"); Model.tUsers user = userList.Count == 0 ? null : userList[0]; if (user != null) { if (user.usersPwd == DESEncrypt.Encrypt(password)) { if (user.Flag == 0) { Alert.ShowInTop("用户未启用,请联系管理员!", String.Empty, "top.window.location.reload(false);"); return; } else { LoginSuccess(user); return; } } else { Alert.ShowInTop("用户名或密码错误!", String.Empty, "top.window.location.reload(false);"); return; } } else { Alert.ShowInTop("用户名或密码错误!", String.Empty, "top.window.location.reload(false);"); return; } } } catch (Exception ex) { Alert.ShowInTop("系统错误!", MessageBoxIcon.Error); return; } }
protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e) { int deptID = GetSelectedDataKeyID(GridDpt); if (e.CommandName == "Delete") { if (TreeDpt.FindNode(deptID.ToString()).Nodes.Count > 0) { Alert.ShowInTop("请先删除该部门下子部门!"); return; } BLL.tUsers uBLL = new BLL.tUsers(); if (uBLL.GetModelList(string.Format(" roleCode=10 and dptId={0}", deptID.ToString())).Count > 0) { Alert.ShowInTop("超级用户所在部门无法删除!"); return; } BLL.tDepartMent BLL = new Maticsoft.BLL.tDepartMent(); bool isTrue = BLL.Delete(deptID); if (!isTrue) { Alert.ShowInTop("删除失败!"); return; } else { BindTree(); LoadData(); } } if (e.CommandName == "Edit") { Window1.Title = "部门管理"; string openUrl = String.Format("./DptMentEdit.aspx?dptId={0}", HttpUtility.UrlEncode(deptID.ToString())); PageContext.RegisterStartupScript(Window1.GetSaveStateReference(deptID.ToString()) + Window1.GetShowReference(openUrl)); } }