public bool Process(HttpContext context) { string monitor = context.Request["remove"]; if (monitor != null) { Login.RemoveMonitor(monitor); context.Response.Redirect("/users/yourmonitors.xpd"); return(true); } monitor = context.Request["add"]; if (monitor != null) { bool isValid; Monitor monobj = Monitor.FromString(monitor, out isValid); if (monobj == null && !isValid) { return(false); } Login.AddMonitor(monitor); context.Response.Redirect("/users/yourmonitors.xpd"); return(true); } return(false); }
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); }