public void AgregateCaterings(PeriodType periodType, DateTime from) { using var tx = _db.CreateTransaction(); string query = this.createCateringAgregationQuery(periodType, from); var data = _db.Query(query, tx, new Dictionary <string, object> { { "from", from } }); foreach (var item in data.Rows.OfType <DataRow>()) { var aggrr = this.getFromDbRow(item); int cateringId = item.Field <int>(AgregationConstants.CateringId); aggrr.PeriodStart = _timeManager.FromUnixTime(item.Field <int>("periodtsart")); aggrr.AgregationBy = AgregationBy.Catering; aggrr.Tag = _tagManager.Tag(new Dictionary <string, string> { { AgregationConstants.CateringId, cateringId.ToString() } }); aggrr.Name = $"Aggr_{_cateringManager.Get(cateringId).Name}_{periodType}"; aggrr.PeriodType = periodType; this.insertAggr(aggrr, tx); } tx.Commit(); }