public FSettings(int userid, string username, string surname, string login, string password, string email, string phonenumber, bool isacompanyclient, int addressid, string street, string housenumber, string city, string postcode, FMain objFMain) { InitializeComponent(); string conn = ConfigurationManager.ConnectionStrings["DBconn"].ConnectionString; connection = new MySqlConnection(conn); this.UserId = userid; this.UserName = username; this.Surname = surname; this.Login = login; this.Password = password; this.Email = email; this.PhoneNumber = phonenumber; this.IsACompany = isacompanyclient; this.AddressId = addressid; this.Street = street; this.HouseNumber = housenumber; this.City = city; this.PostCode = postcode; this.IsaAClient = true; NameTextBox.Text = UserName; SurnameTextBox.Text = Surname; LoginTextBox.Text = Login; PasswordTextBox.Text = Password; EmailTextBox.Text = Email; PhoneNumberTextBox.Text = PhoneNumber; StreetTextBox.Text = Street; NumberTextBox.Text = HouseNumber; CityTextBox.Text = City; PostCodeTextBox.Text = PostCode; activeForm = objFMain; }
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(); } }