Example #1
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", ""))
                ));
 }
Example #2
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());
 }
Example #3
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("/"));
 }
Example #4
0
 public static XPathNavigator LoadBill(int session, string type, int number)
 {
     return(Bills.LoadBill(session, EnumsConv.BillTypeFromString(type), number));
 }
Example #5
0
 public static string BillTypeToDisplayString(string type)
 {
     return(EnumsConv.BillTypeToDisplayString(EnumsConv.BillTypeFromString(type)));
 }
Example #6
0
 public static string BillLink3(int session, string type, int number)
 {
     return(BillLink2(session, EnumsConv.BillTypeFromString(type), number));
 }
Example #7
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");
            }
        }
Example #8
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", ""));
 }
Example #9
0
 public BillRef(int session, string type, int number)
     : this(session, EnumsConv.BillTypeFromString(type), number)
 {
 }