private void SignIn_Click(object sender, EventArgs e) { BL_AddUser obj = new BL_AddUser(); obj.UserName = txtUsername.Text; obj.Password = txtPassword.Text; DataTable dt = obj.Login(); if (dt.Rows.Count > 0) { Welcome wel = new Welcome(); wel.Show(); this.Hide(); } else { MessageBox.Show("Invalid username or password"); } }
private void btnRegi_Click(object sender, EventArgs e) { int n = 0; int m = 0; if (string.IsNullOrEmpty(txtUserName.Text)) { n += 1; } if (string.IsNullOrEmpty(txtEmail.Text)) { n += 1; } if (string.IsNullOrEmpty(txtAddress.Text)) { n += 1; } if (string.IsNullOrEmpty(txtPicture.Text)) { n += 1; } if (string.IsNullOrEmpty(txtPassword.Text)) { n += 1; } if (string.IsNullOrEmpty(txtConfirmPassword.Text)) { n += 1; } if (txtPassword.Text != txtConfirmPassword.Text) { m += 1; } if (n == 0 && m == 0) { BL_AddUser addUser = new BL_AddUser(); addUser.UserName = txtUserName.Text; addUser.Email = txtEmail.Text; addUser.Password = txtConfirmPassword.Text; addUser.Address = txtAddress.Text; addUser.Address = txtAddress.Text; addUser.UserPicture = txtPicture.Text; if (addUser.Save()) { MessageBox.Show("Registerd Successfully", "Success!!", MessageBoxButtons.OK, MessageBoxIcon.Information); loginShow(); } else { MessageBox.Show("Please Try Again"); } } if (n != 0) { MessageBox.Show("All Fields Are Required"); } if (m != 0) { MessageBox.Show("Password Dosen't Matchs"); } AllClear(); }