public static EmployeePO DOToPO(EmployeeDO from) { EmployeePO to = new EmployeePO(); to.EmployeeId = from.EmployeeId; to.LastName = from.LastName; to.FirstName = from.FirstName; to.Title = from.Title; to.TitleOfCourtesy = from.TitleOfCourtesy; to.BirthDate = from.BirthDate; to.HireDate = from.HireDate; to.Address = from.Address; to.City = from.City; to.Region = from.Region; to.PostalCode = from.PostalCode; to.Country = from.Country; to.HomePhone = from.HomePhone; to.Extension = from.Extension; //Removed photo to.Notes = from.Notes; to.ReportsTo = from.ReportsTo; to.PhotoPath = from.PhotoPath; to.Username = from.Username; to.Password = from.Password; to.Role = from.Role; return(to); }
public JsonResult LoginSub(EmployeePO emp) { IEmployeeMgm empMgm = new EmployeeMgm(); ReturnedData data = new ReturnedData(); EmployeePO empdb = new EmployeePO(); try { string spwd; var result = empMgm.Login(emp, out empdb); if (result == null) { data.Success = true; if (empdb != null) { SetLoginUser(empdb); } } else { data.Success = false; } data.Message = result; } catch (Exception ex) { data.Success = false; data.Message = "出现错误,请联系维护人员"; data.Error = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public string ChangePassword(EmployeePO emp, string oldpwd, string password, out bool boolresult, out string spwd) { string result = ""; boolresult = false; spwd = null; var empdat = new EmployeeData(); if (emp.Reserved1 == StringHelper.MD5Encrypt(oldpwd)) { var recount = empdat.ChangePassword(emp.EmployeeNo, StringHelper.MD5Encrypt(password)); if (recount > 0) { boolresult = true; spwd = StringHelper.MD5Encrypt(password); result = "密码修改成功"; } else { result = "密码修改失败"; } } else { result = "原始密码不正确"; } return(result); }
public EmployeeVO GetEmployeeByID(int employeeID) { EmployeeData employeeData = new EmployeeData(); EmployeeVO employeeVO = new EmployeeVO(); EmployeePO employeePO = employeeData.GetEmployeeByID(employeeID); employeeVO = Mapper.Map <EmployeePO, EmployeeVO>(employeePO); return(employeeVO); }
public void SetLoginUser(EmployeePO empo) { emp = new EmployeeViewModel(); StoreMgm storeMgm = new StoreMgm(); emp.UserId = empo.EmployeeID; emp.UserName = empo.EmployeeNo; emp.Name = empo.Name; emp.StoreId = empo.StoreID; emp.StroeName = storeMgm.GetStoreByID(empo.StoreID).StoreName; emp.UserPassword = empo.Reserved1; Session.Add("loginUser", emp); }
public string Login(EmployeePO emp, out EmployeePO empdb) { var empdat = new EmployeeData(); string spwd = StringHelper.MD5Encrypt(emp.Reserved1); empdb = empdat.Login(emp); string result = null; if (empdb == null) { return(result = "用户名不存在"); } if (empdb.Reserved1 != spwd) { return(result = "密码错误"); } return(result); }
public JsonResult ResetPwdsub(string oldpwd, string password) { IEmployeeMgm empMgm = new EmployeeMgm(); ReturnedData data = new ReturnedData(); try { var emp = Session["loginUser"] as EmployeeViewModel; bool boolresult; string spwd; var emppo = new EmployeePO() { EmployeeID = emp.UserId, EmployeeNo = emp.UserName, Reserved1 = emp.UserPassword, StoreID = emp.StoreId, Name = emp.Name }; var result = empMgm.ChangePassword(emppo, oldpwd, password, out boolresult, out spwd); data.Success = boolresult; data.Message = result; if (boolresult) { emppo.Reserved1 = spwd; SetLoginUser(emppo); } } catch (Exception ex) { data.Success = false; data.Message = "出现错误,请联系维护人员"; data.Error = ex.ToString(); } return(Json(data, JsonRequestBehavior.AllowGet)); }
public void EditEmployee(EmployeePO employee) { _daoEmployee.Update(employee); }
public void AddEmployee(EmployeePO employee) { _daoEmployee.Add(employee); }
public EmployeePO Login(EmployeePO emp) { return(_daoEmployee.GetModelByEmployeeNo(emp.EmployeeNo)); }