Ejemplo n.º 1
0
        public ArrayList LoadMonitoredVotes(string where, string date, string roll)
        {
            ArrayList ids = new ArrayList();

            foreach (string m in Login.GetMonitors())
            {
                Monitor mm = Monitor.FromString(m);
                if (mm != null && mm is PersonMonitor)
                {
                    ids.Add(((PersonMonitor)mm).Person);
                }
            }

            Reps.CacheRolesAt2(ids, date);

            Table votes = Util.Database.DBSelect("people_votes", "personid, vote",
                                                 new Database.SpecEQ("voteid", where + Util.DTToYearString(date) + "-" + roll),
                                                 new Database.SpecIn("personid", ids));
            ArrayList ret = new ArrayList();

            foreach (TableRow row in votes)
            {
                Hashtable h = new Hashtable();
                ret.Add(h);
                h["id"]   = row["personid"];
                h["vote"] = row["vote"];
                h["name"] = Reps.FormatPersonName((int)row["personid"], date, "");
            }
            return(ret);
        }
Ejemplo n.º 2
0
        public ArrayList GetPeople()
        {
            ArrayList people = new ArrayList();

            if (HttpContext.Current.Request["people"] != null)
            {
                string[] pp = HttpContext.Current.Request["people"].Split(',');
                foreach (string p in pp)
                {
                    try {
                        int           id = int.Parse(p);
                        PersonMonitor m  = new PersonMonitor(id);
                        people.Add(m);
                    } catch {
                    }
                }
            }
            else
            {
                foreach (string mon in Login.GetMonitors())
                {
                    Monitor m = Monitor.FromString(mon);
                    if (m == null)
                    {
                        continue;
                    }
                    if (!(m is PersonMonitor))
                    {
                        continue;
                    }
                    people.Add(m);
                }
            }

            for (int i = 0; i < people.Count; i++)
            {
                PersonMonitor m    = (PersonMonitor)people[i];
                Hashtable     info = new Hashtable();
                info["Id"]   = m.Person;
                info["Name"] = m.Display();
                info["Link"] = m.Link();
                info["Key"]  = Reps.FormatPersonName(m.Person, "now", "lastname");
                people[i]    = info;
            }

            people.Sort(new NameSorter());

            return(people);
        }