예제 #1
0
 ///<summary>
 /// Warning: you will be billed for the total number of pages (this report is not subject to the 30-page limit on PACER charges).
 /// returns the data and incurres charges.
 /// returns a CSV in the form described in www.pacer.gov/documents/pacermanual.pdf page 75
 /// Case Year|Case Sequence|Chapter|Date Filed|Court Name|Last Name|First Name| Middle Name|Generation|Social Security Number|Tax Id|Street Address|Address 2|Address 3|City|State|5 Digit Zip Code|4 Digit Zip Code Extension
 ///</summary>
 public String PurchaseCases(FindCasesResult options)
 {
     if (options.url == null)
     {
         return("No Results Found\n");
     }
     else
     {
         return(crawler.Get(options.url));
     }
 }
        public bool QueryNewCases()
        {
            o = new CaseSearchOptions();

            string user = System.Configuration.ConfigurationManager.AppSettings.Get("PACERuser");
            string pass = System.Configuration.ConfigurationManager.AppSettings.Get("PACERPassword");

            _court = CourtService.GetByID(_courtID);

            _bankruptcyParser = new BankruptcyParser(_court.URLAbbrv, user, pass);

            // Login to the system

            if (!_bankruptcyParser.Login())
            {
                _importMessage = "Could Not Login: "******"FAILURE";

                _court = CourtService.GetByID(_courtID);

                _bankruptcyParser = new BankruptcyParser(_court.URLAbbrv, user, pass);

                if (!_bankruptcyParser.NextGenLogin())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }



            // setup the search paramters
            o.open_cases        = true;
            o.closed_cases      = true;
            o.party_information = true;

            //set the chapters and discharged/filed
            o.chapter = new List <CaseSearchOptions.chapters>();
            if (_dischargedCases == true)
            {
                o.date_type = CaseSearchOptions.date_types.discharged;
                o.chapter.Add(CaseSearchOptions.chapters.seven);
                o.chapter.Add(CaseSearchOptions.chapters.thirteen);
            }
            else
            {
                o.date_type = CaseSearchOptions.date_types.filed;
                o.chapter.Add(CaseSearchOptions.chapters.seven);
            }

            //set the case type
            o.case_type = new List <CaseSearchOptions.case_types>();
            o.case_type.Add(CaseSearchOptions.case_types.bk);

            //Set the start and end dates.
            o.start = DateTime.Parse(_startDate.ToString());
            o.end   = DateTime.Parse(_endDate.ToString());

            _result = _bankruptcyParser.FindCases(o);

            if (_result == null)
            {
                _importMessage = "Could Not Find Cases:" + _bankruptcyParser.lastError;
                _importStatus  = "FAILURE";
                PacerImportTransactionService.Save(this);
                return(false);
            }
            else
            {
                this.BillablePages = _result.billable_pages;
                this.Cost          = Decimal.Parse(_result.cost.ToString());
                SearchCriteria     = _result.criteria;
                DownloadTimeStamp  = DateTime.Now;
                PacerImportTransactionService.Save(this);

                //don't set the status and message yet as we still have to import...
                return(true);
            }
        }
예제 #3
0
        private FindCasesResult parseResponse(String response)
        {
            FindCasesResult result = null;
            HtmlDocument    doc    = new HtmlDocument();

            doc.LoadHtml(response);

            if (response.Length < 2500)
            {
                HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//P/h3[1]");
                lastError = "Response Too Small. " + response.Length;

                foreach (HtmlNode node in nodes)
                {
                    if (node.InnerText.Contains("Aborting"))
                    {
                        lastError = node.InnerText;
                    }
                }
                return(null);
            }

            if (crawler.StripHTML(response).Contains("CM/ECF Filer or PACER Login"))
            {
                lastError = "Login Failed";
                return(null);
            }
            // get the total number of rows.
            // this prevents errors when no results are found.
            string jsCookiePattern = "no data for the chosen selection criteria";
            Match  match           = Regex.Match(response, jsCookiePattern, RegexOptions.IgnoreCase);

            if (match.Success)
            {
                result = new FindCasesResult();
                return(result);
            }

            // this prevents errors when no results are found.
            jsCookiePattern = "To accept charges shown below, click on the 'Continue' button";
            match           = Regex.Match(response, jsCookiePattern, RegexOptions.IgnoreCase);

            if (match.Success)
            {
                result = new FindCasesResult();
                foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//table//tr[5]//td//font"))
                {
                    result.retreived_at = node.InnerText; break;
                }

                foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//table/tr[7]/td[1]/font"))
                {
                    result.description = node.InnerText; break;
                }

                foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//table/tr[7]/td[2]/font"))
                {
                    result.criteria = node.InnerText; break;
                }

                foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//table/tr[8]/td[1]/font"))
                {
                    result.billable_pages = int.Parse(node.InnerText); break;
                }

                foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//table/tr[8]/td[2]/font"))
                {
                    result.cost = float.Parse(node.InnerText); break;
                }

                foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//form"))
                {
                    result.url = baseUrl() + node.GetAttributeValue("action", "");
                    //correction alabama north version 5.0
                    result.url = result.url.Replace("..", "");
                }
            }
            return(result);
        }