public bool AuthenticateUser(string userPassword) { MyAuthenticationDataContext myDatabase = new MyAuthenticationDataContext(); var password = (from credential in myDatabase.UserCredentials where credential.UserName == _UserName select credential.Password).ToList(); string strPsw = String.Empty; if (password != null && password.Count > 0) { strPsw = password[0].ToString(); return(strPsw == userPassword ? true : false); } else { return(false); } }
public DataTable GetUserDetails() { DataTable userCredential = new DataTable(); MyAuthenticationDataContext myDatabase = new MyAuthenticationDataContext(); var userResults = (from user in myDatabase.UserCredentials where user.UserName == _UserName select user).ToList(); userCredential.Columns.Add("UserGuid"); userCredential.Columns.Add("UserName"); userCredential.Columns.Add("FullName"); foreach (var userResult in userResults) { DataRow userRow = userCredential.NewRow(); userRow[0] = userResult.UserGuid; userRow[1] = userResult.UserName; userRow[2] = userResult.FullName; userCredential.Rows.Add(userRow); } return(userCredential); }
public DataTable GetAppAccessDetails() { DataTable applicationUser = new DataTable(); MyAuthenticationDataContext myDatabase = new MyAuthenticationDataContext(); var dataResults = (from application in myDatabase.Applications join appUser in myDatabase.ApplicationUsers on application.ApplicationId equals appUser.ApplicationId where appUser.UserName == _UserName select application).ToList(); applicationUser.Columns.Add("ApplicationCode"); applicationUser.Columns.Add("ApplicationName"); applicationUser.Columns.Add("ApplicationURL"); foreach (var appUserResult in dataResults) { DataRow applicationUserRow = applicationUser.NewRow(); applicationUserRow[0] = appUserResult.ApplicationCode; applicationUserRow[1] = appUserResult.ApplicationName; applicationUserRow[2] = appUserResult.ApplicationUrl; applicationUser.Rows.Add(applicationUserRow); } return(applicationUser); }