예제 #1
0
        public async Task Save(Notification notification, JsonElement json)
        {
            BackingStoreInfo storeInfo = await GetBackingStoreInfo(notification);

            await _notificationDal.Save(storeInfo, json.GetRawText());

            await CalculateAndSaveReport(notification, storeInfo);
        }
예제 #2
0
        public static string Build(BackingStoreInfo info, string fileName)
        {
            var path = string.Format(Constants.PathFormat, info.Source, info.DirIndex);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            return(Path.Combine(path, string.Format(fileName, info.FileId)));
        }
예제 #3
0
        private async Task CalculateAndSaveReport(Notification notification, BackingStoreInfo stateInfo)
        {
            var summary = await _reportCalculator.Calculate(notification);

            var report = new NotificationReport
            {
                Source    = notification.Source,
                Id        = notification.Id,
                WordCount = summary.WordCount
            };
            await _reportDal.Save(stateInfo, report.ToString());
        }
예제 #4
0
 public async Task Save(BackingStoreInfo info, string data)
 {
     var filePath = FilePathBuilder.Build(info, Constants.NotificationFileNameFormat);
     await File.WriteAllTextAsync(filePath, data);
 }