private DailyInOut ComputeDailyInOut(DaySection section, long itemId) { DailyInOut dInOut = new DailyInOut(); TemporaryHistoryStorage temp = _tempHistories.FirstOrDefault(t => t.DaySection.DateId == section.DateId); List <ItemHistory> historiesOfItem = temp.Histories.Where(h => h.Item_Id == itemId).ToList(); List <ItemHistory> inHistories = historiesOfItem.Where(h => h.InOrOut == InOrOut.In).ToList(); double inQty = 0; foreach (var h in inHistories) { inQty = inQty + h.AppopriateQty; } List <ItemHistory> outHistories = historiesOfItem.Where(h => h.InOrOut == InOrOut.Out).ToList(); double outQty = 0; foreach (var h in outHistories) { outQty = outQty + h.AppopriateQty; } dInOut.DaySection = section; dInOut.InQty = inQty; dInOut.OutQty = outQty; return(dInOut); }
private void RetrieveItemHistoriesForEachCoverage() { foreach (var dSection in _range) { var p = MakeSearchParam(dSection.Day); TemporaryHistoryStorage temp = new TemporaryHistoryStorage(); temp.DaySection = dSection; temp.Histories = _historyService.SearchHistories(p); _tempHistories.Add(temp); } }