/// <summary> /// 得到个人密码 /// </summary> /// <param name="perId"></param> /// <returns></returns> public string GetPwd(int perId) { string pwd = ""; Model.System.sys_Person model = dal.GetModel(perId); pwd = DESEncrypt.Decrypt(model.Password, model.Salt); return(pwd); }
/// <summary> /// 初始化个人密码 /// </summary> /// <param name="perId"></param> /// <returns></returns> public string InitPwd(int perId) { Model.System.sys_Person model = dal.GetModel(perId); string pwd = DESEncrypt.Encrypt("123", model.Salt); if (!dal.UpdatePwd(model.Account, pwd)) { return(""); } return("123"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SCZM.Model.System.sys_Person model, out string message) { message = "修改成功!"; int flagDep = 0; int flagRole = 0; int flagCtrlPer = 0; Model.System.sys_Person tempModel = dal.GetModel(model.ID); if (tempModel == null) { message = "对不起,该条数据已被其他人删除!"; return(false); } if (model.Account != "" && model.Account != tempModel.Account) { if (dal.ExistsAccount(model.Account)) { message = "对不起,账号已存在!"; return(false); } } model.Salt = tempModel.Salt; model.Password = tempModel.Password; model.IsAdmin = tempModel.IsAdmin; if (model.DepId != tempModel.DepId) { flagDep = 1; } if (model.RoleId != tempModel.RoleId) { flagRole = 1; } if (model.CtrlPerId != tempModel.CtrlPerId) { flagCtrlPer = 1; } int rows = dal.Update(model, flagDep, flagRole, flagCtrlPer); if (rows == 0) { message = "对不起,该条数据已被其他人删除!"; return(false); } else { SetPersonRoleCache(model.ID); return(true); } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string id = RequestHelper.GetString("id"); string depId = RequestHelper.GetString("depId"); string postId = RequestHelper.GetString("postId"); string perName = RequestHelper.GetString("perName"); string account = RequestHelper.GetString("account"); string perTel = RequestHelper.GetString("perTel"); string perEmail = RequestHelper.GetString("perEmail"); string ddNo = RequestHelper.GetString("ddNo"); string wxNo = RequestHelper.GetString("wxNo"); string roleId = RequestHelper.GetString("roleId"); string roleName = RequestHelper.GetString("roleName"); string ctrlPersonType = RequestHelper.GetString("ctrlPersonType"); string ctrlDepId = RequestHelper.GetString("ctrlDepId"); string ctrlPerId = RequestHelper.GetString("ctrlPerId"); if (depId == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"部门不能为空!\"}"); return; } if (perName == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"姓名不能为空!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); BLL.System.sys_Person bll = new BLL.System.sys_Person(); Model.System.sys_Person model = new Model.System.sys_Person(); model.ID = Utils.StrToInt(id, 0); model.DepId = Utils.StrToInt(depId, 0); model.PostId = Utils.StrToInt(postId, 0); model.PerName = perName; model.Account = account; model.PerTel = perTel; model.PerEmail = perEmail; model.DDNo = ddNo; model.WXNo = wxNo; model.RoleId = roleId; model.RoleName = roleName; model.CtrlPersonType = Utils.StrToInt(ctrlPersonType, 1); model.CtrlDepId = Utils.StrToInt(ctrlDepId, 0); model.CtrlPerId = ctrlPerId; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (id == "") { model.ID = bll.Add(model, out operaMessage); if (model.ID > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "新增人员:" + model.PerName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } else { if (bll.Update(model, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "修改人员:" + model.PerName + "(" + model.ID + ")"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }