public IEnumerable<TL_USER_SearchResult> TL_USER_Search(TL_USER_SearchResult data, int? top) { try { using (var db = new OOAD_EDUManagementDataContext()) { return db.TL_USER_Search(data.userID, data.userName, data.password, data.userFullName, data.roleID, data.email, data.address, data.phone, data.birthday == null ? null : data.birthday.Value.ToString(CommonClass.Constants.FormatDate), top).ToList(); } } catch (Exception e) { return new List<TL_USER_SearchResult>(); } }
public SigninData TL_USER_GetSiginData(string userName, string password, bool isCheckPass) { try { using (var db = new OOAD_EDUManagementDataContext()) { password = MD5Code.GetMd5Hash(password); TL_USER_SearchResult currentUser = null; if(isCheckPass) currentUser = db.TL_USER_Search(null, userName, null, null, null, null, null, null, null, 1).FirstOrDefault(); else currentUser = db.TL_USER_Search(null, userName, password, null, null, null, null, null, null, 1).FirstOrDefault(); if (currentUser == null) return new SigninData() { IsPasswordCorrect = false, Roles = null, User = null }; SigninData signinData = new SigninData(); signinData.IsPasswordCorrect = true; signinData.User = currentUser; signinData.Roles = db.TL_SYS_ROLE_DETAIL_LstOnRoleID(currentUser.roleID).ToList(); return signinData; } } catch (Exception e) { return null; } }