예제 #1
0
        public CourtDecision(DataRow row)
        {
            citations = new List <Citation>();

            id          = row["id"].ToString();
            slug        = row["slug"].ToString();
            file_number = row["file_number"].ToString();
            date        = row["date"].ToString();
            create_date = row["create_date"].ToString();
            update_date = "";
            type        = row["type"].ToString();
            exil        = "";
            content     = row["content"].ToString();
            citated     = (int)row["countCitated"];

            if (row["court_id"] != null && row["court_id"].ToString().Length > 0)
            {
                Court c = new Court();
                c.id              = row["court_id"].ToString();
                c.jurisdiction    = row["court_jurisdiction"].ToString();
                c.level_of_appeal = row["court_level_of_appeal"].ToString();
                c.name            = row["court_name"].ToString();
                c.slug            = "";
                c.state           = row["court_state"].ToString();

                court = c;
            }
        }
예제 #2
0
        public CourtDecision(int Id, SqlConnector connection, bool loadContent = true)
        {
            try
            {
                con = connection;
                DataTable result = con.GetSqlAsDataTable($"SELECT d.id, slug, type, file_number, CONVERT(nvarchar(max), create_date, 110) as create_date, CONVERT(nvarchar(max), date, 110) as date, {(loadContent ?  "content" : "'' as content" )}, court_id, (SELECT COUNT(*) FROM dbo.citations ct WHERE ct.from_id = d.id) countCitated , c.chamber court_chamber, c.city court_city, c.jurisdiction court_jurisdiction, c.level_of_appeal court_level_of_appeal, c.name court_name, c.state court_state FROM dbo.courtdecisions d  LEFT JOIN dbo.courts c on c.id = d.court_id WHERE d.id =" + Id);

                foreach (DataRow row in result.Rows)
                {
                    id          = row["id"].ToString();
                    slug        = row["slug"].ToString();
                    file_number = row["file_number"].ToString();
                    date        = row["date"].ToString();
                    create_date = row["create_date"].ToString();
                    update_date = "";
                    type        = row["type"].ToString();
                    exil        = "";
                    content     = row["content"].ToString();
                    citated     = (int)row["countCitated"];

                    if (row["court_id"] != null && row["court_id"].ToString().Length > 0)
                    {
                        Court c = new Court();
                        c.id              = row["court_id"].ToString();
                        c.jurisdiction    = row["court_jurisdiction"].ToString();
                        c.level_of_appeal = row["court_level_of_appeal"].ToString();
                        c.name            = row["court_name"].ToString();
                        c.slug            = "";
                        c.state           = row["court_state"].ToString();

                        court = c;
                    }
                }


                citations = new List <Citation>();

                foreach (DataRow row in con.GetSqlAsDataTable("SELECT DISTINCT ct.*, c.chamber from_case_court_chamber, c.city from_case_court_city, c.jurisdiction from_case_court_jurisdiction, c.level_of_appeal from_case_court_level_of_appeal, c.name from_case_court_name, c.state from_case_court_state FROM dbo.citations ct LEFT JOIN dbo.courts c ON c.id = ct.from_case_court_id where from_id = " + id + " OR to_id = " + id).Rows)
                {
                    citations.Add(new Citation(row));
                }
            }
            catch (Exception ex)
            {
                string exc = ex.ToString();
            }
        }
예제 #3
0
 public CourtDecision(JsonValue v)
 {
     id          = v["id"].ToString();
     slug        = v["slug"];
     type        = v["type"];
     file_number = v["file_number"];
     create_date = v["created_date"];
     date        = v["date"];
     content     = v["content"];
     if (v["court"] != null && v["court"]["id"] != null)
     {
         court                 = new Court();
         court.id              = v["court"]["id"].ToString();
         court.jurisdiction    = v["court"]["jurisdiction"];
         court.level_of_appeal = v["court"]["level_of_appeal"];
         court.name            = v["court"]["name"];
         court.slug            = v["court"]["slug"];
         court.state           = v["court"]["state"] != null ? v["court"]["state"].ToString() : null;
     }
 }