Esempio n. 1
0
 public static OnlineRegPersonModel0 CreateFromSettings(CMSDataContext db, int orgid)
 {
     var m = new OnlineRegPersonModel0(null, db);
     var settings = db.CreateRegistrationSettings(orgid);
     foreach (var ask in settings.AskItems)
     {
         switch (ask.Type)
         {
             case "AskExtraQuestions":
                 var eq = (AskExtraQuestions)ask;
                 if(eq.UniqueId >= m.ExtraQuestion.Count)
                     m.ExtraQuestion.Add(new Dictionary<string, string>());
                 foreach (var q in eq.list)
                     m.ExtraQuestion[eq.UniqueId][q.Question] = "";
                 break;
             case "AskText":
                 var tx = (AskText)ask;
                 if(tx.UniqueId >= m.Text.Count)
                     m.Text.Add(new Dictionary<string, string>());
                 foreach (var q in tx.list)
                     m.Text[tx.UniqueId][q.Question] = "";
                 break;
         }
     }
     return m;
 }
Esempio n. 2
0
        public SummaryInfo(CMSDataContext db, int pid, int oid)
        {
            this.db      = db;
            hbContext    = Handlebars.Create();
            OrgMember    = OrganizationMember.Load(db, pid, oid);
            Person       = db.LoadPersonById(pid);
            Organization = db.LoadOrganizationById(oid);
            if (!OrgMember.OnlineRegData.HasValue())
            {
                return;
            }
            // ReSharper disable once UseObjectOrCollectionInitializer
            RegPerson = new OnlineRegPersonModel0(OrgMember.OnlineRegData, db);
            if (RegPerson.PeopleId == 0)
            {
                RegPerson.PeopleId = pid;
                RegPerson.person   = Person;
            }
            RegPerson.setting = db.CreateRegistrationSettings(Organization.RegSettingXml, oid);

            hbContext.RegisterHelper("Registrant", Registrant);
            hbContext.RegisterHelper("IfShowTransaction", IfShowTransaction);
            hbContext.RegisterHelper("IfSupportMissionTrip", IfSupportMissionTrip);
            hbContext.RegisterHelper("AskItems", AskItems);

            hbContext.RegisterHelper("IfAskAllergies", IfAskAllergies);
            hbContext.RegisterHelper("IfAskCheckboxes", IfAskCheckboxes);
            hbContext.RegisterHelper("IfAskCoaching", IfAskCoaching);
            hbContext.RegisterHelper("IfAskChurch", IfAskChurch);
            hbContext.RegisterHelper("IfAskDoctor", IfAskDoctor);
            hbContext.RegisterHelper("IfAskDropdown", IfAskDropdown);
            hbContext.RegisterHelper("IfAskEmContact", IfAskEmContact);
            hbContext.RegisterHelper("IfAskExtraQuestions", IfAskExtraQuestions);
            hbContext.RegisterHelper("IfAskGradeOptions", IfAskGradeOptions);
            hbContext.RegisterHelper("IfAskHeader", IfAskHeader);
            hbContext.RegisterHelper("IfAskInstruction", IfAskInstruction);
            hbContext.RegisterHelper("IfAskInsurance", IfAskInsurance);
            hbContext.RegisterHelper("IfAskPassport", IfAskPassport);
            hbContext.RegisterHelper("IfAskMenu", IfAskMenu);
            hbContext.RegisterHelper("IfAskParents", IfAskParents);
            hbContext.RegisterHelper("IfAskRequest", IfAskRequest);
            hbContext.RegisterHelper("IfAskSize", IfAskSize);
            hbContext.RegisterHelper("IfAskSms", IfAskSms);
            hbContext.RegisterHelper("IfAskTextQuestions", IfAskTextQuestions);
            hbContext.RegisterHelper("IfAskTickets", IfAskTickets);
            hbContext.RegisterHelper("IfAskTylenolEtc", IfAskTylenolEtc);
            hbContext.RegisterHelper("IfAskYesNoQuestions", IfAskYesNoQuestions);

            hbContext.RegisterHelper("IfHasAgeGroups", IfHasAgeGroups);
            hbContext.RegisterHelper("MenuItems", MenuItems);
            hbContext.RegisterHelper("Checkboxes", Checkboxes);

            hbContext.RegisterHelper("TopLabel", (writer, context, args) => { writer.Write(TopLabel); });
            hbContext.RegisterHelper("BottomStyle", (writer, context, args) => { writer.Write(RowStyle); });

            PythonModel.RegisterHelpers(db, handlebars: hbContext);
        }
