/// <summary> /// 以重置密碼用唯一值取得員工登入用資料 /// </summary> public Employee GetEmployeeDataToLoginByPasswordResetKey(string passwordResetKey) { Employee entity = null; using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess()) { entity = empAuthDao.Get <Employee>(emp => emp.PasswordResetKey == passwordResetKey); dbErrMsg = empAuthDao.GetErrMsg(); } return(entity); }
/// <summary> /// 更新員工的重置密碼用唯一值 /// </summary> public bool UpdateEmployeePasswordResetKey(string empAccount, string passwordResetKey) { bool result = false; using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess()) { Employee entity = empAuthDao.Get <Employee>(emp => emp.EmpAccount == empAccount); entity.PasswordResetKey = passwordResetKey; entity.PasswordResetKeyDate = DateTime.Now; entity.MdfAccount = empAccount; entity.MdfDate = DateTime.Now; result = empAuthDao.Update(); dbErrMsg = empAuthDao.GetErrMsg(); } return(result); }
/// <summary> /// 更新員工本次登入資訊 /// </summary> public bool UpdateEmployeeLoginInfo(string empAccount, string thisLoginIP) { bool result = false; using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess()) { Employee entity = empAuthDao.Get <Employee>(emp => emp.EmpAccount == empAccount); //備份上次的登入資訊,記錄這次的 entity.LastLoginTime = entity.ThisLoginTime; entity.LastLoginIP = entity.ThisLoginIP; entity.ThisLoginTime = DateTime.Now; entity.ThisLoginIP = thisLoginIP; result = empAuthDao.Update(); dbErrMsg = empAuthDao.GetErrMsg(); } return(result); }