コード例 #1
0
        public void AggregateLocations(PeriodType periodType, DateTime from)
        {
            using var tx = _db.CreateTransaction();

            string query = this.createLocationAgregationQuery(periodType, from);

            var data = _db.Query(query, tx, new Dictionary <string, object> {
                { "from", from }
            });

            foreach (var item in data.Rows.OfType <DataRow>())
            {
                var locData = this.getLocationFromDbRow(item);

                locData.Customer = _customerManager.Get(item.Field <int>("CustomerId"));

                _db.Insert("CustomerMostUsedLocations", tx, _reflectionHelper.GetKeyValue(locData));
            }

            tx.Commit();
        }