protected void btnSave_Click(object sender, EventArgs e) { int id = int.Parse(hiddenID.Text); FineOffice.Modules.SYS_User model = userBll.GetModel(d => d.ID == id); if (!model.IsModify.Value) { Alert.ShowInParent(string.Format("用户账号:{0},不允许修改!", model.UserName)); return; } model.Password = FineOffice.Common.DEncrypt.DESEncrypt.Decrypt(model.Password); string[] strIDs = chkRole.SelectedValueArray; List <int> ids = new List <int>(); foreach (string s in strIDs) { ids.Add(int.Parse(s)); } model.RoleList = ListToJson(ids.ToList()); try { userBll.Update(model); PageContext.RegisterStartupScript(ActiveWindow.GetHideReference()); } catch (Exception ex) { Alert.ShowInParent(string.Format("错误信息:{0}", ex.Message)); } }
protected void btnSave_Click(object sender, EventArgs e) { int id = int.Parse(hiddenID.Text); FineOffice.Modules.SYS_User model = userBll.GetModel(d => d.ID == id); if (!model.IsModify.Value) { Alert.ShowInParent(string.Format("用户账号:{0},不允许修改", model.UserName)); } model.IsModify = true; model.UserName = txtUserName.Text.Trim(); model.Password = txtPassword1.Text.Trim(); model.Remark = txtRemark.Text.Trim(); model.PersonnelID = int.Parse(hiddenPersonnel.Text); model.Stop = chkStop.Checked; try { userBll.Update(model); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close")); } catch (Exception ex) { Alert.ShowInParent(string.Format("用户名不允许重复!\n错误信息:{0}", ex.Message)); } }
/// <summary> /// 删除事件 /// </summary> protected void userGrid_RowCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "delete") { try { object[] keys = userGrid.DataKeys[e.RowIndex]; int id = int.Parse(keys[0].ToString()); FineOffice.Modules.SYS_User model = userBll.GetModel(d => d.ID == id); if (!model.IsModify.Value) { Alert.ShowInParent(string.Format("用户账号:{0},不允许删除!", model.UserName)); return; } userBll.Delete(model); ChangeTrackingList <EntitySearcher> changeTrackingList = ViewState["sql"] as ChangeTrackingList <EntitySearcher>; GridColumn column = userGrid.FindColumn(userGrid.SortColumn); userGrid_Bind(changeTrackingList, column.SortField, userGrid.SortDirection); } catch (Exception ex) { Alert.Show(ex.Message); } } }
private void InitModule() { int id = int.Parse(Request["id"]); FineOffice.Modules.SYS_User model = userBll.GetModel(d => d.ID == id); hiddenID.Text = id.ToString(); txtPassword1.Text = FineOffice.Common.DEncrypt.DESEncrypt.Decrypt(model.Password); txtPassword2.Text = FineOffice.Common.DEncrypt.DESEncrypt.Decrypt(model.Password); txtRemark.Text = model.Remark; txtUserName.Text = model.UserName; txtPersonnel.Text = model.PersonnelName; hiddenPersonnel.Text = model.PersonnelID.ToString(); chkStop.Checked = model.Stop.Value; }
private void InitModule() { int id = int.Parse(Request["id"]); FineOffice.Modules.SYS_User model = userBll.GetModel(d => d.ID == id); hiddenID.Text = id.ToString(); List <int> ids = this.JsonToList <int>(model.RoleList); List <string> strIDs = new List <string>(); foreach (int i in ids) { strIDs.Add(i.ToString()); } string [] selectArray = strIDs.ToArray(); chkRole.SelectedValueArray = selectArray; }
protected void btnSave_Click(object sender, EventArgs e) { FineOffice.Modules.SYS_User model = new FineOffice.Modules.SYS_User(); model.IsModify = true; model.UserName = txtUserName.Text.Trim(); model.CreateDate = DateTime.Now; model.Password = txtPassword1.Text.Trim(); model.Remark = txtRemark.Text.Trim(); model.PersonnelID = int.Parse(hiddenPersonnel.Text); model.Stop = chkStop.Checked; try { userBll.Add(model); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close")); } catch (Exception ex) { Alert.ShowInParent(string.Format("用户名不允许重复!\n错误信息:{0}", ex.Message)); } }
protected void btnLogin_Click(object sender, EventArgs e) { btnLogin.Visible = false; string valiString = txtCaptcha.Text.Trim(); FineOffice.Modules.SYS_User model = new FineOffice.Modules.SYS_User(); model.UserName = txtUserName.Text.Trim(); model.Password = this.txtPassword.Text.Trim(); if (HttpContext.Current.Session["IdentifyingCode"] == null) { lblValrUser.Text = "验证码异常,请重新输入!"; InitCaptchaCode(); return; } if (String.Compare(HttpContext.Current.Session["IdentifyingCode"].ToString(), valiString, true) != 0) { lblValrUser.Text = "验证码错误!"; return; } string pwd = FineOffice.Common.DEncrypt.DESEncrypt.Encrypt(model.Password); FineOffice.Modules.SYS_User temp = userBll.GetModel(u => u.UserName == model.UserName && u.Password == pwd); if (temp == null) { lblValrUser.Text = "用户名或密码错误!"; btnLogin.Visible = true; return; } else { this.CookieUser = temp; this.SessionMenuList = this.GetMenuList(temp); this.SessionAuthorityList = this.GetAuthorityList(temp); FineOffice.Modules.HR_Personnel personnel = personnelBll.GetModel(p => p.ID == temp.PersonnelID); this.CookiePersonnel = personnel; Response.Redirect("Main.aspx"); } }