public PopulateSubsidyBillingResult Step4(Step4Command command) { if (command.Period == default) { throw new Exception("Missing parameter: Period"); } if (command.Period.Day != 1 || command.Period.Hour != 0 || command.Period.Minute != 0 || command.Period.Second != 0) { throw new Exception("Period must be midnight on the first day of the month."); } var startedAt = DateTime.Now; using (var conn = NewConnection()) { conn.Open(); var step4 = new BillingDataProcessStep4Subsidy(new Step4Config { Connection = conn, Context = "ProcessRepository.Step4", Period = command.Period, ClientID = command.ClientID }); PopulateSubsidyBillingResult result; switch (command.Command) { case "subsidy": result = step4.PopulateSubsidyBilling(); break; case "distribution": step4.DistributeSubsidyMoneyEvenly(); result = new PopulateSubsidyBillingResult(startedAt) { Command = "distribution", Period = command.Period, ClientID = command.ClientID, RowsExtracted = 0, RowsDeleted = 0, RowsLoaded = 0 }; break; default: throw new Exception($"Unknown command: {command.Command}"); } conn.Close(); return(result); } }
public PopulateSubsidyBillingResult Step4(Step4Command command) { return(Post <PopulateSubsidyBillingResult>("webapi/billing/process/step4", command)); }