Exemplo n.º 1
0
 public static string BillLink2(int session, BillType type, int number)
 {
     return(Util.UrlBase + "/congress/bill.xpd?"
            + "bill="
            + EnumsConv.BillTypeToString(type)
            + session
            + "-"
            + number);
 }
Exemplo n.º 2
0
 public static string BillLink(XPathNodeIterator bill)
 {
     if (!bill.MoveNext())
     {
         throw new ArgumentException();
     }
     return(BillLink2(
                int.Parse(bill.Current.GetAttribute("session", "")),
                EnumsConv.BillTypeFromString(bill.Current.GetAttribute("type", "")),
                int.Parse(bill.Current.GetAttribute("number", ""))
                ));
 }
 public string ChamberNameShort(string chamber)
 {
     if (chamber[0] == 'h')
     {
         return(EnumsConv.ChamberNameShort(Chamber.House));
     }
     if (chamber[0] == 's')
     {
         return(EnumsConv.ChamberNameShort(Chamber.Senate));
     }
     return("");
 }
Exemplo n.º 4
0
 public string ChamberNameLong(string chamber)
 {
     if (chamber == "h")
     {
         return(EnumsConv.ChamberNameLong(Chamber.House));
     }
     if (chamber == "s")
     {
         return(EnumsConv.ChamberNameLong(Chamber.Senate));
     }
     return("");
 }
Exemplo n.º 5
0
        public Table GetBillVotes()
        {
            BillType type;
            int      session, number;

            ParseBill2(out session, out type, out number);

            return(Util.Database.DBSelect("votes",
                                          "votes.id, votes.date, votes.description, votes.result, DATE_FORMAT(votes.date, '%Y-%m-%dT%T') as datestr",
                                          new Database.SpecEQ("votes.billsession", session),
                                          new Database.SpecEQ("votes.billtype", EnumsConv.BillTypeToString(type)),
                                          new Database.SpecEQ("votes.billnumber", number),
                                          new Database.SpecOrder("votes.date", false)));
        }
Exemplo n.º 6
0
 public static XPathNavigator GetSpeeches(XPathNodeIterator bill)
 {
     if (!bill.MoveNext())
     {
         throw new ArgumentException();
     }
     try {
         return(Util.LoadData(
                    int.Parse(bill.Current.GetAttribute("session", "")),
                    "index.cr.bill" + Path.DirectorySeparatorChar
                    + EnumsConv.BillTypeToString(EnumsConv.BillTypeFromString(bill.Current.GetAttribute("type", "")))
                    + bill.Current.GetAttribute("number", "")
                    + ".xml"));
     } catch (Exception e) {
     }
     return(new XmlDocument().CreateNavigator());
 }
Exemplo n.º 7
0
        public static XPathNavigator LoadBill()
        {
            if (!BillExists())
            {
                return(new System.Xml.XmlDocument().CreateNavigator());
            }

            string   bill = HttpContext.Current.Request["bill"];
            BillType type;
            int      session, number;

            ParseBill(bill, out session, out type, out number);

            Util.Database.DBExecute(
                "INSERT INTO billhits VALUES (" + session + ",'" + EnumsConv.BillTypeToString(type) + "'," + number + ",0,0) ON DUPLICATE KEY UPDATE hits1=hits1+1");

            return(Bills.LoadBill(session, type, number));
        }
Exemplo n.º 8
0
        public static bool BillExists()
        {
            // ought to be the first thing executed in the bill page

            string   bill = HttpContext.Current.Request["bill"];
            BillType type;
            int      session, number;

            if (bill == null)
            {
                throw new UserException("I'm sorry, you have followed an invalid link to GovTrack.  A bill was not properly specified in the URL.  Please ask the source of the link to correct the problem.");
            }
            if (!ParseBill(bill, out session, out type, out number))
            {
                throw new UserException("An invalid bill ID was specified in the URL.");
            }

            return(Bills.BillExists(session, EnumsConv.BillTypeToString(type), number));
        }
Exemplo n.º 9
0
        public static Hashtable GetBillNumber()
        {
            string   bill = HttpContext.Current.Request["bill"];
            BillType type;
            int      session, number;

            if (bill == null)
            {
                throw new UserException("I'm sorry, you have followed an invalid link to GovTrack.  A bill was not properly specified in the URL.  Please ask the source of the link to correct the problem.");
            }
            ParseBill(bill, out session, out type, out number);

            Hashtable ret = new Hashtable();

            ret["session"] = session;
            ret["type"]    = EnumsConv.BillTypeToString(type);
            ret["number"]  = number;
            return(ret);
        }
