private void LoadChinhSachGia()
        {
            try
            {
                BangGiaChiTietInfor bgct = (BangGiaChiTietInfor)gvSanPham.GetRow(gvSanPham.FocusedRowHandle);

                List <BangGiaChinhSachInfor> liChinhSach =
                    ChinhSachDataProvider.Instance.GetAllChinhSachDaApDung(bangGia.IdTrungTam, bgct.MaSanPham,
                                                                           mstNgayLap.Value);
                if (liChinhSach != null && liChinhSach.Count > 0)
                {
                    frmCS_BangGia_ViewKhuyenMai frm = new frmCS_BangGia_ViewKhuyenMai(liChinhSach, bgct);
                    frm.ShowDialog();
                }
            }
            catch { }
        }
        private void ChinhSachApDung_Click(object sender, EventArgs e)
        {
            BangGiaBanChiTietBCInfor bgInfor = (BangGiaBanChiTietBCInfor)gvListSanPham.GetFocusedRow();

            if (bgInfor != null)
            {
                int idTrungTam = bteTrungTam.Tag != null
                                     ? ((DMTrungTamInfor)bteTrungTam.Tag).IdTrungTam
                                     : Declare.IdTrungTam;
                DateTime ngayLap = CommonProvider.Instance.GetSysDate();

                List <BangGiaChinhSachInfor> liCSachs =
                    ChinhSachDataProvider.Instance.GetAllChinhSachDaApDung(idTrungTam, bgInfor.MaSanPham, ngayLap);
                List <BangGiaChinhSachInfor> liChinhSach = new List <BangGiaChinhSachInfor>();
                foreach (BangGiaChinhSachInfor cs in liCSachs)
                {
                    string lstMatHangKhongAD = String.Format(",{0},", cs.MatHangKhongApDung);//khong nam trong danh sach ko duoc ap dung
                    if (!lstMatHangKhongAD.Contains(String.Format(",{0},", bgInfor.IdSanPham)))
                    {
                        liChinhSach.Add(cs);
                    }
                }
                //List<BangGiaChinhSachInfor> liChinhSach =
                //    ChinhSachDataProvider.Instance.GetAllChinhSachDaApDung(bgInfor.IdTrungTam, bgInfor.MaSanPham,
                //                                                           CommonProvider.Instance.GetSysDate());

                if (liChinhSach != null && liChinhSach.Count > 0)
                {
                    BangGiaChiTietInfor bgct = new BangGiaChiTietInfor()
                    {
                        MaSanPham   = bgInfor.MaSanPham,
                        TenSanPham  = bgInfor.TenSanPham,
                        DonViTinh   = bgInfor.TenDonViTinh,
                        DonGiaCoVAT = bgInfor.DonGiaCoVAT
                    };
                    frmCS_BangGia_ViewKhuyenMai frm = new frmCS_BangGia_ViewKhuyenMai(liChinhSach, bgct);
                    frm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Không có chính sách giá cho sản phẩm này!");
                }
            }
        }