public ActionResult Login(UserLoginForm model) { if (ModelState.IsValid) { string sessionValidCode = Session["validatecode"] == null ? string.Empty : Session["validatecode"].ToString(); if (!model.Code.Equals(sessionValidCode)) { return(RedirectToAction("Login", "Home", new { msg = "验证码错误!请重新输入" })); } model.Password = md5tool.GetMD5(model.Password); UserManage userManage = new UserManage(); ViewUserAsEmployee user = userManage.Login(model); if (user == null) { return(RedirectToAction("Login", "Home", new { msg = "账号或密码不正确,是否重新登陆?" })); } else if (user.UserStatus != "在职") { return(RedirectToAction("Login", "Home", new { msg = "您已经办理离职,如有特殊情况请与人事部沟通。" })); } else { Session["loginuser"] = user; return(Redirect("/System/Main/Index/")); } } return(View()); }
public ActionResult UpdateEmployee(ViewUserAsEmployee userAsEmployee, string Note) { if (ModelState.IsValid) { var updateBy = (ViewUserAsEmployee)Session["loginuser"]; userManage.UpdateUserAsEmployee(userAsEmployee, updateBy.UserID, Note); return(RedirectToAction("Index", "HR", new { UpdateMsg = userAsEmployee.UserName + " 的人力资源信息更新完毕" })); } return(View(userAsEmployee)); }
/// <summary> /// 更新员工的人力资源信息 /// </summary> /// <param name="userAsEmployee"></param> /// <returns></returns> public bool UpdateUserAsEmployee(ViewUserAsEmployee userAsEmployee, int UpdateBy, string UpdateNote) { bool isSuccess = false; //构造实体 InfoUserSelf userSelf = userData.GetUserSelfInfos(userAsEmployee.UserID); userSelf.UserPosition = userAsEmployee.UserPosition; userSelf.UserDepartment = userAsEmployee.UserDepartment; userSelf.UserSalary = userAsEmployee.UserSalary; userSelf.UserStatus = userAsEmployee.UserStatus; //登记更新记录 InfoUserSelf beforeUpdate = userData.GetUserSelfInfos(userAsEmployee.UserID); if (beforeUpdate.UserPosition != userSelf.UserPosition) { CreateNewUpdateInfo("职位", userSelf.UserPosition, beforeUpdate.UserPosition, UpdateNote, userAsEmployee.UserID, UpdateBy); } if (beforeUpdate.UserDepartment != userSelf.UserDepartment) { CreateNewUpdateInfo("所属部门", userSelf.UserDepartment, beforeUpdate.UserDepartment, UpdateNote, userAsEmployee.UserID, UpdateBy); } if (beforeUpdate.UserSalary != userSelf.UserSalary) { CreateNewUpdateInfo("预期薪资", userSelf.UserSalary.ToString(), beforeUpdate.UserSalary.ToString(), UpdateNote, userAsEmployee.UserID, UpdateBy); } if (beforeUpdate.UserStatus != userSelf.UserStatus) { CreateNewUpdateInfo("在职状态", userSelf.UserStatus, beforeUpdate.UserStatus, UpdateNote, userAsEmployee.UserID, UpdateBy); } //开始更新 userData.UpdateDetail(userSelf); return(isSuccess); }