private void FormKhoHang_Load(object sender, EventArgs e)
        {
            //lay khu vuc
            kv = XL_KhuVuc.ChuyenDoiDTOKhuVuc(XL_KhuVuc.LayDuLieuKhuVuc());
            //
            var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang();

            gridControl1.DataSource = bangKhoHang;
            kh = XL_KhoHang.ChuyenDoiDTOKhoHang(bangKhoHang);

            //phan quyen button
            for (int i = 0; i < vtcn.Count; i++)
            {
                if (vtcn[i].TenTrongHeThong == this.Tag.ToString())
                {
                    if (vtcn[i].Them == true)
                    {
                        simpleButtonThem.Enabled = true;
                    }
                    if (vtcn[i].Xoa == true)
                    {
                        simpleButtonXoa.Enabled = true;
                    }
                    if (vtcn[i].Sua == true)
                    {
                        simpleButtonSua.Enabled = true;
                    }
                    break;
                }
            }
            //phan quyen contextMenuStrip
            for (int i = 0; i < vtcn.Count; i++)
            {
                if (vtcn[i].TenTrongHeThong == this.Tag.ToString())
                {
                    for (int j = 0; j < contextMenuStrip1.Items.Count; j++)
                    {
                        if (contextMenuStrip1.Items[j].Text == "Thêm" && vtcn[i].Them == true)
                        {
                            contextMenuStrip1.Items[j].Enabled = true;
                        }
                        if (contextMenuStrip1.Items[j].Text == "Xóa" && vtcn[i].Xoa == true)
                        {
                            contextMenuStrip1.Items[j].Enabled = true;
                        }
                        if (contextMenuStrip1.Items[j].Text == "Sửa" && vtcn[i].Sua == true)
                        {
                            contextMenuStrip1.Items[j].Enabled = true;
                        }
                    }
                    break;
                }
            }
        }
        private void simpleButtonThem_Click(object sender, EventArgs e)
        {
            load(XL_KhoHang.LayDuLieuKhoHang());
            //
            FormKhoHangThem them = new FormKhoHangThem(kh, kv);

            them.ShowDialog();
            //
            var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang();

            gridControl1.DataSource = bangKhoHang;
        }
        private void ToolStripMenuItemSua_Click(object sender, EventArgs e)
        {
            load(XL_KhoHang.LayDuLieuKhoHang());
            //
            FormKhoHangSua sua = new FormKhoHangSua(kh, kv);

            sua.ShowDialog();
            //
            var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang();

            gridControl1.DataSource = bangKhoHang;
        }
        private void simpleButtonXoa_Click(object sender, EventArgs e)
        {
            load(XL_KhoHang.LayDuLieuKhoHang());
            //
            FormKhoHangXoa xoa = new FormKhoHangXoa(kh);

            xoa.ShowDialog();
            //
            var bangKhoHang = XL_KhoHang.LayDuLieuKhoHang();

            gridControl1.DataSource = bangKhoHang;
        }
Beispiel #5
0
 private void FormMuaHangPhieu_Load(object sender, EventArgs e)
 {
     //hinhthucthanhtoan
     gridLookUpEditHinhThucThanhToan.Properties.DataSource    = XL_HinhThucThanhToan.LayDuLieuHinhThucThanhToan();
     gridLookUpEditHinhThucThanhToan.Properties.DisplayMember = "MaHinhThuc";
     //nhanvien
     gridLookUpEditNhanVien.Properties.DataSource    = XL_NhanVien.LayDuLieuNhanVien();
     gridLookUpEditNhanVien.Properties.DisplayMember = "MaNV";
     //kho
     gridLookUpEditKho.Properties.DataSource    = XL_KhoHang.LayDuLieuKhoHang();
     gridLookUpEditKho.Properties.DisplayMember = "MaKho";
     //dieu khoan
     gridLookUpEditDieuKhoanThanhToan.Properties.DataSource    = XL_DieuKhoan.LayDuLieuDieuKhoan();
     gridLookUpEditDieuKhoanThanhToan.Properties.DisplayMember = "MaDieuKhoan";
     //ncc
     gridLookUpEditNCC.Properties.DataSource    = XL_NhaCungCap.LayDuLieuNhaCungCap();
     gridLookUpEditNCC.Properties.DisplayMember = "MaNhaCungCap";
     //datagridn sp
     MaSP.DataSource    = XL_SanPham.LayDuLieuSanPham();
     MaSP.DisplayMember = "MaSP";
     sp = XL_SanPham.ChuyenDoiDTOSanPham(XL_SanPham.LayDuLieuSanPham());
     // ct phieu nhap
     ctpn = XL_CTPhieuNhap.ChuyenDoiDTOCTPhieuNhap(XL_CTPhieuNhap.LayCTPhieuNhap());
 }