public ActionResult SubmitNew(int id, OnlineRegModel m)
        {
            // Submit from AddressMaritalGenderForm
            var msg = m.CheckExpiredOrCompleted();

            if (msg.HasValue())
            {
                return(PageMessage(msg));
            }
            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));
        }
        public ActionResult FindRecord(int id, OnlineRegModel m)
        {
            // Anonymous person clicks submit to find their record
            var msg = m.CheckExpiredOrCompleted();

            if (msg.HasValue())
            {
                return(PageMessage(msg));
            }

            fromMethod = "FindRecord";
            m.HistoryAdd("FindRecord id=" + id);
            if (id >= m.List.Count)
            {
                return(FlowList(m));
            }

            var p = m.GetFreshFindInfo(id);

            if (p.NeedsToChooseClass())
            {
                p.RegistrantProblem = "Please Make Selection Above";
                return(FlowList(m));
            }
            p.ValidateModelForFind(ModelState, id);
            if (!ModelState.IsValid)
            {
                return(FlowList(m));
            }

            if (p.AnonymousReRegistrant())
            {
                return(View("Continue/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));
        }
        public ActionResult RegisterFamilyMember(int id, OnlineRegModel m)
        {
            // got here by clicking on a link in the Family list
            var msg = m.CheckExpiredOrCompleted();

            if (msg.HasValue())
            {
                return(PageMessage(msg));
            }
            fromMethod = "Register";

            m.StartRegistrationForFamilyMember(id, ModelState);

            // show errors or take them to the Questions page
            return(FlowList(m));
        }
        public ActionResult SubmitQuestions(int id, OnlineRegModel m)
        {
            var ret = m.CheckExpiredOrCompleted();

            if (ret.HasValue())
            {
                return(PageMessage(ret));
            }

            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 SubmitQuestions(int id, OnlineRegModel m)
        {
            var ret = m.CheckExpiredOrCompleted();

            if (ret.HasValue())
            {
                return(PageMessage(ret));
            }

            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>"));
            }

            bool supportGoerRequired = CurrentDatabase.Setting("MissionSupportRequiredGoer", "false").ToBool();

            m.List[id].ValidateModelQuestions(ModelState, id, supportGoerRequired);
            return(FlowList(m));
        }
        public ActionResult AddAnotherPerson(OnlineRegModel m)
        {
            var ret = m.CheckExpiredOrCompleted();

            if (ret.HasValue())
            {
                return(PageMessage(ret));
            }
            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));
        }