Exemplo n.º 1
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.º 2
0
        public object GetBill()
        {
            if (HttpContext.Current.Request.Params["bill"] != null)
            {
                BillType type;
                int      session, number;

                if (!Bill.ParseBill(HttpContext.Current.Request["bill"], out session, out type, out number))
                {
                    throw new UserException("An invalid bill ID was specified in the URL.");
                }

                XPathNavigator bill = Bills.LoadBill(session, type, number);
                return(bill);
            }

            return("");
        }
Exemplo n.º 3
0
        public object GetRecipients()
        {
            ArrayList recips = new ArrayList();

            if (HttpContext.Current.Request.Params["bill"] != null)
            {
                BillType type;
                int      session, number;

                if (!Bill.ParseBill(HttpContext.Current.Request["bill"], out session, out type, out number))
                {
                    throw new UserException("An invalid bill ID was specified in the URL.");
                }

                XPathNavigator bill    = Bills.LoadBill(session, type, number);
                string         sponsor = (string)bill.Evaluate("string(/bill/sponsor/@id)");
                recips.Add(sponsor);
            }
            else if (HttpContext.Current.Request.Params["person"] != null)
            {
                recips.Add(HttpContext.Current.Request.Params["person"]);
            }
            else
            {
                throw new UserException("No recipient information was specified in the URL.");
            }

            foreach (string monitor in Login.GetMonitors())
            {
                if (monitor.StartsWith("p:"))
                {
                    recips.Add(monitor.Substring(2));
                }
            }


            return(recips);
        }
Exemplo n.º 4
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.º 5
0
 public static XPathNavigator LoadBill(int session, string type, int number)
 {
     return(Bills.LoadBill(session, EnumsConv.BillTypeFromString(type), number));
 }