public static void PrepareMonth(List <string> files, string month) { Service.BluePrint = string.Format("Month{0}", month); Console.WriteLine("Preparing period {0} statistics.", month); foreach (var filePath in files) { var monthOfFile = InfoHelper.GetMonth(filePath); if (monthOfFile != month) { continue; } Service.ReadStatisticsData(filePath); Service.PrepareData(); } var statistics = Service.CalculateStatistics(); Service.AddToRepository(statistics); Console.WriteLine("Prepared."); Service.ResetSequence(); }
public static void PrepareMonth(List <string> files, string month) { var path = Path.Combine(HistogramPath, string.Format("Histogram_M{0}.csv", month)); Console.WriteLine("Preparing period {0} histogram.", month); foreach (var filePath in files) { var monthOfFile = InfoHelper.GetMonth(filePath); if (monthOfFile != month) { continue; } Service.ReadStatisticsData(filePath); Service.PrepareData(); } var statistics = Service.CalculateStatistics(); Service.AddToRepository(statistics); Service.CommitToRepository(path); Console.WriteLine("Prepared."); Service.Clear(); }
public void Run() { var inputPath = ConfigurationManager.AppSettings["StatisticsInputPath"]; var outputPath = Path.Combine(ConfigurationManager.AppSettings["StatisticsOutputPath"], "Results.csv"); var files = Directory.GetFiles(inputPath).Where(x => InfoHelper.GetPeriod(x) != "21600").ToList(); var periods = new List <string> { "300", "600", "900", "1800" }; var months = new List <string> { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }; StatisticsComparisonHelper.PrepareAllTime(files); foreach (var period in periods) { StatisticsComparisonHelper.PreparePeriod(files, period); HistogramComparisonHelper.PreparePeriod(files, period); } foreach (var month in months) { StatisticsComparisonHelper.PrepareMonth(files, month); HistogramComparisonHelper.PrepareMonth(files, month); } foreach (var period in periods) { foreach (var month in months) { StatisticsComparisonHelper.PreparePeriodForMonth(files, period, month); HistogramComparisonHelper.PreparePeriodForMonth(files, period, month); } } _statisticsService.CommitToRepository(outputPath); }