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
 /// <summary>
 /// Default Constructor
 /// </summary>
 private Files()
 {
     _jm = Jobs.Instance;
     _rm = Reps.Instance;
     _cm = Companies.Instance;
     _bm = JobBoards.Instance;
 }
Ejemplo n.º 3
0
        // GET: Reps/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Reps reps = db.Reps.Find(id);

            if (reps == null)
            {
                return(HttpNotFound());
            }

            IEnumerable <SelectListItem> regionItems = db.Regions.AsEnumerable().Select(c => new SelectListItem()
            {
                Text     = c.Region,
                Value    = c.RegionID.ToString(),
                Selected = false,
            });
            SelectList RegionList = new SelectList(regionItems, "Value", "Text");

            ViewBag.RegionList = RegionList;

            return(View(reps));
        }
Ejemplo n.º 4
0
        private static QuantifierNode CreateWithRepetitions(Reps repetitions)
        {
            var node = new QuantifierNode();

            node.InputCount.Value = repetitions;
            return(node);
        }
Ejemplo n.º 5
0
        //Methods


        //Check to see if this Exercise equals an exercise passed in
        public override bool Equals(object obj)
        {
            bool     equals = true;
            Exercise ex     = (Exercise)obj;

            if (!Name.Equals(ex.Name))
            {
                equals = false;
            }
            else if (!ExerciseNumber.Equals(ex.ExerciseNumber))
            {
                equals = false;
            }
            else if (!Weight.Equals(ex.Weight))
            {
                equals = false;
            }
            else if (!Sets.Equals(ex.Sets))
            {
                equals = false;
            }
            else if (!Reps.Equals(ex.Reps))
            {
                equals = false;
            }
            else if (!LastSetReps.Equals(ex.LastSetReps))
            {
                equals = false;
            }
            return(equals);
        }
Ejemplo n.º 6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Reps reps = db.Reps.Find(id);

            db.Reps.Remove(reps);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 7
0
 public ActionResult Edit([Bind(Include = "RepID,FirstName,LastName,RegionID,Twitter,Facebook,Instagram,Email,Active")] Reps reps)
 {
     if (ModelState.IsValid)
     {
         db.Entry(reps).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(reps));
 }
Ejemplo n.º 8
0
        public ActionResult Create([Bind(Include = "RepID,FirstName,LastName,RegionID,Twitter,Facebook,Instagram,Email,Active")] Reps reps)
        {
            if (ModelState.IsValid)
            {
                db.Reps.Add(reps);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(reps));
        }
Ejemplo n.º 9
0
        public override ParseGraphNode BuildParseGraph(RuntimeState state)
        {
            PatternExpression body = (PatternExpression)this.body;

            string reps = (string)this.reps;

            return(new RepNode(
                       Source,
                       body.BuildParseGraph(state),
                       Reps.ForName(reps)));
        }
Ejemplo n.º 10
0
        public static object GetCurrentRole(int id)
        {
            TableRow rolerow = Reps.GetPersonCurrentRoleInfo(id);

            if (rolerow == null)
            {
                return("none");
            }
            Hashtable role = new Hashtable(rolerow);

            FixupRole(role);
            return(role);
        }
Ejemplo n.º 11
0
        // GET: Reps/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Reps reps = db.Reps.Find(id);

            if (reps == null)
            {
                return(HttpNotFound());
            }
            return(View(reps));
        }
Ejemplo n.º 12
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);
        }
Ejemplo n.º 13
0
        public bool Process(HttpContext context)
        {
            /*string zipcode = context.Request["zipcode"];
             * if (zipcode != null && zipcode != "") {
             *      string[] cdists = Reps.AddressToDistrict("zipcode", zipcode);
             *      if (cdists.Length == 0) {
             *              context.Items["govtrack-zipcode_formreturn"] = "The ZIP code you entered was not found in our database.";
             *      } else if (cdists.Length == 1) {
             *              string state = cdists[0].Substring(0, 2);
             *              string dist = cdists[0].Substring(2);
             *              context.Response.Redirect("findyourreps.xpd?state=" + state + "&district=" + dist);
             *              return true;
             *      } else {
             *              string state = cdists[0].Substring(0, 2);
             *              foreach (string cdist in cdists) {
             *                      if (!cdist.StartsWith(state)) {
             *                              context.Items["govtrack-zipcode_formreturn"] = "Your ZIP code crosses state lines.  You'll have to choose which state you live in.";
             *                              return false;
             *                      }
             *              }
             *              context.Response.Redirect("findyourreps.xpd?state=" + state + "&zipstatus=multiple");
             *              return true;
             *      }
             * }*/

            string action = context.Request["action"];

            if (action != null && action == "monitor")
            {
                foreach (int id in Reps.GetReps(context.Request["state"], context.Request["district"]))
                {
                    Login.AddMonitor("p:" + id);
                }
            }

            string statename = context.Request["state"];

            if (statename != null && Util.IsValidStateName(statename))
            {
                context.Response.Redirect("findyourreps.xpd?state=" + Util.GetStateAbbr(statename));
                return(true);
            }

            return(false);
        }
        public string CachePersonData(XPathNodeIterator ids, string when)
        {
            List <int> idlist = new List <int>();

            while (ids.MoveNext())
            {
                idlist.Add(int.Parse(ids.Current.Value));
            }

            if (idlist.Count == 0)
            {
                return("");
            }

            Table     people = Util.Database.DBSelect("people", "id, firstname, lastname", new Database.SpecIn("id", idlist));
            Hashtable names  = new Hashtable();

            foreach (TableRow person in people)
            {
                int    id = (int)(uint)person["id"];
                string fn = (string)person["firstname"];
                if (fn.IndexOf("|") != -1)
                {
                    fn = fn.Substring(0, fn.IndexOf("|"));
                }
                string ln = (string)person["lastname"];
                names[id] = ln + ", " + fn;
            }
            HttpContext.Current.Items["govtrack-vote-repname"] = names;

            Table     peopleroles = Util.Database.DBSelect("people_roles", "personid, party", new Database.SpecIn("personid", idlist), Reps.RoleThen(-1, Util.DTToDateTime(when)));
            Hashtable parties     = new Hashtable();

            foreach (TableRow person in peopleroles)
            {
                int id = (int)person["personid"];

                string party = (string)person["party"];
                if (party == null || party.Length == 0)
                {
                    party = "?";
                }
                names[id] = (string)names[id] + " [" + party[0] + "]";

                if (party == "?")
                {
                    party = "Unknown";
                }
                parties[id] = party;
            }
            HttpContext.Current.Items["govtrack-vote-repparty"] = parties;
            return("");
        }
Ejemplo n.º 15
0
 public void bulkLifting()                              //Bulk lifting specifications
 {
     weightAmt = Weight.ninetyLbs;
     setAmt    = Sets.threeSets;
     repAmt    = Reps.fiveReps;
 }
Ejemplo n.º 16
0
 public void toneLifting()                               //Tone lifting specifications
 {
     weightAmt = Weight.fortyLbs;
     setAmt    = Sets.fourSets;
     repAmt    = Reps.twelveReps;
 }