public ActionResult NoLogin(OnlineRegModel m)
 {
     fromMethod = "NoLogin";
     // Clicked the register without logging in link
     m.nologin = true;
     m.CreateAnonymousList();
     m.Log("NoLogin");
     return FlowList(m);
 }
Exemple #2
0
 private string RouteExistingRegistration(OnlineRegModel m, int? pid = null)
 {
     var existingRegistration = m.GetExistingRegistration(pid ?? Util.UserPeopleId ?? 0);
     if (existingRegistration == null)
         return null;
     m.Log("Existing");
     TempData["PeopleId"] = existingRegistration.UserPeopleId;
     return "/OnlineReg/Existing/" + existingRegistration.DatumId;
 }
 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);
 }
 private ActionResult FlowList(OnlineRegModel m)
 {
     try
     {
         m.UpdateDatum();
         m.Log(fromMethod);
         var content = ViewExtensions2.RenderPartialViewToString2(this, "Flow2/List", m);
         return Content(content);
     }
     catch (Exception ex)
     {
         return ErrorResult(m, ex, "In " + fromMethod + "<br>" + ex.Message);
     }
 }
        private ActionResult ErrorResult(OnlineRegModel m, Exception ex, string errorDisplay)
        {
            // ReSharper disable once EmptyGeneralCatchClause
            try
            {
                m.UpdateDatum();
            }
            catch
            {
            }

            var ex2 = new Exception($"{errorDisplay}, {DbUtil.Db.ServerLink("/OnlineReg/RegPeople/") + m.DatumId}", ex);
            ErrorSignal.FromCurrentContext().Raise(ex2);
            m.Log(ex2.Message);
            TempData["error"] = errorDisplay;
            TempData["stack"] = ex.StackTrace;
            return Content("/Error/");
        }
        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);
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        private ActionResult RouteSpecialLogin(OnlineRegModel m)
        {
            if (Util.UserPeopleId == null)
                throw new Exception("Util.UserPeopleId is null on login");

            var link = RouteExistingRegistration(m);
            if(link.HasValue())
                return Redirect(link);

            m.CreateAnonymousList();
            m.UserPeopleId = Util.UserPeopleId;

            if (m.OnlineGiving())
            {
                m.Log("Login OnlineGiving");
                return RegisterFamilyMember(Util.UserPeopleId.Value, m);
            }

            link = RouteManageGivingSubscriptionsPledgeVolunteer(m);
            if (link.HasValue())
                return Content(link); // this will be used for a redirect in javascript

            return null;
        }