Exemplo n.º 10
0
        private void GetVotesFromBill(BillMonitor bm, Hashtable votes)
        {
            XPathNavigator bill      = Bills.LoadBill(bm.Session, bm.Type, bm.Number);
            string         title     = Bills.DisplayString(bill.Select("*"), 10000);
            string         statusstr = Bills.GetStatusSource(bill.Select("*"));

            ArrayList         rolls     = new ArrayList();
            XPathNodeIterator votesiter = bill.Select("bill/actions/vote");

            while (votesiter.MoveNext())
            {
                string roll = votesiter.Current.GetAttribute("roll", "");
                string date = votesiter.Current.GetAttribute("datetime", "");
                string where = votesiter.Current.GetAttribute("where", "");
                if (roll != null && roll != "" && date != null && date != "")
                {
                    rolls.Add(date + ":" + where + Util.DTToYearString(date) + "-" + roll);
                }
            }

            AddBillInfo(EnumsConv.BillTypeToString(bm.Type), bm.Session, bm.Number,
                        (string[])rolls.ToArray(typeof(string)), title, statusstr, votes);
        }
Exemplo n.º 11
0
 public static string BillTypeToDisplayString(string type)
 {
     return(EnumsConv.BillTypeToDisplayString(EnumsConv.BillTypeFromString(type)));
 }
Exemplo n.º 12
0
        public ArrayList GetSameTitledBills()
        {
            BillType type;
            int      session, number;

            ParseBill2(out session, out type, out number);

            // Get all of the many titles of this bill and form
            // a list of SQL starts-with tests.
            List <string>        titles     = new List <string>();
            List <Database.Spec> titlespecs = new List <Database.Spec>();

            foreach (string title_1 in Util.Database.DBSelectVector(
                         "billtitles", "title",
                         new Database.SpecEQ("session", session),
                         new Database.SpecEQ("type", EnumsConv.BillTypeToString(type)),
                         new Database.SpecEQ("number", number)))
            {
                // Lop off any "of YEAR" from the end of the title
                string title = lopOffYear(session, title_1);
                titles.Add(title);
                titlespecs.Add(new Database.SpecStartsWith("title", title));
            }

            // Return fast if there are no titles...
            if (titlespecs.Count == 0)
            {
                titlespecs.Add(new Database.SpecEQ("title", "blah"));
            }

            // Get all bills
            Table bills = Util.Database.DBSelect("billtitles",
                                                 "session, type, number",
                                                 new Database.SpecNot(new Database.AndSpec(
                                                                          new Database.SpecEQ("session", session),
                                                                          new Database.SpecEQ("type", EnumsConv.BillTypeToString(type)),
                                                                          new Database.SpecEQ("number", number))),
                                                 Database.OrSpec.New(titlespecs.ToArray()),
                                                 new Database.SpecDistinct());

            // For each bill, find its main title, and return that if it
            // is not one of the original bill's titles.
            ArrayList ret = new ArrayList();

            foreach (TableRow row in bills)
            {
                Hashtable b = new Hashtable(row);
                ret.Add(b);

                TableRow titlerow = Util.Database.DBSelectFirst(
                    "billtitles", "title",
                    new Database.SpecEQ("session", row["session"]),
                    new Database.SpecEQ("type", row["type"]),
                    new Database.SpecEQ("number", row["number"]),
                    new Database.SpecEQ("titletype", "short"));
                if (titlerow == null)
                {
                    continue;
                }

                string title = lopOffYear((int)row["session"], (string)titlerow["title"]);
                if (!titles.Contains(title))                 // not hashed
                {
                    b["title"] = title;
                }
            }
            return(ret);
        }
Exemplo n.º 13
0
 public BillRef(int session, string type, int number)
     : this(session, EnumsConv.BillTypeFromString(type), number)
 {
 }
Exemplo n.º 14
0
 public static XPathNodeIterator BillSummary(int session, string type, int number)
 {
     return(Util.LoadData(session, "bills.summary" + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(EnumsConv.BillTypeFromString(type)) + number + ".summary.xml").Select("/"));
 }
