private void btnClose_Click(object sender, EventArgs e) { frmMain frm = new frmMain(); frm.Show(); this.Close(); }
private void button5_Click_1(object sender, EventArgs e) { frmMain main = new frmMain(); main.Show(); this.Close(); }
private void LoginMathod() { String userName = null; String userpass = null; String userRole = null; String userFName = null; String userLName = null; if (txtName.Text == "") { MessageBox.Show("Please Enter Your Name", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Focus(); return; } if (txtPass.Text == "") { MessageBox.Show("Please Enter Your Password", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPass.Focus(); return; } if (roleCombo.Text == "") { MessageBox.Show("Please Select Your Role", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { String query = "SELECT * FROM Users WHERE UserName='******' "; reader = db.selectQuery(query); if (reader.Read()) { userRole = reader[1].ToString(); userFName = reader[2].ToString(); userLName = reader[3].ToString(); userName = reader[4].ToString(); userpass = reader[5].ToString(); } db.ConnectionClose(); if (txtName.Text.Equals(userName) && roleCombo.Text.Equals(userRole)) { if (txtPass.Text.Equals(userpass)) { frmMain mainfrm = new frmMain(); mainfrm.Show(); UcMainManu uc = new UcMainManu(); uc.lblFirstName.Text = userFName + ":"; uc.lblLastName.Text = userLName; uc.lblUserRole.Text = userRole + ":"; this.Hide(); } else { txtPass.Clear(); txtPass.Focus(); MessageBox.Show("Your Password is Invalid !!"+Environment.NewLine+"Please Enter Your Valid Password", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Your User Name OR User Role is Invalid !!" + Environment.NewLine + "Please Enter Your Valid Name OR Role", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Information); txtName.Clear(); txtName.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }