/// <summary> /// Load dữ liệu lên Grid /// </summary> private void LoadGrid(int stype) { try { HuyDongVonProcess huyDongVonProcess = new HuyDongVonProcess(); AutoComboBox auto = new AutoComboBox(); List <string> lstDieuKien = new List <string>(); lstDieuKien.Add(AppConfig.LoginedUser.UserName); lstDieuKien.Add(AppConfig.LoginedUser.MaDonVi); lstDieuKien.Add(DatabaseConstant.ToChucDonVi.PGD.getValue()); auto.GenAutoSoure(ref lstSourceDonVi, DatabaseConstant.DanhSachTruyVan.COMBOBOX_DONVI_THEOPVI.getValue(), lstDieuKien, AppConfig.LoginedUser.MaDonViGiaoDich); lstDieuKien.Clear(); #region Điều kiện tìm kiếm string sMaDonVi = ""; sMaDonVi = "("; string maChon = cmbDonVi.SelectedItem.Value;// lstSourceDonVi.ElementAt(cmbDonVi.SelectedIndex).KeywordStrings.ElementAt(0); string donVi = ""; foreach (AutoCompleteEntry item in lstSourceDonVi) { donVi = item.KeywordStrings.ElementAt(0); if (donVi.Contains(maChon)) { sMaDonVi += "''" + donVi + "'',"; } } sMaDonVi = sMaDonVi.Substring(0, sMaDonVi.Length - 1); sMaDonVi += ")"; string sTrangThaiNVu = ""; string sSoTGui = "%"; string sTenSoTGui = "%"; string sTuNgayMoSo = "%"; string sDenNgayMoSo = "%"; string sTuNgayDHan = "%"; string sDenNgayDHan = "%"; string soDuTu = "%"; string soDuDen = "%"; string iKyHanTu = "%"; string iKyHanDen = "%"; string sKyHanDonVi = "%"; string sMaKH = "%"; string sTenKH = "%"; string sSoCMND = "%"; string sSDT = "%"; string sEmail = "%"; string sNgayDC = "%"; string sSanPham = "%", sIDNhom = "%", sCBQL = "%"; if (cbChoduyet.Checked) { sTrangThaiNVu = sTrangThaiNVu + "''" + cbChoduyet.Value + "'',"; } if (cbDaduyet.Checked) { sTrangThaiNVu = sTrangThaiNVu + "''" + cbDaduyet.Value + "'',"; } if (cbThoaiduyet.Checked) { sTrangThaiNVu = sTrangThaiNVu + "''" + cbThoaiduyet.Value + "'',"; } if (cbTuchoi.Checked) { sTrangThaiNVu = sTrangThaiNVu + "''" + cbTuchoi.Value + "'',"; } if (sTrangThaiNVu != "") { sTrangThaiNVu = "(" + sTrangThaiNVu.Substring(0, sTrangThaiNVu.Length - 1) + ")"; } if (!txtSoSoTG.Text.IsNullOrEmpty()) { sSoTGui = txtSoSoTG.Text; } if (!raddtNgayMoSoTu.Text.IsNullOrEmpty()) { sTuNgayMoSo = LDateTime.StringToDate(raddtNgayMoSoTu.Text, "dd/MM/yyyy").ToString("yyyyMMdd"); } if (!raddtNgayMoSoDen.Text.IsNullOrEmpty()) { sDenNgayMoSo = LDateTime.StringToDate(raddtNgayMoSoDen.Text, "dd/MM/yyyy").ToString("yyyyMMdd"); } if (!raddtNgayDaoHanTu.Text.IsNullOrEmpty()) { sTuNgayDHan = LDateTime.StringToDate(raddtNgayDaoHanTu.Text, "dd/MM/yyyy").ToString("yyyyMMdd"); } if (!raddtNgayDaoHanDen.Text.IsNullOrEmpty()) { sDenNgayDHan = LDateTime.StringToDate(raddtNgayDaoHanDen.Text, "dd/MM/yyyy").ToString("yyyyMMdd"); } if (numSoDuTu.Text != "") { soDuTu = numSoDuTu.Text.Replace(",", "").ToString(); } if (numSoDuDen.Text != "") { soDuDen = numSoDuDen.Text.Replace(",", "").ToString(); } if (numKyHanTu.Text != "") { iKyHanTu = numKyHanTu.Text.Replace(",", "").ToString(); } if (numKyHanDen.Text != "") { iKyHanDen = numKyHanDen.Text.Replace(",", "").ToString(); } if (cmbKyHanTu.SelectedIndex >= 0) { sKyHanDonVi = cmbKyHanTu.SelectedItem.Value; } if (!txtKhachHang.Text.IsNullOrEmptyOrSpace()) { sMaKH = txtKhachHang.Text; } if (!txtTenKhachHang.Text.IsNullOrEmptyOrSpace()) { sTenKH = txtTenKhachHang.Text; } //} #endregion // Phân trang int StartRow = 1; int EndRow = 999999999 * stype; // ClientInformation.SoLuongBanGhi; int CurrentPagging = 1; int PaggingSize = 999999999; // ClientInformation.SoLuongBanGhi; DataSet ds = huyDongVonProcess.GetDanhSachSoTGuiNhom(sMaDonVi, sSanPham, sIDNhom, sCBQL, sTrangThaiNVu, sSoTGui, sTenSoTGui, sTuNgayMoSo, sDenNgayMoSo, sTuNgayDHan, sDenNgayDHan, soDuTu, soDuDen, iKyHanTu, iKyHanDen, sKyHanDonVi, sMaKH, sTenKH, sSoCMND, sSDT, sEmail, sNgayDC, StartRow.ToString(), EndRow.ToString()); if (ds != null && ds.Tables.Count > 0) { //foreach (DataRow dr in ds.Tables[0].Rows) //{ // dr["TTHAI_NVU"] = BusinessConstant.layNgonNguNghiepVu(dr["TTHAI_NVU"].ToString()); // if (!dr["KY_HAN_DVI_TINH"].IsNullOrEmpty() && !dr["KY_HAN_TGIAN"].IsNullOrEmpty() && !dr["KY_HAN"].IsNullOrEmpty()) // { // if (!dr["KY_HAN_TGIAN"].ToString().Equals("0") && !dr["KY_HAN_DVI_TINH"].ToString().Equals("")) // dr["KY_HAN"] = dr["KY_HAN_TGIAN"] + " " + BusinessConstant.layNgonNguTuGiaTri(dr["KY_HAN_DVI_TINH"].ToString(), "TAN_SUAT"); // } //} DataTable serverDataTable = ds.Tables[0]; int totalRecord = Int32.Parse(ds.Tables[1].Rows[0][0].ToString()); //DataTable clientDataTable = ds.Tables[0].Copy() ;// CommonFunction.BuildClientDataTable(serverDataTable, CurrentPagging, PaggingSize, totalRecord); //dtSoTGui = ds.Tables[0]; //grSoTienGuiDS.DataContext = dtSoTGui.DefaultView; dtSoTGui = serverDataTable; grSoTienGuiDS.DataSource = serverDataTable; grSoTienGuiDS.DataBind(); int soSoTgui = 0; decimal tongSoDu = 0; decimal soDuBinhQuan = 0; decimal tongSoDuGoc = Decimal.Parse(ds.Tables[2].Rows[0][0].ToString()); decimal tongSoDuLai = Decimal.Parse(ds.Tables[2].Rows[0][1].ToString()); if (totalRecord > 0) { soSoTgui = totalRecord; for (int i = 0; i < dtSoTGui.Rows.Count; i++) { tongSoDu += Convert.ToDecimal(dtSoTGui.Rows[i]["SO_DU"]); } soDuBinhQuan = tongSoDu / soSoTgui; } lblSumSoSo.Text = String.Format("{0:#,#}", soSoTgui); lblSumSoDu.Text = String.Format("{0:#,#}", tongSoDu); lblSoDuBQ.Text = String.Format("{0:#,#}", soDuBinhQuan); lblSumSoDuGoc.Text = String.Format("{0:#,#}", tongSoDuGoc); lblSumSoDuLai.Text = String.Format("{0:#,#}", tongSoDuLai); } else { dtSoTGui.Rows.Clear(); grSoTienGuiDS.DataSource = dtSoTGui.DefaultView; grSoTienGuiDS.DataBind(); } } catch (Exception ex) { // LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex); } }