public static bool LoginCurrentUser(string username, string password) { bool signedIn = false; try { var database = new SQLiteDataService(); database.Initialize(); List <User> signedInUser = database.GetAllUsers().Where(user => user.Username == username).ToList(); database.Close(); if (username == "" || password == "") { throw new ArgumentNullException(); } if (signedInUser.Count < 1) { throw new LoginException("The User Name you entered does not exist."); } if (signedInUser.First().Password != password) { throw new LoginException("The password is incorrect"); } currentUser = signedInUser.First(); signedIn = true; } catch (ArgumentNullException) { throw new LoginException("You must have both User Id and a Password"); } catch (LoginException error) { throw error; } catch (Exception error) { MessageBox.Show(error.Message, "Instructions", MessageBoxButtons.OK); } return(signedIn); }