private void ShowInfo(int id) { HEemployeeBB eemployeeBB = new HEemployeeBB(); vHEemployeeData model = new vHEemployeeData(); try { model = eemployeeBB.GetVModel(id); this.empNo.Text = model.empNo; this.empNm.Text = model.empNm; this.gender.Text = model.gender; this.nowDepartId.Text = model.departNm; this.mobile.Text = model.mobile; this.email.Text = model.email; //if (this.style.Items.FindByValue(model.style.ToString()) != null) //{ // this.style.SelectedValue = model.style.ToString(); //} this.mark.Text = model.mark; this.isEffect.Text = model.isEffectDesc; } finally { eemployeeBB.Dispose(); } }
protected void btnAdd_Click(object sender, EventArgs e) { HEemployeeData model = new HEemployeeData(); HEemployeeBB eemployeeBB = new HEemployeeBB(); try { if (this.State == "1") { if (eemployeeBB.Exists(this.empNo.Text)) { this.lblMsg.Text = "Ա������Ѿ����ڣ�����������"; return; } this.SetModel(ref model); model.password = MD5Encrypt.GetMD5("123456"); model.isrtDt = DateTime.Now.ToString(); model.isrtEmpId = this.currentUser.empId; model.isDel = false; this.IdValue = eemployeeBB.AddRecord(model); } else if (this.State == "2") { if (eemployeeBB.Exists(this.IdValue, this.empNo.Text)) { this.lblMsg.Text = "Ա������Ѿ����ڣ�����������"; return; } model = eemployeeBB.GetModel(this.IdValue); this.SetModel(ref model); model.updtDt = DateTime.Now.ToString(); model.updtEmpId = this.currentUser.empId; eemployeeBB.ModifyRecord(model); //ͬ��session��Ա��Ϣ if (this.currentUser.empNo == model.empNo) { Session["UserData"] = model; } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { eemployeeBB.Dispose(); } if (this.btnReturn.Enabled) { Response.Redirect("HEemployeeList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main", false); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"���������ijɹ�!\");", true); } }
protected void btnAdd_Click(object sender, EventArgs e) { PEmpPermissionsData empPermissionsData = new PEmpPermissionsData(); PEmpPermissionsBB empPermissionsBB = new PEmpPermissionsBB(); HEemployeeBB eemployeeBB = new HEemployeeBB(); try { //删除当前人员所有权限 empPermissionsBB.DeleteRecordByEmp(this.EmpId, 2); //保存权限 CheckBox checkBox = new CheckBox(); foreach (DataListItem item in this.DataList1.Items) { //获取ItemoNo Label label = (Label)item.FindControl("itemNo"); string itemNo = label.Text; if (itemNo.IndexOf('-') >= 0) { itemNo = itemNo.Substring(itemNo.LastIndexOf('-') + 1); } foreach (System.Web.UI.Control control in item.Controls) { if (control.GetType() == checkBox.GetType()) { if (((CheckBox)control).Checked == true && !eemployeeBB.HasPermissions(this.EmpId, itemNo, ((CheckBox)control).ToolTip)) { //保存权限 empPermissionsData.empId = this.EmpId; empPermissionsData.itemNo = itemNo; empPermissionsData.permissionsTypeNo = ((CheckBox)control).ToolTip; empPermissionsData.isSpecial = false; empPermissionsBB.AddRecord(empPermissionsData); } } } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { empPermissionsBB.Dispose(); eemployeeBB.Dispose(); } this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('保存成功!');", true); }
protected void btnSave_Click(object sender, EventArgs e) { string oldPassWord; string newPassWord; //if (this.newpwd.Text.IndexOf(this.txtUserNo.Text) >= 0) //{ // this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('密码中不能包含用户名等信息!')", true); // return; //} //if (this.newpwd.Text.IndexOf("haier") >= 0) //{ // this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('密码中不能包含公司相关信息!')", true); // return; //} HEemployeeData eemployeeData = new HEemployeeData(); HEemployeeBB eemployeeBB = new HEemployeeBB(); try { eemployeeData = eemployeeBB.GetModel(this.UserId); oldPassWord = MD5Encrypt.GetMD5(this.oldpwd.Text); if (!String.Equals(oldPassWord, eemployeeData.password)) { this.lblMsg.Visible = true; return; } else { this.lblMsg.Visible = false; } newPassWord = MD5Encrypt.GetMD5(this.newpwd.Text); eemployeeData.password = newPassWord; eemployeeData.preModifyPasswordDt = DateTime.Now.ToString(); eemployeeBB.ModifyRecord(eemployeeData); } finally { eemployeeBB.Dispose(); } if (Session["UserData"] != null) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('密码修改成功!')", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"密码修改成功!\");window.location.href='../../../login.aspx';", true); } }
/// <summary> /// ��Grid /// </summary> protected void BindGrid() { HEemployeeBB eemployeeBB = new HEemployeeBB(); DataSet ds = new DataSet(); try { string strWhere = this.StrWhere; if (this.empNo.Text != "") { strWhere += " and empNo like '%" + this.empNo.Text + "%'"; } if (this.empNm.Text != "") { strWhere += " and empNm like '%" + this.empNm.Text + "%'"; } if (this.nowDepartId.Value != "") { strWhere += " and nowDepartId =" + this.nowDepartId.Value; } if (this.gender.SelectedValue != "") { strWhere += " and gender ='" + this.gender.SelectedValue + "'"; } if (this.role.SelectedValue != "") { strWhere += " and ','+roleIds+',' like '%," + this.role.SelectedValue + ",%'"; } ds = eemployeeBB.GetVList(strWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //��ֵ��¼������ҳ������ this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { eemployeeBB.Dispose(); } }
//邦定人员名称 private void BindEmp() { HEemployeeData eemployeeData = new HEemployeeData(); HEemployeeBB eemployeeBB = new HEemployeeBB(); try { eemployeeData = eemployeeBB.GetModel(this.EmpId); this.empNm.Text = "当前人员:" + eemployeeData.empNm; } finally { eemployeeBB.Dispose(); } }
/// <summary> /// 根据当前人员绑定DataList /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e) { PEmpPermissionsBB empPermissionsBB = new PEmpPermissionsBB(); STreeFunctionBB treeFunctionBB = new STreeFunctionBB(); HEemployeeBB eemployeeBB = new HEemployeeBB(); SCommBB commBB = new SCommBB(); DataSet perDs = new DataSet(); DataSet ds = new DataSet(); try { HtmlInputHidden hid = (HtmlInputHidden)e.Item.FindControl("nodeId"); string nodeId = hid.Value; Label label = (Label)e.Item.FindControl("itemNo"); string itemNo = label.Text; if (itemNo.IndexOf('-') >= 0) { itemNo = itemNo.Substring(itemNo.LastIndexOf('-') + 1); } //除了超级管理员,其他用户只能在自己的权限列表范围之内进行分配 if (this.IsHaveRole(1)) { ds = treeFunctionBB.GetList("nodeId=" + nodeId); } else { ds = commBB.Query("select distinct permissionsTypeId,permissionsTypeNo as functionNo,permissionsTypeNm as functionNm from vSTree where empId=" + this.currentUser.empId.ToString() + " and nodeId=" + nodeId + " order by permissionsTypeId"); } for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow row = ds.Tables[0].Rows[i]; //添加文本“<TD></TD>"以控制格式 HtmlGenericControl td = new HtmlGenericControl(); td.InnerHtml = "</td><td>"; e.Item.Controls.Add(td); CheckBox checkBox = new CheckBox(); checkBox.ID = "checkBox" + i.ToString(); checkBox.Text = row["functionNm"].ToString(); checkBox.ToolTip = row["functionNo"].ToString(); //给checkBox赋值 if (eemployeeBB.HasPermissions(this.EmpId, itemNo, row["functionNo"].ToString())) { checkBox.Checked = true; } e.Item.Controls.Add(checkBox); } } finally { empPermissionsBB.Dispose(); treeFunctionBB.Dispose(); eemployeeBB.Dispose(); commBB.Dispose(); } }
/// <summary> /// �ø���������ϢΪ�Ѷ� /// </summary> /// <param name="empId">��ԱId</param> /// <param name="departId">����Id</param> public void SetReadedByEmp(int empId, int departId) { //R����ɫ P������ M������ string roleId = ""; HEemployeeBB eemployeeBB = new HEemployeeBB(); try { //��ȡ��Ա�����ɫ roleId = eemployeeBB.GetAllRole(empId); if (roleId == "") { roleId = "0"; } this.businessDB.SetReadedByEmp(empId, departId, roleId); } finally { eemployeeBB.Dispose(); } }
//***************************************************************************** //do it later do it later do it later //***************************************************************************** /// <summary> /// ��ȡ������Ϣ���б� /// </summary> /// <param name="empId">��Ա</param> /// <param name="departId">����Id</param> /// <param name="strWhere">��������</param> /// <returns>������Ϣ���б�</returns> public DataSet GetPersonalBusiness(int empId, int departId, string strWhere) { //R����ɫ P������ M������ string roleId = ""; HEemployeeBB eemployeeBB = new HEemployeeBB(); try { //��ȡ��Ա�����ɫ roleId = eemployeeBB.GetAllRole(empId); if (roleId == "") { roleId = "0"; } return this.businessDB.GetPersonalBusiness(empId, departId, roleId, strWhere); } finally { eemployeeBB.Dispose(); } }
/// <summary> /// ɾ�� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { bool retChecked = false; HEemployeeBB eemployeeBB = new HEemployeeBB(); try { //��ȡѡ�е�����Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); HEemployeeData eemployeeData = new HEemployeeData(); eemployeeData = eemployeeBB.GetModel(id); eemployeeData.isDel = true; //Ϊ�˱�֤����Ա���û����Ժ�����ٴ�ע�ᣬ��ԭ��¼���˺���� eemployeeData.empNo = ""; eemployeeBB.ModifyRecord(eemployeeData); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { eemployeeBB.Dispose(); } if (retChecked) { this.BindGrid(); } }
private void ShowIssue() { bool hasAddPermissions = false; bool hasAnswerPermissions = false; HEemployeeBB userBB = new HEemployeeBB(); try { hasAddPermissions = (userBB.HasPermissions(this.currentUser.empId, this.itemNo, "add")); hasAnswerPermissions = (userBB.HasPermissions(this.currentUser.empId, this.itemNo, "answer")); } finally { userBB.Dispose(); } DataSet ds = new DataSet(); LForumQuestionBB forumQuestionBB = new LForumQuestionBB(); try { ds = forumQuestionBB.GetList(""); if (ds.Tables[0].Rows.Count == 0) { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); } } finally { forumQuestionBB.Dispose(); } LForumAnswerBB forumAnswerBB = new LForumAnswerBB(); DataSet dsAnswer = new DataSet(); dsAnswer = forumAnswerBB.GetVList(""); try { DataView dv = new DataView(ds.Tables[0], "", "id desc", DataViewRowState.CurrentRows); for (int i = 0; i < dv.Count; i++) { DataRowView row = dv[i]; string id = row["id"].ToString(); string questionTitle = row["questionTitle"].ToString(); string questionContent = row["questionContent"].ToString(); string questionEmpNm = row["questionEmpNm"].ToString(); string questionDt = ""; if (row["questionDt"] != DBNull.Value) { questionDt = Convert.ToDateTime(row["questionDt"]).ToString("yyyy-MM-dd HH:mm"); } sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td valign=\"top\" style=\"background-color: #E3EEED\">\r\n"); sbHtml.Append(" <table width=\"95%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); sbHtml.Append(" <tr style=\"background-color:#e5e5e5\">\r\n"); sbHtml.Append(" <td style=\"height:31px\" colspan=\"4\">\r\n"); sbHtml.Append(" <table width=\"92%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td style=\"width:40px; height:29px\" align=\"CENTER\">\r\n"); sbHtml.Append(" <font size=\"-1\" color=\"#003300\">" + questionEmpNm + "</font></td>\r\n"); sbHtml.Append(" <td style=\"width:260px; height:29px\">\r\n"); sbHtml.Append(" 留言日期: " + questionDt + "</td>\r\n"); sbHtml.Append(" <td style=\"width:120px; height:29px\">\r\n"); if (hasAddPermissions) { sbHtml.Append(" <strong><a href=\"javascript:openQuestion();\"><span style=\"color:#035998\">我要留言</span></a></strong>\r\n"); } else { sbHtml.Append(" <strong><span style=\"color:#035998\">我要留言</span></strong>\r\n"); } sbHtml.Append(" \r\n"); if (hasAnswerPermissions) { sbHtml.Append(" <strong><a href=\"javascript:openAnswer('" + id.ToString() + "');\"><span style=\"color:#035998\">回复</span></a></strong>\r\n"); } sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" </table>\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" <tr style=\"background-color:#E0E9ED\">\r\n"); sbHtml.Append(" <td style=\"width:4px; height:2px\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" <td style=\"width:78px; height:2px\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" <td style=\"width:4px; height:2px\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" <td style=\"width:470px; height:2px\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td valign=\"top\" style=\"background-color:#E3EEED\" colspan=\"4\">\r\n"); sbHtml.Append(" <table width=\"98%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\"\r\n"); sbHtml.Append(" height=\"114\">\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td style=\"width:465px; height:20px\" valign=\"BOTTOM\" align=\"left\">\r\n"); sbHtml.Append(" <font color=\"#FF6666\">主题:</font>" + questionTitle + "</td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td style=\"height:1px\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td valign=\"top\" style=\"width:465px; height:47px\" align=\"left\">\r\n"); sbHtml.Append(" <font color=\"#669900\"><strong>\r\n"); sbHtml.Append(" <hr size=\"1\" color=\"#FFFFFF\">\r\n"); sbHtml.Append(" <img src=\"../../../Images/write.gif\" width=\"23\" height=\"24\">:</strong></font>" + questionContent + "</td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td style=\"height:12px\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); DataView dvAnswer = new DataView(dsAnswer.Tables[0], "questionId='" + row["id"].ToString() + "'", "", DataViewRowState.CurrentRows); //显示答复内容 if (dvAnswer.Count > 0) { for (int j = 0; j < dvAnswer.Count; j++) { string answerContent = dvAnswer[j]["answerContent"].ToString(); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td style=\"height:36px\" valign=\"top\" bgcolor=\"#f2f2f2\" align=\"left\">\r\n"); sbHtml.Append(" <span style=\"color:red\"><strong>站方回复: </strong></span>" + answerContent + "\r\n"); sbHtml.Append(" <hr size=\"1\" color=\"#FFFFFF\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); } } else { sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td style=\"height:36px\" valign=\"top\" bgcolor=\"#f2f2f2\" align=\"left\">\r\n"); sbHtml.Append(" <span style=\"color:red\"><strong>站方回复: </strong></span>暂无回复暂\r\n"); sbHtml.Append(" <hr size=\"1\" color=\"#FFFFFF\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); } sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td style=\"height:5px\">\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" </table>\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" <tr style=\"height:2px\" colspan=\"4\">\r\n"); sbHtml.Append(" <td>\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" </table>\r\n"); sbHtml.Append(" <table style=\"width:95%; height:2px\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#666666\">\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td>\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" </table>\r\n"); sbHtml.Append(" <table style=\"width:95%; height:5px\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\r\n"); sbHtml.Append(" <tr>\r\n"); sbHtml.Append(" <td>\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); sbHtml.Append(" </table>\r\n"); sbHtml.Append(" </td>\r\n"); sbHtml.Append(" </tr>\r\n"); } } finally { forumAnswerBB.Dispose(); } }
/// <summary> /// �����ʼ�� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnPasswordInit_Click(object sender, EventArgs e) { bool retChecked = false; HEemployeeBB eemployeeBB = new HEemployeeBB(); try { //��ȡѡ�е�����Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { retChecked = true; int id = int.Parse(chkId.ValidationGroup); HEemployeeData eemployeeData = new HEemployeeData(); eemployeeData = eemployeeBB.GetModel(id); eemployeeData.password = MD5Encrypt.GetMD5("123456"); eemployeeBB.ModifyRecord(eemployeeData); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"�����ʼ���ɹ�!\");", true); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { eemployeeBB.Dispose(); } if (retChecked) { this.BindGrid(); } }
/// <summary> /// 管理他人数据权限验证 /// </summary> public bool ValidateDataPermission(int recordEmpId) { if (this.itemNo == "") { return true; } bool ret = false; //操作人与记录携带者为同一人 if (this.currentUser.empId == recordEmpId) { ret = true; } else { STreeData treeData = this.GetTreeData(this.itemNo); //判断当前模块是否允许管理他人数据 //判断当前人员对当前模块是否有管理权限 if (treeData.isAlowManageOtherData && this.IsHavePermissions(this.itemNo, "manage")) { ret = true; } else { //判断是否走负责部门 //判断记录携带者是否在当前人员的负责部门范围之内 using (HEemployeeBB employeeBB = new HEemployeeBB()) { if (treeData.isManageDepart && employeeBB.IsManage(this.currentUser.empId, this.itemNo, this.permissionsTypeNo, recordEmpId)) { ret = true; } } } } return ret; }
public DataTable GetModule(int empId) { Base_ModuleBB moduleBB = new Base_ModuleBB(); HEemployeeBB empBB = new HEemployeeBB(); try { DataTable dt = new DataTable(); bool isHaveRole = false; isHaveRole = empBB.IsHaveRole(empId, 1);//判断当前人是否拥有管理员权限 if (isHaveRole)//当前人员拥有管理员权限 { dt = moduleBB.GetList("").Tables[0]; } else { //判断当前人员是否有收货员权限 isHaveRole = empBB.IsHaveRole(empId, 15); if (isHaveRole) { dt = moduleBB.GetList("id not in ('10000010','10000006')").Tables[0]; return dt; } //判断当前人员是否有叉车司机权限 isHaveRole = empBB.IsHaveRole(empId, 16); if (isHaveRole) { dt = moduleBB.GetList("id in ('10000003','10000004','10000010')").Tables[0]; return dt; } //判断当前人员是否检验员权限 isHaveRole = empBB.IsHaveRole(empId, 18); if (isHaveRole) { dt = moduleBB.GetList("id in ('10000003','10000004','10000006')").Tables[0]; return dt; } } return dt; } finally { moduleBB.Dispose(); empBB.Dispose(); } }
/// <summary> /// 当前用户是否拥有角色 /// </summary> /// <returns>是、否</returns> public bool IsHaveRole(int roleId) { HEemployeeBB userBB = new HEemployeeBB(); try { return userBB.IsHaveRole(this.currentUser.empId, roleId); } finally { userBB.Dispose(); } }
public bool ValidateUserLogin(string userNo, string password, out string cMessage, out string strRealName) { cMessage = ""; strRealName = ""; using (HEemployeeBB userBB = new HEemployeeBB()) { if (userNo == "") { cMessage = "请输入用户名!"; return false; } string validateString = userBB.ValidatePassword(userNo, password); if (validateString != "") { cMessage = validateString; return false; } else { HEemployeeData userModel = new HEemployeeData(); userModel = userBB.GetModel(userNo); cMessage = userModel.empId.ToString(); strRealName = userModel.empNm; return true; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { this.IdValue = Convert.ToInt32(Request.Params["id"]); } if (Request.Params["state"] != null && Request.Params["state"].Trim() != string.Empty) { this.State = Request.Params["state"].ToString(); switch (this.State) { case "1": //add break; case "2": //update //���ؿؼ� if (this.IdValue != 0) { HEemployeeBB eemployeeBB = new HEemployeeBB(); HEemployeeData eemployeeData = new HEemployeeData(); try { eemployeeData = eemployeeBB.GetModel(this.IdValue); this.ShowInfo(this.IdValue); } finally { eemployeeBB.Dispose(); } } else if (this.currentUser.empId != 0) { //����������ʱ����ֹ��Ա���˺š����ż�����״̬ this.empNo.Enabled = false; this.empNo.BackColor = System.Drawing.Color.FromName("#ECECEC"); this.isEffect.Enabled = false; this.btnConsultDept.Disabled = true; //this.password.Enabled = false; //this.password.BackColor = System.Drawing.Color.FromName("#ECECEC"); this.IdValue = this.currentUser.empId; this.ShowInfo(this.IdValue); this.btnReturn.Enabled = false; } break; default: break; } } } }
/// <summary> /// 系统登陆 /// </summary> /// <param name="user"></param> /// <param name="voidPin">是否验证密码</param> protected void UserLogin(string userName, string passWord, bool voidPin) { HEemployeeBB userBB = new HEemployeeBB(); HEemployeeData userData = new HEemployeeData(); try { if (userName == "") { this.lblMsg.Text = "请输入用户名!"; return; } string validateString = userBB.ValidatePassword(userName, passWord); if (voidPin && validateString != "") { //记录登陆日志 this.LoginDiary(); switch (validateString) { case "登陆密码错误!": userData = userBB.GetModel(userName); userData.errorLoginAmount += 1; //记录连续错误登录次数 userBB.ModifyRecord(userData); this.lblMsg.Text = validateString; break; case "第一次登录系统,请首先修改登录密码!": case "您的密码已过期,请重新修改登录密码!": case "您的密码已被初始化,请修改登录密码!": this.lblMsg.Text = ""; userData = userBB.GetModel(userName); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + validateString + "\");window.location.href='Page/System/ChangePwd/ChangePwd.aspx?userId=" + userData.empId.ToString() + "&userNo=" + userData.empNo + "';", true); break; default: this.lblMsg.Text = validateString; break; } } else { FormsAuthentication.SetAuthCookie(userName, false); userData = userBB.GetModel(userName); userData.Identity = true; //记录用户在线信息 userData.isOnLine = true; userData.loginDate = DateTime.Now.ToString(); userData.lastOnLineDt = DateTime.Now.ToString(); userData.sessionId = Session.SessionID; userData.errorLoginAmount = 0; //置连续错误登录次数为0 userBB.ModifyRecord(userData); Session["UserData"] = userData; Session["Style"] = userData.style; //缓存用户权限 Session["UserPermissionTable"] = userBB.GetSessionUserPermissionTable(userData.empId); //记录登陆日志 this.LoginDiary(); try { //StringBuilder script = new StringBuilder(); //script.Append("<script language=\"javascript\">\r\n"); //script.Append("<!--\r\n"); //script.Append(" window.open('Main.htm','_blank', 'left=0,top=0,height='+screen.availHeight+'-20,width='+screen.availWidth+',resizable=yes,status=no,titlebar=no,toolbar=no,scrollbars=yes');\r\n"); //script.Append("//-->\r\n"); //script.Append("</script>"); //this.ClientScript.RegisterStartupScript(this.GetType(), "OpenRegister", script.ToString()); Response.Redirect("main.htm", false); } catch (Exception ex) { } } } catch (Exception ex) { this.lblMsg.Text = ex.Message; } finally { userBB.Dispose(); } }
/// <summary> /// 绑定数据源 /// </summary> private void BindGrid() { string strWhere = this.StrWhere; if (this.empNo.Text != "") { strWhere += " and empNo like '%" + this.empNo.Text + "%'"; } if (this.empNm.Text != "") { strWhere += " and empNm like '%" + this.empNm.Text + "%'"; } if (this.drDepart.SelectedValue != "") { strWhere += " and nowDepartId = " + this.drDepart.SelectedValue; } if (this.drRole.SelectedValue != "") { strWhere += " and exists(select 1 from PUserRole where empId=vHEemployee.empId and roleId=" + this.drRole.SelectedValue + ")"; } HEemployeeBB userBB = new HEemployeeBB(); DataSet ds = new DataSet(); try { ds = userBB.GetVList(strWhere); this.grid.DataSource = ds.Tables[0]; this.grid.DataBind(); //赋值记录条数、页面总数 this.Label3.Text = ds.Tables[0].Rows.Count.ToString(); this.Label2.Text = this.grid.PageCount.ToString(); this.currPage.Text = (this.grid.PageIndex + 1).ToString(); } finally { userBB.Dispose(); } }