Ejemplo n.º 1
0
        private DataSyncHistory PushHistory()
        {
            var currentHistory = new DataSyncHistory
            {
                DistrictId = DistrictId,
                Started    = DateTime.UtcNow,
            };

            currentHistory.Touch();
            Db.DataSyncHistories.Add(currentHistory);
            return(currentHistory);
        }
Ejemplo n.º 2
0
        public DistrictRepo(ApplicationDbContext db, int districtId, int chunkSize = 50)
        {
            Db         = db;
            DistrictId = districtId;
            ChunkSize  = chunkSize;

            Committer = new ActionCounter(async() =>
            {
                await db.SaveChangesAsync();

                // clear local cache of objects
                district       = null;
                currentHistory = null;
            }, chunkSize: ChunkSize);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> HistoryDetailsList(int dataSyncHistoryId)
        {
            DataSyncHistory history = await db.DataSyncHistories
                                      .Include(h => h.District)
                                      .SingleOrDefaultAsync(h => h.DataSyncHistoryId == dataSyncHistoryId);

            ViewData["DistrictName"] = history.District.Name;

            var model = await db.DataSyncHistoryDetails
                        .Where(d => d.DataSyncHistoryId == dataSyncHistoryId)
                        .OrderByDescending(d => d.Modified)
                        .Take(20)
                        .ToListAsync();

            return(View(model));
        }
Ejemplo n.º 4
0
        public void RecordProcessingError(string message, ProcessingStage processingStage)
        {
            DataSyncHistory history = CurrentHistory;

            if (history == null)
            {
                Logger.Here().LogError($"No current history.  Developer: create History record before Processing.");
                return;
            }

            switch (processingStage)
            {
            case ProcessingStage.Load: CurrentHistory.LoadError = message; break;

            case ProcessingStage.Analyze: CurrentHistory.AnalyzeError = message; break;

            case ProcessingStage.Apply: CurrentHistory.ApplyError = message; break;

            default:
                Logger.Here().LogError($"Unexpected Processing Stage in exception: {processingStage}");
                break;
            }
        }