private void AddSubRows(CollectorDTO collector, SectionDTO sec, ICollectionsDB db, IStallsRepo stalls) { var savedCollectr = db.GetCollector(sec) ?? new CollectorDTO { Id = 1 }; if (savedCollectr.Id != collector.Id) { return; } if (!db.IntendedColxns.TryGetValue(sec.Id, out IIntendedColxnsRepo repo)) { return; } if (!repo.Any()) { return; } foreach (var colxn in repo.GetAll()) { if (colxn.StallSnapshot == null) { colxn.StallSnapshot = stalls.Find(colxn.Lease.Stall.Id, true); } this.Add(new CollectorPerfSubRow(colxn, sec)); } }
protected void FillCollectorsList(CollectorDTO defaultCollector) { Collectors.SetItems(AppArgs.MarketState.Collectors.GetAll()); if (defaultCollector != null) { CurrentCollector = Collectors.SingleOrDefault(_ => _.Id == defaultCollector.Id); } ShowCollectors = true; }
public static void DefaultRecords(int count, ITenantDBsDir dir) { var recs = new List <CollectorDTO>(); var repo = dir.MarketState.Collectors; var lastId = repo.Max(_ => _.Id); for (int i = 1; i < count + 1; i++) { recs.Add(CollectorDTO.Named($"Collector #{lastId + i}", true)); } repo.Insert(recs, true); }
private CollectorDTO SetCollector() { var collector = FirstPayment()?.Collector; if (collector == null) { return(CollectorDTO.Named("--")); } collector.Name = _collectors.TryGetValue(collector.Id, out CollectorDTO match) ? match.Name : $"‹unknown collector [{collector.Id}]›"; if (collector.Id == 0) { collector.Name = "Office"; } return(collector); }
public static CollectorPerformanceRow New(CollectorDTO collector, IStallsRepo fallbackStallsRepo, ICollectionsDB db, IMarketStateDB mkt) { var cp = new CollectorPerformanceRow(collector); var sections = db.SectionsSnapshot ?? mkt.Sections.GetAll(); foreach (var sec in sections) { cp.AddSubRows(collector, sec, db, fallbackStallsRepo); } cp.Sections = cp.DistinctBy(_ => _.Section.Id) .Select(_ => _.Section) .ToList(); cp.StallCoverage = ColPerfStallCoverage.New(cp, db); cp.RentBill = ColPerfBillPerformance.New(BillCode.Rent, cp.Select(_ => _.Rent)); cp.RightsBill = ColPerfBillPerformance.New(BillCode.Rights, cp.Select(_ => _.Rights)); cp.SetSummary(new CollectorPerfSubRowsTotal(cp)); return(cp); }
private CollectorPerformanceRow(CollectorDTO collector) { Collector = collector; }
protected override CollectorDTO GetSectionCollector(SectionDTO sec, ICollectionsDB db) => CollectorDTO.Office();