Exemplo n.º 15
0
        public static object LoadBillReport(int session, BillType type, int number, string reporttype)
        {
            if (reporttype.EndsWith("_summary"))
            {
                try {
                    reporttype = reporttype.Substring(0, reporttype.Length - "_summary".Length);
                    return(Util.LoadData(session, "bills." + reporttype + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + number + ".xml"));
                } catch (Exception e) {
                    return(new XmlDocument().CreateNavigator());
                }
            }

            try {
                System.IO.StreamReader reader = new System.IO.StreamReader(
                    Util.DataPath + Path.DirectorySeparatorChar + session + Path.DirectorySeparatorChar + "bills." + reporttype + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + number + ".txt");
                string ret = reader.ReadToEnd();
                reader.Close();
                return(ret);
            } catch (Exception e) {
                return("");
            }
        }
Exemplo n.º 16
0
 public BillRef(XPathNavigator nav)
 {
     this.Session = int.Parse(nav.GetAttribute("session", ""));
     this.Type    = EnumsConv.BillTypeFromString(nav.GetAttribute("type", ""));
     this.Number  = int.Parse(nav.GetAttribute("number", ""));
 }
Exemplo n.º 17
0
 public static XPathNavigator LoadBill(int session, string type, int number)
 {
     return(Bills.LoadBill(session, EnumsConv.BillTypeFromString(type), number));
 }
        public static Hashtable Search(bool api)
        {
            BillType type;
            int      number;
            int      session = -1;

            if (HttpContext.Current.Request["session"] != null && HttpContext.Current.Request["session"] != "")
            {
                session = int.Parse(HttpContext.Current.Request["session"]);
            }

            string q = HttpContext.Current.Request["q"];

            int start = 0, count = (!api ? 30 : 1000);

            if (HttpContext.Current.Request["start"] != null)
            {
                start = int.Parse(HttpContext.Current.Request["start"]);
            }
            if (HttpContext.Current.Request["count"] != null)
            {
                count = int.Parse(HttpContext.Current.Request["count"]);
            }

            BooleanQuery query = new BooleanQuery();

            Hashtable no_results = new Hashtable();

            no_results["count"] = 0;

            if (q != null && q.IndexOf("*") > -1)
            {
                return(no_results);
            }

            if (!api && session == -1 && q != null)
            {
                int slash = q.IndexOf('/');
                if (slash >= q.Length - 4 && slash > 2)
                {
                    try {
                        session = int.Parse(q.Substring(slash + 1));                       // and if that worked...
                        q       = q.Substring(0, slash);
                        HttpContext.Current.Response.Redirect("billsearch.xpd?session=" + session + "&q=" + HttpUtility.UrlEncode(q));
                        return(null);
                    } catch { }
                }
            }

            if (session == -1)
            {
                session = Util.CurrentSession;
            }

            //Console.Error.WriteLine("Find: " + q);

            string    search_method = "search";
            ArrayList specs         = new ArrayList();
            Hashtable scores        = new Hashtable();

            // Match a bill number exactly
            if (q != null && Bills.ParseID(q, out type, out number))
            {
                if (!api)
                {
                    // Redirect the user right to the bill page.
                    // Don't even check if bill exists.
                    HttpContext.Current.Response.Redirect(
                        Bills.BillLink2(session, type, number));
                    return(null);
                }
                else
                {
                    search_method = "search by bill number";
                    scores[session + EnumsConv.BillTypeToString(type) + number] = 1.0F;
                    specs.Add(new Database.AndSpec(
                                  new Database.SpecEQ("session", session),
                                  new Database.SpecEQ("type", EnumsConv.BillTypeToString(type)),
                                  new Database.SpecEQ("number", number)));
                }
            }

            // Match public law number exactly
            if (!api && q != null && (q.StartsWith("P.L.") || q.StartsWith("PL")))
            {
                try {
                    string num = null;
                    if (q.StartsWith("P.L."))
                    {
                        num = q.Substring(4);
                    }
                    if (q.StartsWith("PL"))
                    {
                        num = q.Substring(2);
                    }
                    num = num.Replace(" ", "");

                    int dash = num.IndexOf('-');
                    int s    = int.Parse(num.Substring(0, dash));

                    TableRow bill = Util.Database.DBSelectFirst("billindex", "session, type, number",
                                                                new Database.SpecEQ("idx", "publiclawnumber"),
                                                                new Database.SpecEQ("session", s),
                                                                new Database.SpecEQ("value", num));

                    if (bill != null)
                    {
                        if (!api)
                        {
                            HttpContext.Current.Response.Redirect(Bills.BillLink3((int)bill["session"], (string)bill["type"], (int)bill["number"]));
                            return(null);
                        }
                        else
                        {
                            search_method = "search by public law number";
                            scores[(int)bill["session"] + (string)bill["type"] + (int)bill["number"]] = 1.0F;
                            specs.Add(new Database.AndSpec(
                                          new Database.SpecEQ("session", (int)bill["session"]),
                                          new Database.SpecEQ("type", (string)bill["type"]),
                                          new Database.SpecEQ("number", (int)bill["number"])));
                        }
                    }
                } catch {
                }
            }

            if (session == -1)
            {
                session = Util.CurrentSession;
            }

            // Match USC reference
            Regex uscexp = new Regex(@"(\d[0-9A-Za-z\-]*)\s+U\.?S\.?C\.?\s+(\d[0-9A-Za-z\-]*)((\s*\([^\) ]+\))*)",
                                     RegexOptions.IgnoreCase);
            Match uscmc = (q == null ? null : uscexp.Match(q));

            if (uscmc != null && uscmc.Success)
            {
                string title     = uscmc.Groups[1].Value;
                string section   = uscmc.Groups[2].Value;
                string paragraph = uscmc.Groups[3].Value;

                string[] ps  = paragraph.Split('[', '(', ')', ' ');
                int      psi = 0; while (psi < ps.Length - 1 && ps[psi] == "")
                {
                    psi++;
                }
                int pse = ps.Length - 1; while (pse > 0 && ps[pse] == "")
                {
                    pse--;
                }
                if (ps.Length != 0)
                {
                    paragraph = "_" + String.Join("_", ps, psi, pse - psi + 1);
                }

                Table table = Util.Database.DBSelect("billusc", "session, type, number",
                                                     new Database.SpecEQ("session", session),
                                                     new Database.OrSpec(
                                                         new Database.SpecEQ("ref", title + "_" + section + paragraph),
                                                         new Database.SpecStartsWith("ref", title + "_" + section + paragraph + "_")));
                foreach (TableRow bill in table)
                {
                    search_method = "search by U.S.C. section";
                    scores[(int)bill["session"] + (string)bill["type"] + (int)bill["number"]] = 1.0F;
                    specs.Add(new Database.AndSpec(
                                  new Database.SpecEQ("session", (int)bill["session"]),
                                  new Database.SpecEQ("type", (string)bill["type"]),
                                  new Database.SpecEQ("number", (int)bill["number"])));
                }
            }

            int total_count = -1;

            if (specs.Count == 0)
            {
                if (q != null && q.Trim() != "")
                {
                    BooleanQuery query1 = new BooleanQuery();
                    query.Add(query1, BooleanClause.Occur.MUST);
                    try {
                        /*if (!q.StartsWith("-")) {
                         *      PhraseQuery pq = new PhraseQuery();
                         *      pq.Add( new Term("shorttitles", q) );
                         *      pq.SetBoost((float)4);
                         *      query1.Add(pq, false, false);
                         * }*/

                        Query query_titles2 = new QueryParser("shorttitles", new StandardAnalyzer()).Parse(q);
                        query_titles2.SetBoost((float)3);
                        query1.Add(query_titles2, BooleanClause.Occur.SHOULD);

                        Query query_titles1 = new QueryParser("officialtitles", new StandardAnalyzer()).Parse(q);
                        query_titles1.SetBoost((float)2);
                        query1.Add(query_titles1, BooleanClause.Occur.SHOULD);

                        Query query_summary = new QueryParser("summary", new StandardAnalyzer()).Parse(q);
                        query1.Add(query_summary, BooleanClause.Occur.SHOULD);

                        Query query_text = new QueryParser("fulltext", new StandardAnalyzer()).Parse(q);
                        query1.Add(query_text, BooleanClause.Occur.SHOULD);
                    } catch (Exception e) {
                        return(no_results);
                    }
                }

                string   chamber   = HttpContext.Current.Request["chamber"];
                string[] status    = HttpContext.Current.Request["status"] == null ? null : HttpContext.Current.Request["status"].Split(',');
                string   sponsor   = HttpContext.Current.Request["sponsor"];
                string   cosponsor = HttpContext.Current.Request["cosponsor"];

                if (chamber != null && (chamber == "s" || chamber == "h"))
                {
                    query.Add(new WildcardQuery(new Term("type", chamber + "*")), BooleanClause.Occur.MUST);
                }
                if (status != null && status[0] != "")
                {
                    List <Term> terms = new List <Term>();
                    foreach (string s in status)
                    {
                        terms.Add(new Term("state", s));
                    }
                    MultiPhraseQuery mpq = new MultiPhraseQuery();
                    mpq.Add(terms.ToArray());
                    query.Add(mpq, BooleanClause.Occur.MUST);
                }
                if (sponsor != null && sponsor != "")
                {
                    query.Add(new TermQuery(new Term("sponsor", sponsor)), BooleanClause.Occur.MUST);
                }
                if (cosponsor != null && cosponsor != "")
                {
                    query.Add(new TermQuery(new Term("cosponsor", cosponsor)), BooleanClause.Occur.MUST);
                }

                IndexSearcher searcher = new IndexSearcher(Util.DataPath + Path.DirectorySeparatorChar + session + Path.DirectorySeparatorChar + "index.bills.lucene");

                Sort sort = null;
                if (HttpContext.Current.Request["sort"] != null && HttpContext.Current.Request["sort"] == "introduced")
                {
                    sort = new Sort(new SortField("introduced", SortField.STRING, true));
                }
                if (HttpContext.Current.Request["sort"] != null && HttpContext.Current.Request["sort"] == "lastaction")
                {
                    sort = new Sort(new SortField("lastaction", SortField.STRING, true));
                }

                Hits hits = searcher.Search(query, sort == null ? new Sort() : sort);

                int end = hits.Length();
                if (start + count < end)
                {
                    end = start + count;
                }
                total_count = hits.Length();

                for (int i = start; i < end; i++)
                {
                    Document doc         = hits.Doc(i);
                    string   billsession = doc.Get("session");
                    string   billtype    = doc.Get("type");
                    string   billnumber  = doc.Get("number");

                    int istatus = (int)EnumsConv.BillStatusFromString(doc.Get("status"));

                    float score;
                    if (sort == null)             // readjust the score based on status
                    {
                        score = hits.Score(i) + istatus / (float)8 * (float).2;
                    }
                    else             // keep order from Lucene
                    {
                        score = -i;
                    }

                    scores[billsession + billtype + billnumber] = score;
                    specs.Add(new Database.AndSpec(
                                  new Database.SpecEQ("session", billsession),
                                  new Database.SpecEQ("type", billtype),
                                  new Database.SpecEQ("number", billnumber)));
                }

                if (HttpContext.Current.Request["sort"] != null && HttpContext.Current.Request["sort"] == "hits" && specs.Count > 0)
                {
                    Table hitsinfo = Util.Database.DBSelect("billhits", "*",
                                                            Database.OrSpec.New((Database.Spec[])specs.ToArray(typeof(Database.Spec))));
                    foreach (TableRow billhits in hitsinfo)
                    {
                        scores["" + billhits["session"] + billhits["type"] + billhits["number"]] = (float)(int)billhits["hits1"];
                    }
                }
            }

            if (specs.Count == 0)
            {
                return(no_results);
            }

            Table billinfo = Util.Database.DBSelect("billstatus", "*",
                                                    Database.OrSpec.New((Database.Spec[])specs.ToArray(typeof(Database.Spec))));

            if (total_count == -1)
            {
                total_count = billinfo.Rows;
            }

            ArrayList ret = new ArrayList();

            foreach (TableRow r in billinfo)
            {
                ret.Add(r);
            }

            BillHitComparer bhc = new BillHitComparer();

            bhc.scores = scores;
            ret.Sort(bhc);

            Hashtable ret2 = new Hashtable();

            ret2["count"]   = total_count;
            ret2["method"]  = search_method;
            ret2["results"] = ret;

            return(ret2);
        }
