Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text == "" || txtUser.Text == "")
            {
                MessageBox.Show("Can not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                User user = new User();
                user.Username = txtUser.Text;
                user.Password = txtPassword.Text;
                int id = user.Login(user);
                if (id > 0)
                {
                    if (id == 1)
                    {
                        MisManagerForm mainform = new MisManagerForm();
                        this.Hide();
                        mainform.Show();
                    }
                    else if (id == 2)
                    {
                        MessageBox.Show("Sales Manager");
                        SalesManager mainform = new SalesManager();
                        this.Hide();
                        mainform.Show();
                    }
                    else if (id == 3)
                    {
                        MessageBox.Show("Orders Clerk");
                        OrdersClark mainform = new OrdersClark();
                        this.Hide();
                        mainform.Show();
                    }

                    else if (id == 4)
                    {
                        MessageBox.Show("Accountant");
                        Accountant mainform = new Accountant();
                        this.Hide();
                        mainform.Show();
                    }
                    else if (id == 5)
                    {
                        MessageBox.Show("Iventory Controller");
                        Inventory_Controller mainform = new Inventory_Controller();
                        this.Hide();
                        mainform.Show();
                    }

                    //MainForm mainform = new MainForm();
                    //this.Hide();
                    //mainform.Show();
                }
                else
                {
                    MessageBox.Show("Can not Login, contact with administrator", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text == "" || txtUser.Text == "")
            {
                MessageBox.Show("Can not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                User user = new User();
                user.Username = txtUser.Text;
                user.Password = txtPassword.Text;
                int count = user.Login(user);

                if (count == 10)
                {
                    MainForm mainform = new MainForm();
                    this.Hide();
                    mainform.Show();
                }

                else if (count == 11)
                {
                    SalesManager mainform = new SalesManager();
                    this.Hide();
                    mainform.Show();
                }

                else if (count == 12)
                {
                    OrderClerk mainform = new OrderClerk();
                    this.Hide();
                    mainform.Show();
                }

                else if (count == 13)
                {
                    Accountant mainform = new Accountant();
                    this.Hide();
                    mainform.Show();
                }

                else if (count == 14)
                {
                    Inventory_Controller mainform = new Inventory_Controller();
                    this.Hide();
                    mainform.Show();
                }

                else
                {
                    MessageBox.Show("Can not Login, please contact the administrator", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }