Beispiel #1
0
        private static List <VaiTro_ChucNangDTO> LayListVTCN(string mavt)
        {
            string sql = "select vc.*, cn.TenTrongHeThong " +
                         "from VAITRO_CHUCNANG vc, CHUCNANG cn " +
                         "where vc.MaChucNang = cn.MaChucNang and vc.MaVaiTro = '" + mavt + "'";

            ConnectionDB connectionDB = new ConnectionDB();

            connectionDB.OpenConnection();

            List <VaiTro_ChucNangDTO> lstVTCN = new List <VaiTro_ChucNangDTO>();

            DataTable dt = connectionDB.Select(CommandType.Text, sql);

            foreach (DataRow row in dt.Rows)
            {
                VaiTro_ChucNangDTO vc = new VaiTro_ChucNangDTO();
                vc.MaVaiTro        = row["MaVaiTro"].ToString();
                vc.MaChucNang      = int.Parse(row["MaChucNang"].ToString());
                vc.TatCa           = bool.Parse(row["TatCa"].ToString()) == true ? 1 : 0;
                vc.TruyCap         = bool.Parse(row["TruyCap"].ToString()) == true ? 1 : 0;
                vc.Them            = bool.Parse(row["Them"].ToString()) == true ? 1 : 0;
                vc.Xoa             = bool.Parse(row["Xoa"].ToString()) == true ? 1 : 0;
                vc.Sua             = bool.Parse(row["Sua"].ToString()) == true ? 1 : 0;
                vc.InAn            = bool.Parse(row["InAn"].ToString()) == true ? 1 : 0;
                vc.Nhap            = bool.Parse(row["Nhap"].ToString()) == true ? 1 : 0;
                vc.Xuat            = bool.Parse(row["Xuat"].ToString()) == true ? 1 : 0;
                vc.TenTrongHeThong = row["TenTrongHeThong"].ToString();

                lstVTCN.Add(vc);
            }
            return(lstVTCN);
        }
Beispiel #2
0
        private void PHANQUYEN(string mavt)
        {
            List <VaiTro_ChucNangDTO> lstVTCN = LayListVTCN(mavt);

            ArrayList arrayRBC = rbcMain.TotalPageCategory.GetVisiblePages();

            foreach (RibbonPage page in arrayRBC)
            {
                VaiTro_ChucNangDTO VTofPage = LayVTCN(page.Name, lstVTCN);
                if (VTofPage != null)
                {
                    page.Visible = VTofPage.TruyCap == 0 ? false : true;
                }

                foreach (RibbonPageGroup group in page.Groups)
                {
                    VaiTro_ChucNangDTO VTofPageGroup = LayVTCN(group.Name, lstVTCN);
                    if (VTofPageGroup != null)
                    {
                        group.Visible = VTofPageGroup.TruyCap == 0 ? false : true;
                    }

                    foreach (BarItemLink link in group.ItemLinks)
                    {
                        VaiTro_ChucNangDTO VTofButton = LayVTCN(link.Item.Name, lstVTCN);
                        if (VTofButton != null)
                        {
                            link.Item.Tag     = VTofButton;
                            link.Item.Enabled = VTofButton.TruyCap == 0 ? false : true;
                        }
                    }
                }
            }
        }
        public int ThemVTCN(VaiTro_ChucNangDTO vtcn)
        {
            string sql = string.Format("insert into VAITRO_CHUCNANG values" +
                                       "('{0}',{1},{2},{3},{4},{5},{6},{7},{8},{9})", vtcn.MaVaiTro, vtcn.MaChucNang, vtcn.TatCa, vtcn.TruyCap, vtcn.Them, vtcn.Xoa, vtcn.Sua, vtcn.InAn, vtcn.Nhap, vtcn.Xuat);

            return(Execute.InsertUpdateDelete(sql));
        }
        public frmWarehouse(VaiTro_ChucNangDTO pqkh, string un)
        {
            InitializeComponent();

            user = un;

            //radial menu
            rdmThem.CloseRadialMenuOnItemClick = true;
            rdm_Sua.CloseRadialMenuOnItemClick = true;
            rdmXoa.CloseRadialMenuOnItemClick  = true;

            //phân quyền dựa vào bảng vai trò chức năng đã được gửi qua
            if (pqkh != null)
            {
                if (pqkh.Them == 0)
                {
                    btnAdd.Enabled  = false;
                    rdmThem.Enabled = false;
                }
                if (pqkh.Xoa == 0)
                {
                    btnDelete.Enabled = false;
                    rdmXoa.Enabled    = false;
                }
                if (pqkh.Sua == 0)
                {
                    btnUpdate.Enabled      = false;
                    rdm_Sua.Enabled        = false;
                    gvKhoHang.DoubleClick -= BtnSua_Click;
                }
            }
        }
        public int SuaVTCN(VaiTro_ChucNangDTO vtcn)
        {
            string sql = "update VAITRO_CHUCNANG " +
                         string.Format("set TatCa={0} , TruyCap={1} , Them={2} , Xoa={3} , Sua={4} , InAn={5} , Nhap={6} , Xuat={7}  where MaVaiTro ='{8}' and MaChucNang={9}",
                                       vtcn.TatCa, vtcn.TruyCap, vtcn.Them, vtcn.Xoa, vtcn.Sua, vtcn.InAn, vtcn.Nhap, vtcn.Xuat, vtcn.MaVaiTro, vtcn.MaChucNang);

            return(ConnectionDB.ExcuteNonQuery(sql));
        }
Beispiel #6
0
        public frmArea(VaiTro_ChucNangDTO phanquyenkv, string username)
        {
            InitializeComponent();

            Load += new EventHandler(FrmArea_Load);

            user = username;

            //sự kiện button
            btnThem.ItemClick   += BtnThem_Click;
            barUpdate.ItemClick += BtnSua_Click;
            btnXoa.ItemClick    += BtnXoa_Click;

            //button radial menu
            rdmDong.ItemClick += RdmDong_ItemClick;
            rdmThem.ItemClick += BtnThem_Click;
            rdmSua.ItemClick  += BtnSua_Click;
            rdmXoa.ItemClick  += BtnXoa_Click;

            //radial menu
            rdmThem.CloseRadialMenuOnItemClick = true;
            rdmSua.CloseRadialMenuOnItemClick  = true;
            rdmXoa.CloseRadialMenuOnItemClick  = true;

            gvKhuVuc.DoubleClick += BtnSua_Click;

            //phân quyền dựa vào bảng vai trò chức năng đã được gửi qua
            if (phanquyenkv != null)
            {
                if (phanquyenkv.Them == 0)
                {
                    btnThem.Enabled = false;
                    rdmThem.Enabled = false;
                }
                if (phanquyenkv.Xoa == 0)
                {
                    btnXoa.Enabled = false;
                    rdmXoa.Enabled = false;
                }
                if (phanquyenkv.Xuat == 0)
                {
                    btnXuat.Enabled = false;
                    rdmXuat.Enabled = false;
                }
                if (phanquyenkv.Sua == 0)
                {
                    barUpdate.Enabled     = false;
                    rdmSua.Enabled        = false;
                    gvKhuVuc.DoubleClick -= BtnSua_Click;
                }
            }
        }
Beispiel #7
0
 public frmInventory(VaiTro_ChucNangDTO pqtk, string un)
 {
     InitializeComponent();
     user = un;
     //phân quyền dựa vào bảng vai trò chức năng đã được gửi qua
     if (pqtk != null)
     {
         if (pqtk.Xuat == 0)
         {
             btnXuat.Enabled = false;
         }
     }
 }
Beispiel #8
0
        private void BtnSell_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmSell));
            VaiTro_ChucNangDTO phanquyenBH = btnBanHang.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmSell fSell = new frmSell(phanquyenBH, username);
                fSell.ThemNhatKyHeThong += ThemNhatKy_Main;
                fSell.MdiParent          = this;
                fSell.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #9
0
        private void BtnChungTu_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmDocumentManagement));
            VaiTro_ChucNangDTO pqct = btnChungTu.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmDocumentManagement fDocumentManagement = new frmDocumentManagement(pqct, username);
                fDocumentManagement.ThemNhatKyHeThong += ThemNhatKy_Main;
                fDocumentManagement.MdiParent          = this;
                fDocumentManagement.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #10
0
        private void BtnPhanQuyen_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmPQ)); // kiếm tra frmRole có đang show hay không

            if (f == null)                    // nếu == null thì show ra
            {
                VaiTro_ChucNangDTO phanquyenPQ = btnPhanQuyen.Tag as VaiTro_ChucNangDTO;
                frmPQ formRole = new frmPQ(phanquyenPQ, username);
                formRole.ThemNhatKyHeThong += ThemNhatKy_Main;
                formRole.MdiParent          = this;
                formRole.Show();
            }
            else
            {
                f.Activate(); // nếu frmRole đang show thì focus nó
            }
        }
Beispiel #11
0
        private void BtnThuTien_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmCollectMoney));
            VaiTro_ChucNangDTO pqtt = btnThuTien.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmCollectMoney fCollectMoney = new frmCollectMoney(pqtt, username);
                fCollectMoney.ThemNhatKyHeThong += ThemNhatKy_Main;
                fCollectMoney.MdiParent          = this;
                fCollectMoney.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #12
0
        private void BtnPay_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmPay));
            VaiTro_ChucNangDTO pqct = btnTraTien.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmPay fPay = new frmPay(pqct, username);
                fPay.ThemNhatKyHeThong += ThemNhatKy_Main;
                fPay.MdiParent          = this;
                fPay.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #13
0
        private void BtnKhoHang_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmWarehouse));

            if (f == null)
            {
                VaiTro_ChucNangDTO phanquyenKho = btnKhoHang.Tag as VaiTro_ChucNangDTO;

                frmWarehouse frmWarehouse = new frmWarehouse(phanquyenKho, username);
                frmWarehouse.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmWarehouse.MdiParent          = this;
                frmWarehouse.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #14
0
        private void BtnHangHoa_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmGoods));

            if (f == null)
            {
                VaiTro_ChucNangDTO phanquyenHH = btnHangHoa.Tag as VaiTro_ChucNangDTO;

                frmGoods frmGoods = new frmGoods(phanquyenHH, username);
                frmGoods.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmGoods.MdiParent          = this;
                frmGoods.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #15
0
        private void BtnDVT_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmUnit));

            if (f == null)
            {
                VaiTro_ChucNangDTO pqdvt = btnDonViTinh.Tag as VaiTro_ChucNangDTO;

                frmUnit frmUnit = new frmUnit(pqdvt, username);
                frmUnit.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmUnit.MdiParent          = this;
                frmUnit.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #16
0
        private void BtnBoPhan_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmDepartment));

            if (f == null)
            {
                VaiTro_ChucNangDTO pqbp = btnBoPhan.Tag as VaiTro_ChucNangDTO;

                frmDepartment frmDepartment = new frmDepartment(pqbp, username);
                frmDepartment.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmDepartment.MdiParent          = this;
                frmDepartment.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #17
0
        private void BtnNhanVien_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmEmployees));

            if (f == null)
            {
                VaiTro_ChucNangDTO pqnv = btnNhanVien.Tag as VaiTro_ChucNangDTO;

                frmEmployees frmEmployees = new frmEmployees(pqnv, username);
                frmEmployees.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmEmployees.MdiParent          = this;
                frmEmployees.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #18
0
        private void BtnArea_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmArea));

            if (f == null)
            {
                VaiTro_ChucNangDTO pqkv = btnKhuVuc.Tag as VaiTro_ChucNangDTO;

                frmArea frmArea = new frmArea(pqkv, username);
                frmArea.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmArea.MdiParent          = this;
                frmArea.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #19
0
        private void BtnTonKho_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmInventory));

            VaiTro_ChucNangDTO pqtk = btnTonKho.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmInventory fInventory = new frmInventory(pqtk, username);
                fInventory.ThemNhatKyHeThong += ThemNhatKy_Main;
                fInventory.MdiParent          = this;
                fInventory.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #20
0
        private void BtnWarehouseTransfer_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmWarehouseTransfer));

            VaiTro_ChucNangDTO pqck = btnChuyenKho.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmWarehouseTransfer fWarehouseTransfer = new frmWarehouseTransfer(pqck, username);
                fWarehouseTransfer.ThemNhatKyHeThong += ThemNhatKy_Main;
                fWarehouseTransfer.MdiParent          = this;
                fWarehouseTransfer.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #21
0
        private void BtnBaoCaoBanHang_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmSalesReport));

            VaiTro_ChucNangDTO pqbc = btnBCKhoHang.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmSalesReport fSalesReport = new frmSalesReport(pqbc, username);
                fSalesReport.ThemNhatKyHeThong += ThemNhatKy_Main;
                fSalesReport.MdiParent          = this;
                fSalesReport.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #22
0
        private void BtnCustomer_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmCustomer));

            if (f == null)
            {
                VaiTro_ChucNangDTO phanquyenKH = btnKhachHang.Tag as VaiTro_ChucNangDTO;

                frmCustomer frmCustomer = new frmCustomer(phanquyenKH, username);
                frmCustomer.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmCustomer.MdiParent          = this;
                frmCustomer.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #23
0
        private void BtnBuy_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmBuy));

            VaiTro_ChucNangDTO phanquyenMH = btnMuaHang.Tag as VaiTro_ChucNangDTO;

            if (f == null)
            {
                frmBuy fBuy = new frmBuy(phanquyenMH, username);
                fBuy.ThemNhatKyHeThong += ThemNhatKy_Main;
                fBuy.MdiParent          = this;
                fBuy.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #24
0
        private void BtnSupplier_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmSupplier));

            if (f == null)
            {
                VaiTro_ChucNangDTO pqncc = btnNCC.Tag as VaiTro_ChucNangDTO;

                frmSupplier fSupplier = new frmSupplier(pqncc, username);
                fSupplier.ThemNhatKyHeThong += ThemNhatKy_Main;
                fSupplier.MdiParent          = this;
                fSupplier.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #25
0
        private void BtnGroupOfGoods_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmGroupOfGoods));

            if (f == null)
            {
                VaiTro_ChucNangDTO pqdvt = btnNhomHang.Tag as VaiTro_ChucNangDTO;

                frmGroupOfGoods fGroupOfGoods = new frmGroupOfGoods(pqdvt, username);
                fGroupOfGoods.ThemNhatKyHeThong += ThemNhatKy_Main;
                fGroupOfGoods.MdiParent          = this;
                fGroupOfGoods.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #26
0
        private void BtnTyGia_ItemClick(object sender, ItemClickEventArgs e)
        {
            Form f = IsActive(typeof(frmCurency));

            if (f == null)
            {
                VaiTro_ChucNangDTO pqtg = btnTyGia.Tag as VaiTro_ChucNangDTO;

                frmCurency frmRates = new frmCurency(pqtg, username);
                frmRates.ThemNhatKyHeThong += ThemNhatKy_Main;
                frmRates.MdiParent          = this;
                frmRates.Show();
            }
            else
            {
                f.Activate();
            }
        }
Beispiel #27
0
        public frmSupplier(VaiTro_ChucNangDTO phanquyenncc, string un)
        {
            InitializeComponent();

            user = un;

            //radial menu
            rdmSua.CloseRadialMenuOnItemClick  = true;
            rdmThem.CloseRadialMenuOnItemClick = true;
            rdmXoa.CloseRadialMenuOnItemClick  = true;

            //phân quyền dựa vào bảng vai trò chức năng đã được gửi qua
            if (phanquyenncc != null)
            {
                if (phanquyenncc.Them == 0)
                {
                    barAdd.Enabled  = false;
                    rdmThem.Enabled = false;
                }
                if (phanquyenncc.Xoa == 0)
                {
                    barDel.Enabled = false;
                    rdmXoa.Enabled = false;
                }
                if (phanquyenncc.Nhap == 0)
                {
                    barImport.Enabled = false;
                    rdmNhap.Enabled   = false;
                }
                if (phanquyenncc.Xuat == 0)
                {
                    barXuat.Enabled = false;
                    rdmXuat.Enabled = false;
                }
                if (phanquyenncc.Sua == 0)
                {
                    barEdit.Enabled            = false;
                    rdmSua.Enabled             = false;
                    grcNhaCungCap.DoubleClick -= BtnSua_Click;
                }
            }
        }
Beispiel #28
0
        public frmGoods(VaiTro_ChucNangDTO phanquyenHH, string un)
        {
            InitializeComponent();

            user = un;

            rdmHangHoa.AutoExpand              = true;
            rdmSua.CloseRadialMenuOnItemClick  = true;
            rdmThem.CloseRadialMenuOnItemClick = true;
            rdmXoa.CloseRadialMenuOnItemClick  = true;

            //phân quyền dựa vào bảng vai trò chức năng đã được gửi qua
            if (phanquyenHH != null)
            {
                if (phanquyenHH.Them == 0)
                {
                    btnAdd.Enabled  = false;
                    rdmThem.Enabled = false;
                }
                if (phanquyenHH.Xoa == 0)
                {
                    btnDelete.Enabled = false;
                    rdm_Xoa.Enabled   = false;
                }
                if (phanquyenHH.Nhap == 0)
                {
                    btnNhap.Enabled = false;
                    rdmNhap.Enabled = false;
                }
                if (phanquyenHH.Xuat == 0)
                {
                    btnXuat.Enabled = false;
                    rdmXuat.Enabled = false;
                }
                if (phanquyenHH.Sua == 0)
                {
                    btnUpdate.Enabled             = false;
                    rdmSua.Enabled                = false;
                    grvHangHoaDichVu.DoubleClick -= btnSua_click;
                }
            }
        }
        public frmGroupOfGoods(VaiTro_ChucNangDTO phanquyennh, string un)
        {
            InitializeComponent();

            user = un;

            //radial menu
            rdmSua.CloseRadialMenuOnItemClick  = true;
            rdmThem.CloseRadialMenuOnItemClick = true;
            rdm_Xoa.CloseRadialMenuOnItemClick = true;

            //phân quyền dựa vào bảng vai trò chức năng đã được gửi qua
            if (phanquyennh != null)
            {
                if (phanquyennh.Them == 0)
                {
                    btnAdd.Enabled  = false;
                    rdmThem.Enabled = false;
                }
                if (phanquyennh.Xoa == 0)
                {
                    btnDelete.Enabled = false;
                    rdm_Xoa.Enabled   = false;
                }
                if (phanquyennh.Nhap == 0)
                {
                    btnNhap.Enabled = false;
                    rdmNhap.Enabled = false;
                }
                if (phanquyennh.Xuat == 0)
                {
                    btnXuat.Enabled = false;
                    rdmXuat.Enabled = false;
                }
                if (phanquyennh.Sua == 0)
                {
                    btnUpdate.Enabled       = false;
                    rdmSua.Enabled          = false;
                    gvNhomHang.DoubleClick -= BtnSua_Click;
                }
            }
        }
Beispiel #30
0
        public frmCustomer(VaiTro_ChucNangDTO phanquyenKH, string un)
        {
            InitializeComponent();

            user = un;

            //radial menu
            rdmSua.CloseRadialMenuOnItemClick  = true;
            rdmThem.CloseRadialMenuOnItemClick = true;
            rdmXoa.CloseRadialMenuOnItemClick  = true;

            if (phanquyenKH != null)
            {
                if (phanquyenKH.Them == 0)
                {
                    barAdd.Enabled  = false;
                    rdmThem.Enabled = false;
                }
                if (phanquyenKH.Xoa == 0)
                {
                    barDel.Enabled = false;
                    rdmXoa.Enabled = false;
                }
                if (phanquyenKH.Nhap == 0)
                {
                    barImport.Enabled = false;
                    rdmNhap.Enabled   = false;
                }
                if (phanquyenKH.Xuat == 0)
                {
                    btnExport.Enabled = false;
                    rdmXuat.Enabled   = false;
                }
                if (phanquyenKH.Sua == 0)
                {
                    barEdit.Enabled = false;
                    rdmSua.Enabled  = false;
                    // treeListKH.DoubleClick -= BtnSua_Click;
                }
            }
        }