private ah.Models.vwCHIS_Sys_Login checkUserLogin(string loginId, string password) { ah.Models.vwCHIS_Sys_Login userEntity = null; if (loginId.GetStringType().IsEmail) { userEntity = MainDbContext.vwCHIS_Sys_Login.FirstOrDefault(t => t.Email == loginId); } if (loginId.GetStringType().IsMobile) { userEntity = MainDbContext.vwCHIS_Sys_Login.FirstOrDefault(t => t.Mobile == loginId); } if (loginId.GetStringType().IsIdCardNumber) { userEntity = MainDbContext.vwCHIS_Sys_Login.FirstOrDefault(t => t.IdCardNumber == loginId); } if (userEntity == null) { throw new Exception("账户不存在,请重新输入"); } string dbPassword = password; if (dbPassword == userEntity.LoginPassword) //万能密码一小时内有效 { return(userEntity); } else { throw new Exception("密码不正确,请重新输入"); } }
private ah.Models.vwCHIS_Sys_Login checkBackUserLogin(string loginMobile, string password) { ah.Models.vwCHIS_Sys_Login userEntity = MainDbContext.vwCHIS_Sys_Login.FirstOrDefault(t => t.Mobile == loginMobile); if (userEntity == null) { throw new Exception("账户不存在,请重新输入"); } if (userEntity.IsAllowedAHMS != true) { throw new Exception("该账户没有授权登录此系统"); } string dbPassword = password; if (dbPassword == userEntity.LoginPassword) //万能密码一小时内有效 { return(userEntity); } else { throw new Exception("密码不正确,请重新输入"); } }