publicclassDonationTaxSummaryReportInterceptor : IReportInterceptorService { publicoverride Task PreBuildStartAsync(string reportName, Dictionary<string, object> parameters) { var dateRange = GetDateRange(parameters); if (!dateRange.HasValue) { thrownew ArgumentException("Please select a year range."); }
return Task.CompletedTask; }
private (DateTime, DateTime)? GetDateRange(Dictionary<string, object> parameters) { var years = parameters["Years"] asstring; if (string.IsNullOrWhiteSpace(years) || year.Length != 8) { returnnull; }
if (int.TryParse(years[..4], outvar yearFrom) && int.TryParse(years[^4..], outvar yearTo)) { var dateFrom = new DateTime(yearFrom, 4, 1); var dateTo = new DateTime(yearTo, 3, 31);