Пример #1
0
        private void btnNH_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Form frm = this.KiemTraTonTai(typeof(frmNhapHang));

            if (frm != null)
            {
                frm.Activate();
            }
            else
            {
                frmNhapHang nh = new frmNhapHang();
                nh.MdiParent = this;
                nh.Dock      = DockStyle.Fill;
                nh.Show();
            }
        }
Пример #2
0
        public void SetTrangThaiDangNhap(NhanVienDTO nv)
        {
            NhanVienDN = nv;
            if (NhanVienDN.MaLoaiNV != null)
            {
                btnDN.Enabled = true;


                if (NhanVienDN.MaLoaiNV == "QUẢN LÝ")
                {
                    lblXC.Visible          = true;
                    ribbonControl1.Visible = true;
                    lblLNV.Visible         = true;

                    Form frm = this.KiemTraTonTai(typeof(frmBanHang));
                    if (frm != null)
                    {
                        frm.Activate();
                    }
                    else
                    {
                        frmBanHang bh = new frmBanHang();
                        bh.MdiParent = this;
                        bh.Dock      = DockStyle.Fill;
                        bh.Show();
                    }

                    lblXC.Text  = "Xin chào: " + NhanVienDN.HoTenNV;
                    lblLNV.Text = NhanVienDN.MaLoaiNV;

                    btnDSSP.Enabled = true;
                    btnDSNV.Enabled = true;
                    btnNCC.Enabled  = true;
                    btnKH.Enabled   = true;
                    btnHDN.Enabled  = true;
                    btnHDX.Enabled  = true;
                    btnTK.Enabled   = true;
                    btnIHD.Enabled  = true;
                    btnDMK.Enabled  = true;
                    btnBH.Enabled   = true;
                    btnDX.Enabled   = true;
                    btnNH.Enabled   = true;
                    btnBCTK.Enabled = true;
                    btnDN.Enabled   = false;
                }
                else
                {
                    if (NhanVienDN.MaLoaiNV == "BÁN HÀNG")
                    {
                        ribbonControl1.Visible = true;
                        lblXC.Visible          = true;
                        lblLNV.Visible         = true;

                        Form frm = this.KiemTraTonTai(typeof(frmBanHang));
                        if (frm != null)
                        {
                            frm.Activate();
                        }
                        else
                        {
                            frmBanHang bh = new frmBanHang();
                            bh.MdiParent = this;
                            bh.Dock      = DockStyle.Fill;
                            bh.Show();
                        }


                        lblXC.Text  = "Xin chào: " + NhanVienDN.HoTenNV;
                        lblLNV.Text = NhanVienDN.MaLoaiNV;

                        btnDSSP.Enabled = false;
                        btnDSNV.Enabled = false;
                        btnNCC.Enabled  = false;
                        btnKH.Enabled   = false;
                        btnHDN.Enabled  = false;
                        btnHDX.Enabled  = false;
                        btnTK.Enabled   = false;
                        btnIHD.Enabled  = false;
                        btnDMK.Enabled  = true;
                        btnBH.Enabled   = true;
                        btnDX.Enabled   = true;
                        btnNH.Enabled   = true;
                        btnDN.Enabled   = false;
                    }
                    else
                    {
                        lblXC.Visible          = true;
                        ribbonControl1.Visible = true;
                        lblLNV.Visible         = true;

                        Form frm = this.KiemTraTonTai(typeof(frmNhapHang));
                        if (frm != null)
                        {
                            frm.Activate();
                        }
                        else
                        {
                            frmNhapHang nh = new frmNhapHang();
                            nh.MdiParent = this;
                            nh.Dock      = DockStyle.Fill;
                            nh.Show();
                        }


                        lblXC.Text  = "Xin chào: " + NhanVienDN.HoTenNV;
                        lblLNV.Text = NhanVienDN.MaLoaiNV;

                        btnDSSP.Enabled = false;
                        btnDSNV.Enabled = false;
                        btnNCC.Enabled  = false;
                        btnKH.Enabled   = false;
                        btnHDN.Enabled  = false;
                        btnHDX.Enabled  = false;
                        btnTK.Enabled   = false;
                        btnIHD.Enabled  = false;
                        btnDMK.Enabled  = true;
                        btnBH.Enabled   = false;
                        btnDX.Enabled   = true;
                        btnNH.Enabled   = true;
                        btnDN.Enabled   = false;
                    }
                }
            }
        }