private void btnLogin_Click(object sender, EventArgs e) { if (txtName.Text == "") { errorProvider1.SetError(txtName, "Enter user name"); } if (txtPassword.Text == "") { errorProvider1.SetError(txtPassword, "Enter user password"); } DAL.PL ob = new DAL.PL(); DataTable dt = new DataTable(); dt = ob.Login_Verify(txtName.Text, txtPassword.Text); if (dt.Rows.Count > 0) { if (dt.Rows[0][3].ToString() == "Admin") { Home frm = new Home(); frm.ShowDialog(); } else if (dt.Rows[0][3].ToString() == "Trader") { Home frm = new Home(); frm.label1.Text = "your type " + dt.Rows[0][3]; frm.ManageData.Visible = false; frm.ShowDialog(); } else if (dt.Rows[0][3].ToString() == "Client") { Home frm = new Home(); frm.label1.Text = "your type " + dt.Rows[0][3]; frm.AddProduct.Visible = false; frm.ManageData.Visible = false; frm.ShowDialog(); } } else { MessageBox.Show("your name or your password is not correct"); } }
private void btnRegister_Click(object sender, EventArgs e) { sayac = 0; if (check_F(txtFname.Text)) { sayac++; } if (check_L(txtLName.Text)) { sayac++; } if (check_Phone(txtPhone.Text)) { sayac++; } if (check_email(txtEmail.Text)) { sayac++; } if (sayac == 4) { DAL.PL ob = new DAL.PL(); if (txtPassword.Text == txtPassword1.Text) { if (txtUser.Text == "" || txtFname.Text == "" || txtLName.Text == "" || txtEmail.Text == "" || txtPassword.Text == "" || txtUser.Text == "" || txtPhone.Text == "") { return; } else { ob.UserCreate(txtUser.Text, txtFname.Text, txtLName.Text, txtEmail.Text, txtPassword.Text, comboType.Text, txtPhone.Text); MessageBox.Show("successfully......"); this.Close(); Application.OpenForms[0].Show(); } } else { MessageBox.Show("Password does not match"); } } }
private void btnUpdate_Click(object sender, EventArgs e) { DAL.PL ob = new DAL.PL(); if (txtPassword.Text == txtPassword1.Text) { if (txtUser.Text == "" || txtFname.Text == "" || txtLName.Text == "" || txtEmail.Text == "" || txtPassword.Text == "" || txtUser.Text == "" || txtPhone.Text == "") { return; } else { ob.UpdateUser(Convert.ToInt32(id), txtUser.Text, txtFname.Text, txtLName.Text, txtEmail.Text, txtPassword.Text, comboType.Text, txtPhone.Text); MessageBox.Show("update successfully......"); this.Close(); Application.OpenForms[0].Show(); } } else { MessageBox.Show("Password does not match"); } }