Ejemplo n.º 1
0
 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;
     }
 }
Ejemplo n.º 2
0
        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); }
                }
            }
        }
Ejemplo n.º 3
0
 public Customer(string name, LoginVisible lv)
 {
     InitializeComponent();
     LblName.Text = name;
     this.LV      = lv;
 }
Ejemplo n.º 4
0
 public Manager(LoginVisible lv)
 {
     InitializeComponent();
     this.con = new Connection();
     this.LV  = lv;
 }
Ejemplo n.º 5
0
 public Employee(LoginVisible lv)
 {
     InitializeComponent();
     this.LV = lv;
 }
Ejemplo n.º 6
0
 public Manager(LoginVisible lv)
 {
     InitializeComponent();
     LV = lv;
 }