private void LoginButton_Click(object sender, EventArgs e) { //connection.Open(); AuthenticationPresenter authenticationPresenter = new AuthenticationPresenter(this, this); bool LoginSuccessfully = authenticationPresenter.Login(); if (LoginSuccessfully) { int userid = authenticationPresenter.GetUserId(); FMain objFMain = new FMain(userid); this.Hide(); objFMain.Show(); } else { WrongDataErrorLabel.Text = "*wrong login or password. If you have not registered yet, click Sign Up button."; LoginTextBox.Text = String.Empty; PasswordTextBox.Text = String.Empty; LoginPanel2.BackColor = Color.WhiteSmoke; LoginPanel1.BackColor = Color.WhiteSmoke; LoginTextBox.ForeColor = Color.WhiteSmoke; PasswordPanel1.BackColor = Color.WhiteSmoke; PasswordPanel2.BackColor = Color.WhiteSmoke; PasswordTextBox.ForeColor = Color.WhiteSmoke; } //connection.Close(); }
/// <summary> /// If ok send you to main Window /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NextButton_Click(object sender, EventArgs e) { //bool DataIsOk = true; AuthenticationPresenter authenticationPresenter = new AuthenticationPresenter(this, this); ErrorLabelPresenter errorLabelPresenter = new ErrorLabelPresenter(this, this); bool result1 = errorLabelPresenter.CheckIsDataOk(this); bool result2 = errorLabelPresenter.CheckIsDuplicates(this); if (result1 && result2) { authenticationPresenter.Registration(); int userid = authenticationPresenter.GetUserId(); FMain fMain = new FMain(userid); this.Hide(); fMain.Show(); } }