private void btnSbmtLogin_Click(object sender, EventArgs e) { int idx = cmboUserType.SelectedIndex; if (idx == 0) { this.Hide(); AdminMasterClass master = new AdminMasterClass(txtbxUsernameLogin.Text, txtbxPassLogin.Text); if (master.Login()) { AdminMaster adminMaster = new AdminMaster(master); adminMaster.Show(); } else { MessageBox.Show("Please Enter Correct Username and Password"); Application.Restart(); } } else if (idx == 1) { this.Hide(); AdminClass a = new AdminClass(txtbxUsernameLogin.Text, txtbxPassLogin.Text); if (a.Login()) { Admin admin = new Admin(a); admin.Show(); } else { MessageBox.Show("Please Enter Correct Username and Password!"); Application.Restart(); } } else if (idx == 2) { this.Hide(); CustomerClass cstmr = new CustomerClass(txtbxUsernameLogin.Text, txtbxPassLogin.Text); if (cstmr.Login()) { Customer customer = new Customer(cstmr); customer.Show(); } else { MessageBox.Show("Please Enter Correct Username and Password!"); Application.Restart(); } } }
public AdminMaster(AdminMasterClass master) { InitializeComponent(); masterInfo = master; lblUserName.Text = masterInfo.username; }