public ActionResult Login(OnlineRegModel m) { fromMethod = "Login"; // they clicked the Login button on the login page // var ret = Util.IsDebug() && Util.IsLocalNetworkRequest // ? AccountModel.AutoLogin(m.username, Session, Request) : var ret = AccountModel.AuthenticateLogon(m.username, m.password, Session, Request); if (ret is string) { ModelState.AddModelError("authentication", ret.ToString()); return FlowList(m); } Session["OnlineRegLogin"] = true; if (m.Orgid == Util.CreateAccountCode) { DbUtil.LogActivity("OnlineReg CreateAccount Existing", peopleid: Util.UserPeopleId, datumId: m.DatumId); return Content("/Person2/" + Util.UserPeopleId); // they already have an account, so take them to their page } m.UserPeopleId = Util.UserPeopleId; var route = RouteSpecialLogin(m); if (route != null) return route; m.HistoryAdd("login"); return FlowList(m); }
public ActionResult SaveProgress(OnlineRegModel m) { m.HistoryAdd("saveprogress"); if (m.UserPeopleId == null) m.UserPeopleId = Util.UserPeopleId; m.UpdateDatum(); var p = m.UserPeopleId.HasValue ? DbUtil.Db.LoadPersonById(m.UserPeopleId.Value) : m.List[0].person; if (p == null) return Content("We have not found your record yet, cannot save progress, sorry"); if (m.masterorgid == null && m.Orgid == null) return Content("Registration is not far enough along to save, sorry."); var msg = DbUtil.Db.ContentHtml("ContinueRegistrationLink", @" <p>Hi {first},</p> <p>Here is the link to continue your registration:</p> Resume [registration for {orgname}] ").Replace("{orgname}", m.Header); var linktext = Regex.Match(msg, @"(\[(.*)\])", RegexOptions.Singleline).Groups[2].Value; var registerlink = EmailReplacements.CreateRegisterLink(m.masterorgid ?? m.Orgid, linktext); msg = Regex.Replace(msg, @"(\[.*\])", registerlink, RegexOptions.Singleline); var notifyids = DbUtil.Db.NotifyIds((m.masterorg ?? m.org).NotifyIds); DbUtil.Db.Email(notifyids[0].FromEmail, p, $"Continue your registration for {m.Header}", msg); /* We use Content as an ActionResult instead of Message because we want plain text sent back * This is an HttpPost ajax call and will have a SiteLayout wrapping this. */ return Content(@" We have saved your progress. An email with a link to finish this registration will come to you shortly. <input type='hidden' id='SavedProgress' value='true'/> "); }
public ActionResult AskDonation(OnlineRegModel m) { m.HistoryAdd("AskDonation"); if (m.List.Count == 0) { m.Log("AskDonationError NoRegistrants"); return Content("Can't find any registrants"); } m.RemoveLastRegistrantIfEmpty(); SetHeaders(m); return View(m); }
public ActionResult AddAnotherPerson(OnlineRegModel m) { fromMethod = "AddAnotherPerson"; m.HistoryAdd("AddAnotherPerson"); m.ParseSettings(); if (!ModelState.IsValid) return FlowList(m); m.List.Add(new OnlineRegPersonModel { orgid = m.Orgid, masterorgid = m.masterorgid, }); return FlowList(m); }
public ActionResult AddAnotherPerson(OnlineRegModel m) { fromMethod = "AddAnotherPerson"; m.HistoryAdd("AddAnotherPerson"); m.ParseSettings(); if (!ModelState.IsValid) return FlowList(m); m.List.Add(new OnlineRegPersonModel { orgid = m.Orgid, masterorgid = m.masterorgid, #if DEBUG FirstName = "Delaine", LastName = "Carroll", EmailAddress = "*****@*****.**" #endif }); return FlowList(m); }
public ActionResult YesLogin(OnlineRegModel m) { fromMethod = "YesLogin"; // clicked the Login Here button m.HistoryAdd("yeslogin"); m.nologin = false; m.List = new List<OnlineRegPersonModel>(); #if DEBUG m.username = "******"; #endif return FlowList(m); }
public ActionResult SubmitQuestions(int id, OnlineRegModel m) { fromMethod = "SubmitQuestions"; m.HistoryAdd("SubmitQuestions id=" + id); if (m.List.Count <= id) return Content("<p style='color:red'>error: cannot find person on submit other info</p>"); m.List[id].ValidateModelQuestions(ModelState, id); return FlowList(m); }
public ActionResult SubmitNew(int id, OnlineRegModel m) { // Submit from AddressMaritalGenderForm fromMethod = "SubmitNew"; ModelState.Clear(); m.HistoryAdd("SubmitNew id=" + id); var p = m.List[id]; p.ValidateModelForNew(ModelState, id); SetHeaders(m); var ret = p.AddNew(ModelState, id); return ret.HasValue() ? View(ret, m) : FlowList(m); }
public ActionResult FindRecord(int id, OnlineRegModel m) { // Anonymous person clicks submit to find their record fromMethod = "FindRecord"; m.HistoryAdd("FindRecord id=" + id); if (id >= m.List.Count) return FlowList(m); var p = m.List[id]; if (p.NeedsToChooseClass()) return FlowList(m); p.ValidateModelForFind(ModelState, id); if (p.AnonymousReRegistrant()) return View("ConfirmReregister", m); // send email with link to reg-register if (p.IsSpecialReg()) p.QuestionsOK = true; else if (p.RegistrationFull()) { m.Log("Closed"); ModelState.AddModelError(m.GetNameFor(mm => mm.List[id].DateOfBirth), "Sorry, but registration is closed."); } p.FillPriorInfo(); p.SetSpecialFee(); if (!ModelState.IsValid || p.count == 1) return FlowList(m); // form is ok but not found, so show AddressGenderMarital Form p.PrepareToAddNewPerson(ModelState, id); p.Found = false; return FlowList(m); }
private ActionResult RouteRegistration(OnlineRegModel m, int pid, bool? showfamily) { if(pid == 0) return View(m); #if DEBUG m.DebugCleanUp(); #endif var link = RouteExistingRegistration(m, pid); if (link.HasValue()) return Redirect(link); OnlineRegPersonModel p = null; if (showfamily != true) { // No need to pick family, so prepare first registrant ready to answer questions p = m.LoadExistingPerson(pid, 0); p.ValidateModelForFind(ModelState, 0); if (m.masterorg == null) { if (m.List.Count == 0) m.List.Add(p); else m.List[0] = p; } } if (!ModelState.IsValid) { m.Log("CannotProceed"); return View(m); } link = RouteManageGivingSubscriptionsPledgeVolunteer(m); if(link.HasValue()) if (m.ManageGiving()) // use Direct ActionResult instead of redirect return ManageGiving(m.Orgid.ToString(), m.testing); else if (m.RegisterLinkMaster()) return Redirect(link); else return Redirect(link); // check for forcing show family, master org, or not found if (showfamily == true || p.org == null || p.Found != true) return View(m); // ready to answer questions, make sure registration is ok to go m.Log("Authorized"); if (!m.SupportMissionTrip) p.IsFilled = p.org.RegLimitCount(DbUtil.Db) >= p.org.Limit; if (p.IsFilled) { m.Log("Closed"); ModelState.AddModelError(m.GetNameFor(mm => mm.List[0].Found), "Sorry, but registration is closed."); } p.FillPriorInfo(); p.SetSpecialFee(); m.HistoryAdd($"index, pid={pid}, !showfamily, p.org, found=true"); return View(m); }
public ActionResult SubmitNew(int id, OnlineRegModel m) { // Submit from AddressMaritalGenderForm fromMethod = "SubmitNew"; ModelState.Clear(); m.HistoryAdd("SubmitNew id=" + id); var p = m.List[id]; if (p.ComputesOrganizationByAge()) p.orgid = null; // forget any previous information about selected org, may have new information like gender p.ValidateModelForNew(ModelState, id); SetHeaders(m); var ret = p.AddNew(ModelState, id); return ret.HasValue() ? View(ret, m) : FlowList(m); }