private static async Task <int> ProcessReminderAsync(ICostReminderService service, TraceWriter log, ArgumentOptions options) { var dateStart = BillingHelper.GetStartDate(options); var dateEnd = BillingHelper.GetEndDate(options); log.Info(options.RunEntirePeriod ? $"Usage from the entire billing history:" : $"Usage from {dateStart.ToLocalTime():yyyy-MM-dd HH:mm:ss} to {dateEnd.AddDays(-1).ToLocalTime():yyyy-MM-dd HH:mm:ss}:"); var result = await service.ProcessAsync(dateStart, dateEnd, options.RunEntirePeriod, (decimal)options.Threshold).ConfigureAwait(false); return(result); }
private static async Task <int> ProcessAsync(ICostReminderService service, ArgumentOptions options) { var dateStart = BillingHelper.GetStartDate(options); var dateEnd = BillingHelper.GetEndDate(options); Console.WriteLine( options.RunEntirePeriod ? $"Usage from the entire billing history:" : $"Usage from {dateStart.ToLocalTime():yyyy-MM-dd HH:mm:ss} to {dateEnd.AddDays(-1).ToLocalTime():yyyy-MM-dd HH:mm:ss}:"); Console.WriteLine(); var watch = Stopwatch.StartNew(); var result = await service.ProcessAsync(dateStart, dateEnd, options.RunEntirePeriod, (decimal)options.Threshold).ConfigureAwait(false); watch.Stop(); Console.WriteLine(); Console.WriteLine($"Execution time: {watch.ElapsedMilliseconds} ms"); return(result); }