private void metroButton1_Click(object sender, EventArgs e) { if (TxtUserID.Text == "101" && TxtPassword.Text == "123") { LoginVisible LoginFromVisibility = new LoginVisible(this.Visibility); Manager man = new Manager(LoginFromVisibility); man.Visible = true; this.Visible = false; } }
private void LoginBtn_Click(object sender, EventArgs e) { if (UsernameTxt.Text == "Admin" && PasswordTxt.Text == "123") { LoginVisible LoginFromVisibility = new LoginVisible(this.Visibility); Manager man = new Manager(LoginFromVisibility); man.Visible = true; this.Visible = false; } else { if (count == 0) { try { EmployeeRepository Emptemp = new EmployeeRepository(); this.Ds = Emptemp.SearchLoginData(this.UsernameTxt.Text, PasswordTxt.Text); if (this.Ds.Tables[0].Rows.Count == 1) { Employee emp = new Employee(Visibility); emp.Visible = true; this.Visible = false; } else { MessageBox.Show("User Name or Password Error"); } } catch (Exception exc) { MessageBox.Show("Login error : " + exc); } } else { try { CustomerRepository custrepo = new CustomerRepository(); this.Ds = custrepo.SearchLoginData(this.UsernameTxt.Text, PasswordTxt.Text); if (this.Ds.Tables[0].Rows.Count == 1) { MessageBox.Show("Success!"); Customer cus = new Customer(UsernameTxt.Text, Visibility); cus.Visible = true; this.Visible = false; Customer passCustomer = new Customer(UsernameTxt.Text, Visibility); } else { MessageBox.Show("User Name or Password Error"); } } catch (Exception exc) { MessageBox.Show("Login error : " + exc); } } } }
public Customer(string name, LoginVisible lv) { InitializeComponent(); LblName.Text = name; this.LV = lv; }
public Manager(LoginVisible lv) { InitializeComponent(); this.con = new Connection(); this.LV = lv; }
public Employee(LoginVisible lv) { InitializeComponent(); this.LV = lv; }
public Manager(LoginVisible lv) { InitializeComponent(); LV = lv; }