Exemple #1
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            FormNhanVien formNhanVien = new FormNhanVien();

            formNhanVien.ShowDialog();
            PhieuDangKi_User_Load(sender, e);
        }
Exemple #2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (ValidateChildren(ValidationConstraints.Enabled))
     {
         if (Login_BLL.Instance.CheckNguoiDung(txtUser.Text, txtPassword.Text) == true)
         {
             if (Login_BLL.Instance.GetNguoiDungByUserAndPW(txtUser.Text, txtPassword.Text).ID_QuyenHan == 1)
             {
                 FormQuanLy f = new FormQuanLy(txtUser.Text);
                 this.Visible = false;
                 f.ShowDialog();
                 this.Visible     = true;
                 txtUser.Text     = "";
                 txtPassword.Text = "";
             }
             else if (Login_BLL.Instance.GetNguoiDungByUserAndPW(txtUser.Text, txtPassword.Text).ID_QuyenHan == 2)
             {
                 FormNhanVien f = new FormNhanVien(txtUser.Text);
                 this.Visible = false;
                 f.ShowDialog();
                 this.Visible     = true;
                 txtUser.Text     = "";
                 txtPassword.Text = "";
             }
         }
         else
         {
             MessageBox.Show("Sai thong tin");
         }
     }
 }
Exemple #3
0
        private void BtnNhanVien_Click(object sender, EventArgs e)
        {
            FormNhanVien FNV = new FormNhanVien();

            this.Hide();
            FNV.ShowDialog();
            this.Show();
        }
Exemple #4
0
        private void nhânViênToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormNhanVien FNV = new FormNhanVien();

            this.Hide();
            FNV.ShowDialog();
            this.Show();
        }
Exemple #5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (Login_BLL.Instance.CheckNguoiDung(txtUser.Text, txtPassword.Text) == true)
            {
                if (Login_BLL.Instance.GetNguoiDungByUserAndPW(txtUser.Text, txtPassword.Text).ID_QuyenHan == 1)
                {
                    FormQuanLy f = new FormQuanLy();
                    f.ShowDialog();
                }
                else if (Login_BLL.Instance.GetNguoiDungByUserAndPW(txtUser.Text, txtPassword.Text).ID_QuyenHan == 2)
                {
                    FormNhanVien f = new FormNhanVien();
                    f.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("Sai thong tin");
            }
            //int checkql = 0;
            //int checknv = 0;
            //DHP_07Entities db = new DHP_07Entities();
            //var l1 = db.NguoiDungs.Select(p => p).ToList();
            //foreach (NguoiDung i in l1)
            //{
            //    if(txtUser.Text == i.Username.ToString() && txtPassword.Text == i.Password && i.ID_QuyenHan == 1)
            //    {
            //        checkql++;
            //        break;
            //    }
            //    else if(txtUser.Text == i.Username.ToString() && txtPassword.Text == i.Password && i.ID_QuyenHan == 2)
            //    {
            //        checknv++;
            //        break;
            //    }

            //}
            //if (checkql != 0)
            //{
            //    FormQuanLy f = new FormQuanLy();
            //    f.ShowDialog();
            //}
            //else if (checknv !=0)
            //{
            //    FormNhanVien f = new FormNhanVien();
            //    f.ShowDialog();
            //}
            //else
            //{
            //    MessageBox.Show("Sai thong tin");
            //}
        }
Exemple #6
0
        private void btnLogin_Click_1(object sender, EventArgs e)
        {
            Form newForm = null;

            try
            {
                switch (bll.GetChucDanh(Convert.ToInt32(this.txtAccount.Text), this.txtPassword.Text))
                {
                case "Quản Lý":
                {
                    newForm = new FormManager(Convert.ToInt32(this.txtAccount.Text));
                };
                    break;

                case "NV Nhập Hàng":
                {
                    newForm = new fNhapHang(Convert.ToInt32(this.txtAccount.Text));
                }
                break;

                case "NV Bán Hàng":
                {
                    newForm = new FormNhanVien(Convert.ToInt32(this.txtAccount.Text));
                }
                break;

                default:
                {
                    MessageBox.Show("Sai tài khoản hoặc mật khẩu!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button3, MessageBoxOptions.ServiceNotification);;
                    txtAccount.Focus();
                    break;
                }
                }
            }
            catch
            {
                MessageBox.Show("Xin hãy nhập tài khoản hoặc mật khẩu !! ", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button3, MessageBoxOptions.ServiceNotification);
                txtAccount.Focus();
            }
            if (newForm != null)
            {
                newForm.FormClosed += (s, eva) => this.Show();
                this.Hide();
                newForm.ShowDialog();
            }
        }