/// <summary> /// 登录 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Login(HttpContext context) { string WorkNum = context.Request["name"] ?? ""; string pwd = context.Request["pwd"] ?? ""; var str = new StringBuilder(); try { var employeeBll = new EmployerBll(); if (employeeBll.Login(WorkNum, pwd)) { context.Session[Constant.LoginUser] = employeeBll.GetEntity(new Employer() { WorkNum = WorkNum, Password = pwd }); str.Append("1"); return(str.ToString()); } else { str.Append("0"); return(str.ToString()); } } catch (Exception ex) { Log.Error(ex); str.Append("0"); return(str.ToString()); } }
/// <summary> /// 修改密码 /// </summary> /// <param name="context"></param> /// <returns></returns> public string ModifyPassword(HttpContext context) { var employeeBll = new EmployerBll(); var str = new StringBuilder(); var worknum = context.Request.Params["worknum"]; var pass = context.Request.Params["pass"]; var newpass = context.Request.Params["newpass"]; var employee = new Employer { WorkNum = worknum, Password = newpass }; try { var value = employeeBll.Login(worknum, pass); if (value) { employeeBll.Modify(employee); str.Append("true"); } else { str.Append("falsepwd"); } } catch (Exception e) { Log.Error(e); str.Append("false"); } return(str.ToString()); }