private static async Task <int> ProcessAggregatorAsync(ICostAggregationService service, TraceWriter log, ArgumentOptions options = null, int?monthsBack = null) { var dateStart = options != null?BillingHelper.GetStartDate(options) : BillingHelper.GetStartDateOfMonth(monthsBack.Value); var dateEnd = options != null?BillingHelper.GetEndDate(options) : BillingHelper.GetEndDateOfMonth(monthsBack.Value); log.Info($"Usage from {dateStart.ToLocalTime():yyyy-MM-dd HH:mm:ss} to {dateEnd.ToLocalTime():yyyy-MM-dd HH:mm:ss}:"); var result = await service.ProcessAsync(dateStart, dateEnd).ConfigureAwait(false); return(result); }
private static async Task <int> ProcessAsync(ICostAggregationService service, ArgumentOptions options = null, int?monthsBack = null) { var dateStart = options != null?BillingHelper.GetStartDate(options) : BillingHelper.GetStartDateOfMonth(monthsBack.Value); var dateEnd = options != null?BillingHelper.GetEndDate(options) : BillingHelper.GetEndDateOfMonth(monthsBack.Value); Console.WriteLine($"Usage from {dateStart.ToLocalTime():yyyy-MM-dd HH:mm:ss} to {dateEnd.ToLocalTime():yyyy-MM-dd HH:mm:ss}:"); Console.WriteLine(); var watch = Stopwatch.StartNew(); var result = await service.ProcessAsync(dateStart, dateEnd).ConfigureAwait(false); watch.Stop(); Console.WriteLine(); Console.WriteLine($"Execution time: {watch.ElapsedMilliseconds} ms"); return(result); }