public List <ViewBangThuTienRow> EvaluateViewBangThuTienRowsForReport(List <ViewBangThuTienRow> viewBangThuTienRows, DateTime toDate) { HashSet <int> hocSinhIds = new HashSet <int>(); foreach (ViewBangThuTienRow viewBangThuTienRow in viewBangThuTienRows) { if (!hocSinhIds.Contains(viewBangThuTienRow.HocSinhId)) { hocSinhIds.Add(viewBangThuTienRow.HocSinhId); } } LoggerFacade.Info(string.Format("EvaluateViewBangThuTienRowsForReport for list HocSinhIds=[{0}]", StringUtil.JoinWithCommas(hocSinhIds.ToList()))); HocSinhLopTableAdapter hocSinhLopTableAdapter = (HocSinhLopTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterHocSinhLop); Dictionary <int, QLMamNon.Dao.QLMamNonDs.LopRow> hocSinhIdsToLopNames = StaticDataUtil.GetLopsByHocSinhIds(hocSinhIds.ToList(), toDate); HocSinhDataTable hocSinhDataTable = this.getHocSinhData(); foreach (ViewBangThuTienRow viewBangThuTienRow in viewBangThuTienRows) { viewBangThuTienRow.HoTen = StaticDataUtil.GetHocSinhFullNameByHocSinhId(hocSinhDataTable, viewBangThuTienRow.HocSinhId); if (hocSinhIdsToLopNames.ContainsKey(viewBangThuTienRow.HocSinhId)) { viewBangThuTienRow.Lop = hocSinhIdsToLopNames[viewBangThuTienRow.HocSinhId].Name; } } return(viewBangThuTienRows); }
public QLMamNon.Dao.QLMamNonDs.PhieuThuDataTable LoadPhieuThu(HocSinhDataTable hocSinhTable) { PhieuThuTableAdapter phieuThuTableAdapter = (PhieuThuTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterPhieuThu); PhieuThuDataTable table = phieuThuTableAdapter.GetData(); foreach (PhieuThuRow row in table) { if (!row.IsHocSinhIdNull()) { row.HocSinh = StaticDataUtil.GetHocSinhFullNameByHocSinhId(hocSinhTable, row.HocSinhId); } if (!row.IsPhanLoaiThuIdNull()) { row.PhanLoaiThu = StaticDataUtil.GetPhanLoaiThuById(row.PhanLoaiThuId); } } return(table); }
private List <ViewBangThuTienRow> loadViewBangThuTiensToanTruong(DateTime toDate, int?lopId) { ViewBangThuTienTableAdapter viewBangThuTienTableAdapter = (ViewBangThuTienTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterViewBangThuTien); BangThuTienKhoanThuTableAdapter bangThuTienKhoanThuTableAdapter = (BangThuTienKhoanThuTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterBangThuTienKhoanThu); PhieuThuTableAdapter phieuThuTableAdapter = (PhieuThuTableAdapter)StaticDataFacade.Get(StaticDataKeys.AdapterPhieuThu); ViewBangThuTienDataTable table = viewBangThuTienTableAdapter.GetViewBangThuTienByNgayTinhAndLop(toDate, lopId); List <int> bangThuTienIds = new List <int>(table.Rows.Count); foreach (ViewBangThuTienRow row in table) { bangThuTienIds.Add(row.BangThuTienId); } if (!ListUtil.IsEmpty(bangThuTienIds)) { QLMamNon.Dao.QLMamNonDs.BangThuTienKhoanThuDataTable bTTKTDataTable = bangThuTienKhoanThuTableAdapter.GetBangThuTienKhoanThuByBangThuTienIds(String.Join(",", bangThuTienIds)); QLMamNon.Dao.QLMamNonDs.PhieuThuDataTable phieuThuDataTable = phieuThuTableAdapter.GetDataByHocSinhIdAndNgayTinh(-1, toDate); Dictionary <int, ViewBangThuTienRow> prevMonthRowDictionary = this.EvaluatePrevMonthViewBangThuTienTable(toDate.AddMonths(-1), lopId); HocSinhDataTable hocSinhDataTable = this.getHocSinhData(); foreach (ViewBangThuTienRow row in table) { row.HoTen = StaticDataUtil.GetHocSinhFullNameByHocSinhId(hocSinhDataTable, row.HocSinhId); BangThuTienUtil.EvaluateValuesForViewBangThuTienRow(row, prevMonthRowDictionary != null && prevMonthRowDictionary.ContainsKey(row.HocSinhId) ? prevMonthRowDictionary[row.HocSinhId] : null, bTTKTDataTable, phieuThuDataTable, false, false, true); } } List <ViewBangThuTienRow> viewBangThuTienRows = new List <Dao.QLMamNonDs.ViewBangThuTienRow>(); foreach (ViewBangThuTienRow row in table) { viewBangThuTienRows.Add(row); } return(viewBangThuTienRows); }
private void loadViewBangThuTiens(DateTime ngayTinh, int lop) { if (this.isNeedToGenerateSoThuTiens(ngayTinh, lop, false)) { this.showFormGenerateSoThuTiens(true); return; } ViewBangThuTienDataTable table = viewBangThuTienTableAdapter.GetViewBangThuTienByNgayTinhAndLop(ngayTinh, lop); List <int> bangThuTienIds = new List <int>(table.Rows.Count); foreach (ViewBangThuTienRow row in table) { bangThuTienIds.Add(row.BangThuTienId); } if (!ListUtil.IsEmpty(bangThuTienIds)) { bTTKTDataTable = bangThuTienKhoanThuTableAdapter.GetBangThuTienKhoanThuByBangThuTienIds(String.Join(",", bangThuTienIds)); phieuThuDataTable = phieuThuTableAdapter.GetDataByHocSinhIdAndNgayTinh(-1, ngayTinh); SoThuTienService soThuTienService = new SoThuTienService(); prevMonthRowDictionary = soThuTienService.EvaluatePrevMonthViewBangThuTienTable(ngayTinh.AddMonths(-1), lop); foreach (ViewBangThuTienRow row in table) { row.HoTen = StaticDataUtil.GetHocSinhFullNameByHocSinhId(hocSinhDataTable, row.HocSinhId); BangThuTienUtil.EvaluateValuesForViewBangThuTienRow(row, prevMonthRowDictionary != null && prevMonthRowDictionary.ContainsKey(row.HocSinhId) ? prevMonthRowDictionary[row.HocSinhId] : null, bTTKTDataTable, phieuThuDataTable, false, false, true); row.AcceptChanges(); } } this.viewBangThuTienRowBindingSource.DataSource = table; this.DataTable = table; }