public async Task ProcessFilings(FilingProcessCommandArgs commandLineArgs) { Console.WriteLine("Retrieving panel of reporters"); FFIECPublicWebService.RetrievalService proxy = GetRetrievalServiceProxy(commandLineArgs); int[] rssds = proxy.RetrieveFilersSinceDate(FFIECPublicWebService.ReportingDataSeriesName.Call, commandLineArgs.ReportingCycleEndDate, FilingProcessorProfile.FiledSinceDate); Console.WriteLine("Retrieved filers for reporting cycle {0} who filed since {1}.", commandLineArgs.ReportingCycleEndDate, FilingProcessorProfile.FiledSinceDate); foreach (int rssd in rssds) { Console.WriteLine("Processing ID_RSSD: " + rssd); var reportingInstitution = await ReportingInstitutionTable.Where(riItem => riItem.ID_RSSD == rssd).ToListAsync(); // Should be rare, but if this is a new reporting institution then add it if (reportingInstitution.Count == 0) { // ToDo: Because we only get back rssds (not full ReportingFinancialInstitution // record) you will need to find out how to fetch a single // ReportingFinancialInstitution record that corresponds to rssd so we can add // it to our cached table } var filings = await FilingTable.Where(f => f.ID_RSSD == rssd && f.ReportingCycleEndDate == commandLineArgs.ReportingCycleEndDate).ToListAsync(); // If this is a new filing record then add it if (filings.Count == 0) { CallReporter.Model.Filing filing = new CallReporter.Model.Filing() { ID_RSSD = rssd, ReportingCycleEndDate = commandLineArgs.ReportingCycleEndDate }; await FilingTable.InsertAsync(filing); await AlertInterestedParties(filing); } } // Update the FiledSinceDate now that we have successfully processed the filings // ToDo: Uncomment this line when you are done finished testing //FilingProcessorProfile.FiledSinceDate = DateTime.Now.ToString("MM/dd/yyyy"); await FilingProcessorProfileTable.UpdateAsync(FilingProcessorProfile); Console.WriteLine("Panel of reporters retrieved, press any key to finish"); Console.ReadLine(); }
async Task AlertInterestedParties(CallReporter.Model.Filing filing) { // Get reporting institution that filed var reportingInstitution = await ReportingInstitutionTable.Where(rptInstitution => rptInstitution.ID_RSSD == filing.ID_RSSD).ToListAsync(); if (reportingInstitution.Count > 0) { // ToDo: Alert all parties that expressed an interest in this particular filing and // use reportingInstitution to get the bank name and any other info that makes sense // to include in the alert } else { // ToDo: Log the fact that a filing was received for an institution that is // not currently in our cached reporting institution table. // This could happen if our cached reporting institution table is not kept // to to date } }