private void btnLogin_Click(object sender, EventArgs e) { string username = this.textBoxUsername.Text; string password = this.textBoxPassword.Text; this.errorMessages.Clear(); this.validateEmail(username); this.validatePassword(password); if (this.errorMessages.Count > 0) { this.displayErrorMessages(); } else { this.errorMessages.Clear(); int result = AccountDAL.Authenticate(username, password); if (result == 1) { MainApp wrapper = new MainApp(username, this); this.textBoxUsername.Clear(); this.textBoxPassword.Clear(); wrapper.ShowDialog(); } else { this.errorMessages.Add(UIMessages.USER_DOESNT_EXIST); this.displayErrorMessages(); } } }