/// <summary> /// Thuc hien tong hop /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tlbView_Click(object sender, RoutedEventArgs e) { try { Mouse.OverrideCursor = Cursors.Wait; // Lấy dữ liệu từ form điều kiện List <HT_BAOCAO_TSO> listHtBaoCaoTso = lstHtBaoCaoTso; List <ThamSoBaoCao> listThamSoBaoCao = new List <ThamSoBaoCao>(); DatabaseConstant.Action action = DatabaseConstant.Action.IN; listThamSoBaoCao = this.GetParameters(); int soNgayTongHop = LDateTime.CountDayBetweenDates( LDateTime.StringToDate(TuNgay, ApplicationConstant.defaultDateTimeFormat), LDateTime.StringToDate(DenNgay, ApplicationConstant.defaultDateTimeFormat)); progbarTongHop.Minimum = 0; progbarTongHop.Maximum = soNgayTongHop + INT_ONE; progbarTongHop.Value = 0; UpdateProgressBarDelegate updatePbDelegate = new UpdateProgressBarDelegate(progbarTongHop.SetValue); string tuNgay = TuNgay; double value = INT_ZERO; progbarPercent.Content = "0%"; do { processDate.Content = LDateTime.StringToDate(tuNgay, ApplicationConstant.defaultDateTimeFormat).DateToString("dd/MM/yyyy"); DataSet ds = new DataSet(); // Chuẩn bị điều kiện cho báo cáo if (listThamSoBaoCao != null && listThamSoBaoCao.Count > 0) { listHtBaoCaoTso = new List <HT_BAOCAO_TSO>(); foreach (ThamSoBaoCao thamSoBaoCao in listThamSoBaoCao) { HT_BAOCAO_TSO tso = new HT_BAOCAO_TSO(); tso.MA_TSO = thamSoBaoCao.MaThamSo; tso.LOAI_TSO = thamSoBaoCao.LoaiThamSo; if (tso.MA_TSO != "@TuNgay" && tso.MA_TSO != "@DenNgay") { tso.GTRI_TSO = thamSoBaoCao.GiaTriThamSo; } else { tso.GTRI_TSO = tuNgay; } listHtBaoCaoTso.Add(tso); if (!LObject.IsNullOrEmpty(thamSoBaoCao.DsThamSo)) { ds = thamSoBaoCao.DsThamSo; } } } ApplicationConstant.ResponseStatus retStatus = ApplicationConstant.ResponseStatus.KHONG_THANH_CONG; FileBase fileResponse = new FileBase(); List <FileBase> lstFileResponse = new List <FileBase>(); string responseMessage = null; retStatus = process.LayDuLieu(htBaoCao, listHtBaoCaoTso, ref fileResponse, ref responseMessage, ds, action); if (retStatus == ApplicationConstant.ResponseStatus.THANH_CONG) { value++; Dispatcher.Invoke(updatePbDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { ProgressBar.ValueProperty, value }); progbarPercent.Content = LNumber.Rounding((decimal)((progbarTongHop.Value / progbarTongHop.Maximum) * 100), 0).ToString() + "%"; tuNgay = LDateTime.PlusDays(LDateTime.StringToDate(tuNgay, ApplicationConstant.defaultDateTimeFormat), INT_ONE) .DateToString(ApplicationConstant.defaultDateTimeFormat); } else { LMessage.ShowMessage("M.DungChung.LoiChung", LMessage.MessageBoxType.Error); return; } }while (progbarTongHop.Value != progbarTongHop.Maximum); Mouse.OverrideCursor = Cursors.Arrow; LMessage.ShowMessage("M.DungChung.Result.ThanhCong", LMessage.MessageBoxType.Information); } catch (System.Exception ex) { Mouse.OverrideCursor = Cursors.Arrow; CommonFunction.ThongBaoLoi(ex); LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }