private void ShowData()
 {
     try
     {
         // Lấy dữ liệu từ form điều kiện
         List <HT_BAOCAO_TSO>    listHtBaoCaoTso = new List <HT_BAOCAO_TSO>();
         DatabaseConstant.Action action          = DatabaseConstant.Action.TRUY_VAN;
         DataSet ds = null;
         // Lấy báo cáo được chọn từ grid
         DataRowView dr              = (DataRowView)grDSBaoCao.SelectedItem;
         int         idBaoCao        = int.Parse(dr[0].ToString());
         int         idBaoCaoCha     = int.Parse(dr[4].ToString());
         string      maBaoCao        = dr[2].ToString();
         string      responseMessage = "";
         if (idBaoCao > 0)
         {
             MethodInfo mi             = uc.GetType().GetMethod("GetParameters");
             Delegate   dieuKienBaoCao = Delegate.CreateDelegate(typeof(DieuKienBaoCao), uc, mi);
             if (!LObject.IsNullOrEmpty(dieuKienBaoCao))
             {
                 KhaiThacDuLieuProcess          process           = new KhaiThacDuLieuProcess();
                 DieuKienBaoCao                 dlgdieukienBaoCao = (DieuKienBaoCao)dieuKienBaoCao;
                 List <Tuple <string, string> > dsDieuKienBC;
                 dlgdieukienBaoCao(out dsDieuKienBC);
                 foreach (Tuple <string, string> tuple in dsDieuKienBC)
                 {
                     HT_BAOCAO_TSO tso = new HT_BAOCAO_TSO();
                     tso.MA_TSO   = tuple.Item2;
                     tso.LOAI_TSO = ApplicationConstant.LoaiThamSoBaoCao.SQL.layGiaTri();
                     tso.GTRI_TSO = tuple.Item1;
                     listHtBaoCaoTso.Add(tso);
                 }
                 if (process.DuLieuChiTieu(action, idBaoCao, ref htBaoCao, ref listHtBaoCaoTso, ref ds, ref responseMessage) == ApplicationConstant.ResponseStatus.THANH_CONG)
                 {
                     mi = uc.GetType().GetMethod("BuildData");
                     Delegate buildDLBaoCao = Delegate.CreateDelegate(typeof(BuildDuLieuBaoCao), uc, mi);
                     if (!LObject.IsNullOrEmpty(buildDLBaoCao))
                     {
                         BuildDuLieuBaoCao dlgbuildDLBaoCao = (BuildDuLieuBaoCao)buildDLBaoCao;
                         dlgbuildDLBaoCao(ds);
                     }
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
         CommonFunction.ThongBaoLoi(ex);
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
 }
        private void BuildFormDieuKien()
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (grDSBaoCao.SelectedItems.Count > 0)
                {
                    // Lấy báo cáo được chọn từ grid
                    DataRowView dr          = (DataRowView)grDSBaoCao.SelectedItem;
                    int         idBaoCao    = int.Parse(dr[0].ToString());
                    int         idBaoCaoCha = int.Parse(dr[4].ToString());
                    string      maBaoCao    = dr[2].ToString();

                    // Lấy thông tin báo cáo và tham số
                    if (idBaoCaoCha != 0)
                    {
                        KhaiThacDuLieuProcess process          = new KhaiThacDuLieuProcess();
                        ApplicationConstant.ResponseStatus ret = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG;
                        List <HT_BAOCAO_TSO>    lstBaoCaoTso   = new List <HT_BAOCAO_TSO>();
                        DatabaseConstant.Action action         = DatabaseConstant.Action.TRUY_VAN;
                        string responseMessage = "";
                        process.DuLieuChiTieu(action, idBaoCao, ref htBaoCao, ref lstBaoCaoTso, ref responseMessage);
                        string uriBaoCaoDieuKien = "/" + htBaoCao.NHOM_DIEUKIEN + ";component/" + htBaoCao.FILE_DIEUKIEN;

                        uc = (UserControl)System.Windows.Application.LoadComponent(new Uri(uriBaoCaoDieuKien, System.UriKind.RelativeOrAbsolute));
                        if (!LObject.IsNullOrEmpty(uc.GetType().GetProperty("MaBaoCao")))
                        {
                            uc.GetType().GetProperty("MaBaoCao").SetValue(uc, maBaoCao, null);
                        }
                        frFormInput.Content = uc;
                    }
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }