Esempio n. 1
0
        private void CheckCourts(ApiDocument TempDocument, OpinionDocument Document, string SourceNumber)
        {
            Court TempCourt= new Court("","");

            if (TempDocument != null)
            {

                string CourtId = TempDocument.CourtUrl.Replace("/?format=json", "").TrimEnd('/').Split('/').ToList().Last();

                //Adding sourcefile from bulk
                //if (TempDocument.Citation != null)
                //{
                //    Document.SourceFile = TempDocument.Citation.sourceFile[0];
                //}

                // Verify if the court exists on the cache CourtDictionary
                if (CourtDictionary.ContainsKey(CourtId))
                {
                    Console.WriteLine("Contains Court "+ CourtId);

                    TempCourt.CourtId = CourtId;
                    TempCourt.Name = (CourtDictionary[CourtId]);

                    if (TempCourt != null)
                    {

                        CheckCourt(TempCourt, TempDocument, Document, SourceNumber, CourtId);
                    }
                    else
                    {
                        Console.WriteLine("The court with the Code URL: " + TempDocument.CourtUrl + " couldn't be found.");
                    }
                }
                else
                {
                    // Get the Court of a Document from Court Listener

                    TempCourt = GetCourtFromAPI(CourtId);
                    TempCourt.CourtId = CourtId;

                    if (TempCourt != null)
                    {
                        CourtDictionary.Add(TempCourt.CourtId, TempCourt.Name);
                        CheckCourt(TempCourt, TempDocument, Document, SourceNumber, CourtId);
                    }
                    else
                    {
                        Console.WriteLine("The court with the Code URL: " + TempDocument.CourtUrl + " couldn't be found.");
                    }
                }
            }
            else
            {
                Console.WriteLine("The document with the Source File: " + Document.SourceFile + " couldn't be found.");
            }
        }
Esempio n. 2
0
        private void CheckCourt(Court TempCourt, ApiDocument TempDocument, OpinionDocument Document, string SourceNumber, string CourtId)
        {
            Document.SourceFile = "/api/rest/v3/opinions/" + SourceNumber + "/";
            Console.WriteLine(TempDocument.Citation.caseName);
            // Verify if the state exists on the state dictionary
            if (StatesDictionary.GetDictionary().ContainsKey(CourtId))
            {

                // Fetch the state from the state dictionary
                string state = StatesDictionary.GetDictionary()[CourtId];

                Console.WriteLine(TempDocument.Citation.caseName);
                // Update the court and state of the Opiniond Document
                if (UpdateDocumentValues(Document.Id, Document.SourceFile, TempCourt.Name, TempDocument.Citation.caseName, state, TempDocument.Docket))
                {
                    Log(Document.Id.ToString());
                }
            }
        }