Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        FFIECPublicWebService.RetrievalService GetRetrievalServiceProxy(FilingProcessCommandArgs commandLineArgs)
        {
            FFIECPublicWebService.RetrievalService proxy = new FFIECPublicWebService.RetrievalService();
            UsernameToken userToken = new UsernameToken(commandLineArgs.Credentials.UserName,
                                                        commandLineArgs.Credentials.Password,
                                                        PasswordOption.SendHashed);

            proxy.RequestSoapContext.Security.Tokens.Add(userToken);

            return(proxy);
        }
Esempio n. 3
0
        /// <summary>
        /// method usage of the web service method RetrievePanelOfReporters
        /// Clients should call this method to obtain a list of all financial institutions who filed Call Report
        /// for a particular reporting period. This method should typically be called once or infrequently to obtain
        /// the complete list of banks in the PoR. Subsequently, the web clients should call RetrieveFilersSinceDate
        /// to find out the list of banks that have filed their original or amended Call Reports.
        async public void LoadReportingInstitutions(FilingProcessCommandArgs commandLineArgs)
        {
            FFIECPublicWebService.ReportingDataSeriesName dsName = FFIECPublicWebService.ReportingDataSeriesName.Call;
            FFIECPublicWebService.RetrievalService        proxy  = new FFIECPublicWebService.RetrievalService();
            UsernameToken userToken = new UsernameToken(commandLineArgs.Credentials.UserName, commandLineArgs.Credentials.Password, PasswordOption.SendHashed);

            proxy.RequestSoapContext.Security.Tokens.Add(userToken);
            proxy.Timeout = 400000;

            FFIECPublicWebService.ReportingFinancialInstitution[] reporters =
                proxy.RetrievePanelOfReporters(dsName, commandLineArgs.ReportingCycleEndDate);

            Console.WriteLine("OK" + "Retrieved panel of reporters. ");
            foreach (FFIECPublicWebService.ReportingFinancialInstitution reporter in reporters)
            {
                Console.WriteLine("Adding " + reporter.Name.Trim() + "|" + reporter.ID_RSSD + "|" + reporter.State + "|" + reporter.HasFiledForReportingPeriod);

                var reportingInstitution = await ReportingInstitutionTable.Where(riItem => riItem.ID_RSSD == reporter.ID_RSSD).ToListAsync();

                if (reportingInstitution.Count == 0)
                {
                    CallReporter.Model.ReportingFinancialInstitution newInstitution = new CallReporter.Model.ReportingFinancialInstitution();

                    // ToDo: Put assignment in its own method, create assignment operators
                    newInstitution.Address                    = reporter.Address;
                    newInstitution.City                       = reporter.City;
                    newInstitution.FDICCertNumber             = reporter.FDICCertNumber;
                    newInstitution.FilingType                 = reporter.FilingType;
                    newInstitution.HasFiledForReportingPeriod = reporter.HasFiledForReportingPeriod;
                    newInstitution.ID_RSSD                    = reporter.ID_RSSD;
                    newInstitution.Name                       = reporter.Name;
                    newInstitution.OCCChartNumber             = reporter.OCCChartNumber;
                    newInstitution.OTSDockNumber              = reporter.OTSDockNumber;
                    newInstitution.PrimaryABARoutNumber       = reporter.PrimaryABARoutNumber;
                    newInstitution.State                      = reporter.State;
                    newInstitution.ZIP = reporter.ZIP;

                    await ReportingInstitutionTable.InsertAsync(newInstitution);
                }
                else
                {
                    await UpdateAsync(ReportingInstitutionTable, reportingInstitution[0], reporter);
                }
            }

            Console.WriteLine("OK" + "Total members of POR = " + reporters.Length.ToString());
        }
Esempio n. 4
0
        /// <summary>
        /// This method demonstrates the usage of the web service method RetrieveFilersSinceDate
        /// Clients should call this method to keep up to date with the filings/ammendments filed by financial institutions
        /// after a given date/time until now.
        /// </summary>
        public void GetFilers(FilingProcessCommandArgs commandLineArgs)
        {
            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("OK" + "ID_RSSD: " + rssd);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// method usage of the web service helper method TestUserAccess
        /// Clients should call this method to check if a user has access to FFIEC public web services
        /// </summary>
        public static void TestUserAccess(Credentials creds)
        {
            string UserID            = creds.UserName;
            string UserSecurityToken = creds.Password;

            bool userHasAccess = false;

            try
            {
                FFIECPublicWebService.RetrievalService proxy = new FFIECPublicWebService.RetrievalService();
                UsernameToken userToken = new UsernameToken(UserID, UserSecurityToken, PasswordOption.SendHashed);
                proxy.RequestSoapContext.Security.Tokens.Add(userToken);
                userHasAccess = proxy.TestUserAccess();
            }
            catch (SoapException ex)
            {
                if (ex.Code.Name.Equals("FailedAuthentication"))
                {
                    userHasAccess = false;
                }
                else
                {
                    Console.WriteLine("ERROR", "The Web Service returned an error: " + ex.Message);
                }
            }
            catch (Exception ex)
            {
                FFIECPublicWebService.RetrievalService proxy = new FFIECPublicWebService.RetrievalService();
                Console.WriteLine("ERROR accesssing URL - ", proxy.Url);
            }
            finally
            {
                string message;
                if (userHasAccess)
                {
                    message = "User '" + UserID + "' is authorized to access the FFIEC CDR Public Web Service.";
                    Console.WriteLine("OK, " + message);
                }
                else
                {
                    message = "User '" + UserID + "' is NOT authorized to access the FFIEC CDR Public Web Service. Please create a user account using the PDD website.";
                    Console.WriteLine("ERROR, " + message);
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// method usage of the web service helper method RetrieveReportingPeriods
        /// Clients should call this method to obtain a list of available reporting periods in the correct format
        /// to call the other retrieval methods
        /// </summary>
        public static void RetrieveReportingPeriods(Credentials creds)
        {
            string UserID            = creds.UserName;
            string UserSecurityToken = creds.Password;

            FFIECPublicWebService.ReportingDataSeriesName dsName = FFIECPublicWebService.ReportingDataSeriesName.Call;

            FFIECPublicWebService.RetrievalService proxy = new FFIECPublicWebService.RetrievalService();
            UsernameToken userToken = new UsernameToken(UserID, UserSecurityToken, PasswordOption.SendHashed);

            proxy.RequestSoapContext.Security.Tokens.Add(userToken);

            string[] reportingPeriodEndList = proxy.RetrieveReportingPeriods(dsName);
            foreach (var item in reportingPeriodEndList)
            {
                Console.WriteLine(item.ToString());
            }
            Console.WriteLine("OK, " + String.Format("Retrieved available reporting periods for {0}.", dsName));
        }