Exemplo n.º 19
0
 public override string ToString()
 {
     return(EnumsConv.BillTypeToString(Type) + Session + "-" + Number);
 }
Exemplo n.º 20
0
 public static string GetBillTextFileName(int session, BillType type, int number, string format, string version, string compareto)
 {
     if (format == "html")
     {
         if (compareto == null)
         {
             format = "gen.html";
         }
         else
         {
             return(Util.DataPath + Path.DirectorySeparatorChar + "bills.text.cmp" + Path.DirectorySeparatorChar + session + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + number + "_" + compareto + "-" + version + ".xml");
         }
     }
     return(Util.DataPath + Path.DirectorySeparatorChar + "bills.text" + Path.DirectorySeparatorChar + session + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + number + version + "." + format);
 }
Exemplo n.º 21
0
        private static string GetStatusText(XPathNavigator root, XPathNavigator status, out object details)
        {
            try {
                bool isCurrentSession = true;         // default
                // this doesn't work on index nodes
                if (root.GetAttribute("session", "") != "")
                {
                    int session = int.Parse(root.GetAttribute("session", ""));
                    isCurrentSession = (session == Util.CurrentSession);
                }

                BillStatus s = EnumsConv.BillStatusFromString(status.Name);
                switch (s)
                {
                case BillStatus.Introduced:
                    /*if ((string)status.Evaluate("name(parent::*)") == "status")
                     *      details = new IntroducedDetails(int.Parse((string)root.Evaluate("string(/bill/sponsor/@id)")));
                     * else if ((string)status.Evaluate("name(parent::*)") == "statusxml")
                     *      details = null;
                     * else
                     *      details = new IntroducedDetails(int.Parse((string)status.Evaluate("string(@sponsor)")));*/
                    details = null;
                    if (isCurrentSession)
                    {
                        return("Introduced");
                    }
                    else
                    {
                        return("Dead");
                    }

                case BillStatus.Calendar:
                    details = null;
                    if (isCurrentSession)
                    {
                        return("Reported by Committee");
                    }
                    else
                    {
                        return("Dead");
                    }

                case BillStatus.Vote:
                case BillStatus.Vote2:
                    if (status.GetAttribute("how", "") == "roll")
                    {
                        string info = "";
                        try {
                            DateTime date = Util.DTToDateTime(status.GetAttribute("date", ""));
                            string   file = GetRollFileName(status.GetAttribute("where", ""), date, int.Parse(status.GetAttribute("roll", ""))) + ".txt";
                            info = Util.LoadFileString(Util.SessionFromDateTime(date), "gen.rolls-pca" + Path.DirectorySeparatorChar + file);
                        } catch (Exception e) { }
                        details = new VoteDetails(
                            status.GetAttribute("where", "") == "h" ? Chamber.House : Chamber.Senate,
                            Util.DTToDateTime(status.GetAttribute("datetime", "")),
                            int.Parse(status.GetAttribute("roll", "")),
                            status.GetAttribute("result", "") == "pass",
                            info
                            );
                    }
                    else
                    {
                        details = null;
                    }
                    string result = status.GetAttribute("result", "");
                    if (result == "pass")
                    {
                        result = "Passed";
                    }
                    else if (result == "fail")
                    {
                        result = "Failed";
                    }
                    else
                    {
                        throw new InvalidOperationException("Invalid vote result: " + result);
                    }
                    Chamber chamber = EnumsUtil.BillTypeChamber(EnumsConv.BillTypeFromString(status.GetAttribute("where", "")));
                    if (s == BillStatus.Vote)
                    {
                        return(result + " " + EnumsConv.ChamberNameShort(chamber));
                    }
                    else
                    {
                        return("Passed " + EnumsConv.ChamberNameShort(EnumsUtil.Other(chamber))
                               + ", " + result + " " + EnumsConv.ChamberNameShort(chamber));
                    }

                case BillStatus.Conference:
                    details = "";
                    return("Resolving Differences");

                case BillStatus.ToPresident:
                    details = null;
                    return("Sent to President");

                case BillStatus.Signed:
                    details = null;
                    return("Signed by President");

                case BillStatus.Veto:
                    details = null;
                    return("Vetoed by President");

                case BillStatus.Override:
                    details = null;
                    string result1 = status.GetAttribute("result", "");
                    if (result1 == "pass")
                    {
                        result1 = "Succeeded";
                    }
                    else if (result1 == "fail")
                    {
                        result1 = "Failed";
                    }
                    return("Veto Override " + result1);

                case BillStatus.Enacted:
                    details = null;
                    return("Enacted");
                }
                throw new InvalidOperationException();
            } catch (Exception e) {
                details = null;
                return("Unknown");
            }
        }
Exemplo n.º 22
0
 public static string BillLink3(int session, string type, int number)
 {
     return(BillLink2(session, EnumsConv.BillTypeFromString(type), number));
 }
Exemplo n.º 23
0
 public static XPathNavigator LoadBill(int session, BillType type, int number)
 {
     return(Util.LoadData(session, "bills" + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + number + ".xml"));
 }
Exemplo n.º 24
0
 public static XPathNavigator LoadBillBlogs(int session, BillType type, int number)
 {
     try {
         return(Util.LoadData(session, "bills.blogs" + Path.DirectorySeparatorChar + EnumsConv.BillTypeToString(type) + number + ".xml"));
     } catch (System.IO.FileNotFoundException ex) {
         return(new XmlDocument().CreateNavigator());
     }
 }