Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
 void load(DataTable bang)
 {
     if (kh.Count != 0)
     {
         for (int i = 0; i < kh.Count; i++)
         {
             kh.RemoveAt(i);
         }
         var bangKhoHang = bang;
         kh = XL_KhoHang.ChuyenDoiDTOKhoHang(bangKhoHang);
     }
 }