Exemple #1
0
        private void btnLogin_Click_1(object sender, EventArgs e)
        {
            string message  = null;
            string UserName = txtName.Text;
            string Password = txtSupplier.Text;

            if (!a.Required(txtName))
            {
                message += "Name is a required field\n";
            }
            if (!a.Required(txtSupplier))
            {
                message += "Password is a required field\n";
            }
            else
            {
                login = new BUS.C01_Login(UserName, Password);
                var acc = login.checkAccount();
                if (acc)
                {
                    this.Hide();
                    Cmart_GUI.C08_Product product = new Cmart_GUI.C08_Product();
                    product.ShowDialog();
                    this.Close();
                }
                else
                {
                    message += "User or Password is wrong\n ";
                }
            }
            if (message != null)
            {
                MessageBox.Show(message);
            }
        }
        private void productToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            C08_Product product = new C08_Product(lblName.Text);

            product.ShowDialog();
            this.Close();
        }
Exemple #3
0
        private void btnLogin_Click_1(object sender, EventArgs e)
        {
            string message  = null;
            string UserName = txtName.Text;
            string Password = txtSupplier.Text;

            if (!a.Required(txtName))
            {
                message += "Name is a required field\n";
            }
            if (!a.Required(txtSupplier))
            {
                message += "Password is a required field\n";
            }
            else
            {
                login = new BUS.C01_LoginBUS(UserName);
                var acc = login.FindAcc();
                if (acc != null)
                {
                    if (!a.Compare(Password, login.getPassWord()))
                    {
                        message += "User or Password is wrong\n ";
                    }
                    else
                    {
                        this.Hide();
                        int position = a.Compareposition(login.getPosition());
                        if (position == 0)
                        {
                            Cmart_GUI.C08_Product product = new Cmart_GUI.C08_Product(login.getFullName());
                            product.ShowDialog();
                        }
                        else if (position == 1)
                        {
                            Cmart_GUI.C04_HeadImport headImport = new Cmart_GUI.C04_HeadImport(login.getFullName(), login.getIDAcc());
                            headImport.ShowDialog();
                        }
                        else if (position == 2)
                        {
                            Cmart_GUI.C03_Bill bill = new Cmart_GUI.C03_Bill(login.getFullName(), login.getIDAcc());
                            bill.ShowDialog();
                        }
                        else if (position == 3)
                        {
                            Cmart_GUI.C05_BranchImport branch = new Cmart_GUI.C05_BranchImport(login.getFullName(), login.getIDAcc());
                            branch.ShowDialog();
                        }
                        else if (position == 4)
                        {
                            MessageBox.Show("Now app is not been update any function for your position.");
                        }
                        this.Close();
                    }
                }
                else
                {
                    message += "User is not existed";
                }
            }
            if (message != null)
            {
                MessageBox.Show(message);
            }
        }