Esempio n. 3
0
        public SummaryInfo(CMSDataContext db, int pid, int oid)
        {
            this.db = db;
            OrgMember = OrganizationMember.Load(DbUtil.Db, pid, oid);
            if (!OrgMember.OnlineRegData.HasValue())
                return;
            Person = new OnlineRegPersonModel0();
            Person.ReadXml(OrgMember.OnlineRegData);
            Person.setting = DbUtil.Db.CreateRegistrationSettings(OrgMember.Organization.RegSettingXml, oid);

            Handlebars.RegisterHelper("Registrant", Registrant);
            Handlebars.RegisterHelper("IfShowTransaction", IfShowTransaction);
            Handlebars.RegisterHelper("IfSupportMissionTrip", IfSupportMissionTrip);
            Handlebars.RegisterHelper("AskItems", AskItems);

            Handlebars.RegisterHelper("IfAskAllergies", IfAskAllergies);
            Handlebars.RegisterHelper("IfAskCheckboxes", IfAskCheckboxes);
            Handlebars.RegisterHelper("IfAskCoaching", IfAskCoaching);
            Handlebars.RegisterHelper("IfAskChurch", IfAskChurch);
            Handlebars.RegisterHelper("IfAskDoctor", IfAskDoctor);
            Handlebars.RegisterHelper("IfAskDropdown", IfAskDropdown);
            Handlebars.RegisterHelper("IfAskEmContact", IfAskEmContact);
            Handlebars.RegisterHelper("IfAskExtraQuestions", IfAskExtraQuestions);
            Handlebars.RegisterHelper("IfAskGradeOptions", IfAskGradeOptions);
            Handlebars.RegisterHelper("IfAskHeader", IfAskHeader);
            Handlebars.RegisterHelper("IfAskInstruction", IfAskInstruction);
            Handlebars.RegisterHelper("IfAskInsurance", IfAskInsurance);
            Handlebars.RegisterHelper("IfAskMenu", IfAskMenu);
            Handlebars.RegisterHelper("IfAskParents", IfAskParents);
            Handlebars.RegisterHelper("IfAskRequest", IfAskRequest);
            Handlebars.RegisterHelper("IfAskSize", IfAskSize);
            Handlebars.RegisterHelper("IfAskSms", IfAskSms);
            Handlebars.RegisterHelper("IfAskTextQuestions", IfAskTextQuestions);
            Handlebars.RegisterHelper("IfAskTickets", IfAskTickets);
            Handlebars.RegisterHelper("IfAskTylenolEtc", IfAskTylenolEtc);
            Handlebars.RegisterHelper("IfAskYesNoQuestions", IfAskYesNoQuestions);

            Handlebars.RegisterHelper("IfHasAgeGroups", IfHasAgeGroups);
            Handlebars.RegisterHelper("MenuItems", MenuItems);
            Handlebars.RegisterHelper("Checkboxes", Checkboxes);

            Handlebars.RegisterHelper("TopLabel", (writer, context, args) => { writer.Write(TopLabel); });
            Handlebars.RegisterHelper("BottomStyle", (writer, context, args) => { writer.Write(RowStyle); });

            CssStyle.RegisterHelpers(db);
        }
Esempio n. 4
0
        public static OnlineRegPersonModel0 CreateFromSettings(CMSDataContext db, int orgid)
        {
            var m        = new OnlineRegPersonModel0(null, db);
            var settings = db.CreateRegistrationSettings(orgid);

            foreach (var ask in settings.AskItems)
            {
                switch (ask.Type)
                {
                case "AskExtraQuestions":
                    var eq = (AskExtraQuestions)ask;
                    if (eq.UniqueId >= m.ExtraQuestion.Count)
                    {
                        m.ExtraQuestion.Add(new Dictionary <string, string>());
                    }
                    foreach (var q in eq.list)
                    {
                        m.ExtraQuestion[eq.UniqueId][q.Question] = "";
                    }
                    break;

                case "AskText":
                    var tx = (AskText)ask;
                    if (tx.UniqueId >= m.Text.Count)
                    {
                        m.Text.Add(new Dictionary <string, string>());
                    }
                    foreach (var q in tx.list)
                    {
                        m.Text[tx.UniqueId][q.Question] = "";
                    }
                    break;
                }
            }
            return(m);
        }
Esempio n. 5
0
        public void UpdateQuestion(int n, string answer)
        {
            var q = DbUtil.Db.OrgMemberQuestions(OrgId, PeopleId).ToList();
            var rq = q.SingleOrDefault(vv => vv.Row == n);
            if (rq == null)
                throw new Exception("question not found");

            var question = rq.Question;

            var r = new OnlineRegPersonModel0(OrgMember.OnlineRegData);
            r.ExtraQuestion[rq.SetX ?? 0][question] = answer;
            OrgMember.OnlineRegData = r.WriteXml();
            DbUtil.Db.SubmitChanges();
        }