Ejemplo n.º 1
0
 private void ValidateAskCheckboxes(Ask ask)
 {
     var namecb = Parent.GetNameFor(mm => mm.List[Index].Checkbox[ask.UniqueId]);
     var cb = ((AskCheckboxes) ask);
     var cbcount = cb.CheckboxItemsChosen(Checkbox).Count();
     if (cb.Maximum > 0 && cbcount > cb.Maximum)
         modelState.AddModelError(namecb, $"Max of {cb.Maximum} exceeded");
     else if (cb.Minimum > 0 && (Checkbox == null || cbcount < cb.Minimum))
         modelState.AddModelError(namecb, $"Min of {cb.Minimum} required");
 }
Ejemplo n.º 2
0
 public IEnumerable<SelectListItemFilled> DropdownList(Ask ask)
 {
     var q = from s in ((AskDropdown)ask).list
             let amt = s.Fee.HasValue ? " ({0:C})".Fmt(s.Fee) : ""
             select new SelectListItemFilled
             {
                 Text = s.Description + amt,
                 Value = s.SmallGroup,
                 Filled = s.IsSmallGroupFilled(GroupTags)
             };
     var list = q.ToList();
     list.Insert(0, new SelectListItemFilled { Text = "(please select)", Value = "00" });
     return list;
 }
Ejemplo n.º 3
0
 public void OutputAsk(StringBuilder sb, Ask ask)
 {
     switch (ask.Type)
     {
         case "AskSuggestedFee":
             Output(sb, ask as AskSuggestedFee);
             break;
         case "AskCheckboxes":
             Output(sb, ask as AskCheckboxes);
             break;
         case "AskDropdown":
             Output(sb, ask as AskDropdown);
             break;
         case "AskExtraQuestions":
             Output(sb, ask as AskExtraQuestions);
             break;
         case "AskGradeOptions":
             Output(sb, ask as AskGradeOptions);
             break;
         case "AskHeader":
             Output(sb, ask as AskHeader);
             break;
         case "AskInstruction":
             Output(sb, ask as AskInstruction);
             break;
         case "AskMenu":
             Output(sb, ask as AskMenu);
             break;
         case "AskRequest":
             Output(sb, ask as AskRequest);
             break;
         case "AskSize":
             Output(sb, ask as AskSize);
             break;
         case "AskText":
             Output(sb, ask as AskText);
             break;
         case "AskTickets":
             Output(sb, ask as AskTickets);
             break;
         case "AskYesNoQuestions":
             Output(sb, ask as AskYesNoQuestions);
             break;
         default:
             AddValueCk(0, sb, ask.Type, true);
             break;
     }
 }
Ejemplo n.º 4
0
 public IEnumerable<SelectListItemFilled> DropdownList(Ask ask)
 {
     // this appears to only occur when a user saves progress, the organization has a dropdown question added, and then the user continues
     // we need to ensure that we have options set for all of the questions
     while (ask.UniqueId >= option.Count)
         option.Add(string.Empty);
     var q = from s in ((AskDropdown) ask).list
             let amt = s.Fee.HasValue ? $" ({s.Fee:C})" : ""
             select new SelectListItemFilled
             {
                 Text = s.Description + amt,
                 Value = s.SmallGroup,
                 Filled = s.IsSmallGroupFilled(GroupTags),
                 Selected = s.SmallGroup == option[ask.UniqueId]
             };
     var list = q.ToList();
     list.Insert(0, new SelectListItemFilled {Text = "(please select)", Value = "00"});
     return list;
 }
Ejemplo n.º 5
0
 private void SummarizeCheckboxChoices(StringBuilder sb, Ask ask)
 {
     var askcb = (AskCheckboxes) ask;
     var menulabel = askcb.Label;
     foreach (var i in askcb.CheckboxItemsChosen(Checkbox))
     {
         string row;
         if (menulabel.HasValue())
             sb.Append($"<tr><td colspan='2'><br>{menulabel}</td></tr>\n");
         if (i.Fee > 0)
             row = $"<tr><td></td><td>{i.Description} (${i.Fee:N2})<br>({i.SmallGroup})</td></tr>\n";
         else
             row = $"<tr><td></td><td>{i.Description}<br>({i.SmallGroup})</td></tr>\n";
         sb.Append(row);
         menulabel = string.Empty;
     }
 }
Ejemplo n.º 6
0
 public static Ask ParseAsk(Parser parser)
 {
     var r = new Ask(parser.curr.kw.ToString());
     parser.GetBool();
     return r;
 }
Ejemplo n.º 7
0
 public AskItem(Ask ask, OrganizationMember om)
 {
     this.ask = ask;
     this.om = om;
 }
Ejemplo n.º 8
0
        private void PopulateExtraAnswers(OrganizationMember om, Ask ask)
        {
            FetchQuestionsAnswersList(om);

            if (ExtraQuestion == null)
                ExtraQuestion = new List<Dictionary<string, string>>();
            var eq = new Dictionary<string, string>();
            ExtraQuestion.Add(eq);

            foreach (var q in ((AskExtraQuestions)ask).list)
            {
                if (setting.TargetExtraValues)
                {
                    var v = person.GetExtra(q.Question);
                    if (v.HasValue())
                        eq[q.Question] = v;
                }
                else if (qlist != null)
                {
                    var v = qlist.SingleOrDefault(qq => qq.Question == q.Question && qq.Type == "question");
                    if (v != null)
                        eq[q.Question] = v.Answer;
                }
            }
        }
Ejemplo n.º 9
0
 private void SaveCheckboxChoices(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues)
     {
         foreach (var ck in ((AskCheckboxes) ask).list)
             person.RemoveExtraValue(DbUtil.Db, ck.SmallGroup);
         foreach (var g in ((AskCheckboxes) ask).CheckboxItemsChosen(Checkbox))
             person.AddEditExtraBool(g.SmallGroup, true);
     }
     else
     {
         foreach (var ck in ((AskCheckboxes) ask).list)
             ck.RemoveFromSmallGroup(DbUtil.Db, om);
         foreach (var i in ((AskCheckboxes) ask).CheckboxItemsChosen(Checkbox))
             i.AddToSmallGroup(DbUtil.Db, om, PythonModel);
     }
 }
Ejemplo n.º 10
0
 private void PopulateDropdownChoices(OrganizationMember om, Ask ask)
 {
     if (option == null)
         option = new List<string>();
     if (setting.TargetExtraValues)
     {
         foreach (var dd in ((AskDropdown)ask).list)
             if (person.GetExtra(dd.SmallGroup) == "true")
                 option.Add(dd.SmallGroup);
     }
     else
         foreach (var dd in ((AskDropdown)ask).list)
             if (om.IsInGroup(dd.SmallGroup))
                 option.Add(dd.SmallGroup);
 }
Ejemplo n.º 11
0
 private void SummarizeMenuChoices(StringBuilder sb, Ask ask)
 {
     var menulabel = ((AskMenu) ask).Label;
     foreach (var i in ((AskMenu) ask).MenuItemsChosen(MenuItem[ask.UniqueId]))
     {
         string row;
         if (i.amt > 0)
             row = $"<tr><td>{menulabel}</td><td>{i.number} {i.desc} (at {i.amt:N2})</td></tr>\n";
         else
             row = $"<tr><td>{menulabel}</td><td>{i.number} {i.desc}</td></tr>\n";
         sb.Append(row);
         menulabel = string.Empty;
     }
 }
Ejemplo n.º 12
0
 private void SummarieTextAnswers(StringBuilder sb, Ask ask)
 {
     foreach (var a in Text[ask.UniqueId])
         if (a.Value.HasValue())
             sb.Append($"<tr><td>{a.Key}:</td><td>{a.Value}</td></tr>\n");
 }
Ejemplo n.º 13
0
 private void PopulateCheckboxChoices(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues)
     {
         foreach (var ck in ((AskCheckboxes)ask).list)
             if (person.GetExtra(ck.SmallGroup).ToBool())
                 Checkbox.Add(ck.SmallGroup);
     }
     else
         foreach (var ck in ((AskCheckboxes)ask).list)
             if (om.IsInGroup(ck.SmallGroup))
                 Checkbox.Add(ck.SmallGroup);
 }
Ejemplo n.º 14
0
 private void ValidateAskYesNoQuestions(Ask ask)
 {
     for (var n = 0; n < ((AskYesNoQuestions) ask).list.Count; n++)
     {
         var a = ((AskYesNoQuestions) ask).list[n];
         if (YesNoQuestion == null || !YesNoQuestion.ContainsKey(a.SmallGroup))
             modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].YesNoQuestion[a.SmallGroup]),
                 "please select yes or no");
     }
 }
Ejemplo n.º 15
0
 private void ValidateAskText(Ask ask)
 {
     var tx = (AskText) ask;
     if (setting.AskVisible("AnswersNotRequired") == false)
         for (var n = 0; n < tx.list.Count; n++)
         {
             var a = tx.list[n];
             if (Text == null || !Text[tx.UniqueId].ContainsKey(a.Question) ||
                 !Text[tx.UniqueId][a.Question].HasValue())
                 modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].Text[tx.UniqueId][a.Question]),
                     "please give some answer");
         }
 }
Ejemplo n.º 16
0
 private void ValidateAskExtraQuestions(Ask ask)
 {
     var eq = (AskExtraQuestions) ask;
     if (setting.AskVisible("AnswersNotRequired") == false)
         for (var n = 0; n < eq.list.Count; n++)
         {
             var a = eq.list[n];
             if (ExtraQuestion == null || !ExtraQuestion[eq.UniqueId].ContainsKey(a.Question) ||
                 !ExtraQuestion[eq.UniqueId][a.Question].HasValue())
                 modelState.AddModelError(Parent.GetNameFor(mm => mm.List[Index].ExtraQuestion[eq.UniqueId][a.Question]),
                     "please give some answer");
         }
 }
Ejemplo n.º 17
0
 private void ValidateAskDropdown(Ask ask)
 {
     string desc;
     var namedd = Parent.GetNameFor(mm => mm.List[Index].option[ask.UniqueId]);
     var sgi = ((AskDropdown) ask).SmallGroupChoice(option);
     if (sgi == null || !sgi.SmallGroup.HasValue())
         modelState.AddModelError(namedd, "please select an option");
     else if (((AskDropdown) ask).IsSmallGroupFilled(GroupTags, option, out desc))
         modelState.AddModelError(namedd, "limit reached for " + desc);
 }
Ejemplo n.º 18
0
        private AskSize asksize;         // To support old Registration Documents

        void ParseSection(Parser parser)
        {
            switch (parser.curr.kw)
            {
            case Parser.RegKeywords.AskParents:
            case Parser.RegKeywords.AnswersNotRequired:
            case Parser.RegKeywords.AskSMS:
            case Parser.RegKeywords.AskDoctor:
            case Parser.RegKeywords.AskInsurance:
            case Parser.RegKeywords.AskEmContact:
            case Parser.RegKeywords.AskAllergies:
            case Parser.RegKeywords.AskChurch:
            case Parser.RegKeywords.AskTylenolEtc:
            case Parser.RegKeywords.AskCoaching:
                AskItems.Add(Ask.ParseAsk(parser));
                break;

            case Parser.RegKeywords.SpecialScript:
                SpecialScript = parser.GetString();
                break;

            case Parser.RegKeywords.AskSuggestedFee:
                AskItems.Add(AskSuggestedFee.Parse(parser));
                break;

            case Parser.RegKeywords.AskTickets:
                AskItems.Add(AskTickets.Parse(parser));
                break;

            case Parser.RegKeywords.AskRequest:
                AskItems.Add(AskRequest.Parse(parser));
                break;

            case Parser.RegKeywords.AskHeader:
                AskItems.Add(AskHeader.Parse(parser));
                break;

            case Parser.RegKeywords.AskInstruction:
                AskItems.Add(AskInstruction.Parse(parser));
                break;

            case Parser.RegKeywords.Dropdown:
            case Parser.RegKeywords.AskOptions:
            case Parser.RegKeywords.ExtraOptions:
            case Parser.RegKeywords.Dropdown1:
            case Parser.RegKeywords.Dropdown2:
            case Parser.RegKeywords.Dropdown3:
                AskItems.Add(AskDropdown.Parse(parser));
                break;

            case Parser.RegKeywords.MenuItems:
                AskItems.Add(AskMenu.Parse(parser));
                break;

            case Parser.RegKeywords.ExtraQuestions:
                AskItems.Add(AskExtraQuestions.Parse(parser));
                break;

            case Parser.RegKeywords.Text:
                AskItems.Add(AskText.Parse(parser));
                break;

            case Parser.RegKeywords.Checkboxes:
            case Parser.RegKeywords.Checkboxes2:
                AskItems.Add(AskCheckboxes.Parse(parser));
                break;

            case Parser.RegKeywords.YesNoQuestions:
                AskItems.Add(AskYesNoQuestions.Parse(parser));
                break;

            case Parser.RegKeywords.AskGradeOptions:
            case Parser.RegKeywords.GradeOptions:
                AskItems.Add(AskGradeOptions.Parse(parser));
                break;

            case Parser.RegKeywords.AskSize:
                AskItems.Add(AskSize.Parse(parser));
                break;

            case Parser.RegKeywords.MemberOnly:
                MemberOnly = parser.GetBool();
                break;

            case Parser.RegKeywords.AskMedical:
                parser.GetBool();
                break;

            case Parser.RegKeywords.AskDonation:
                AskDonation = parser.GetBool();
                break;

            case Parser.RegKeywords.NoReqBirthYear:
                NoReqBirthYear = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqDOB:
                NotReqDOB = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqAddr:
                NotReqAddr = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqPhone:
                NotReqPhone = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqGender:
                NotReqGender = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqMarital:
                NotReqMarital = parser.GetBool();
                break;

            case Parser.RegKeywords.NotReqZip:
                NotReqZip = parser.GetBool();
                break;

            case Parser.RegKeywords.DonationFundId:
                DonationFundId = parser.GetNullInt();
                break;

            case Parser.RegKeywords.AccountingCode:
                AccountingCode = parser.GetString();
                break;

            case Parser.RegKeywords.DonationLabel:
                DonationLabel = parser.GetString();
                break;

            case Parser.RegKeywords.ExtraValueFeeName:
                ExtraValueFeeName = parser.GetString();
                break;

            case Parser.RegKeywords.GroupToJoin:
                GroupToJoin = parser.GetString();
                break;

            case Parser.RegKeywords.AddAsProspect:
                AddAsProspect = parser.GetBool();
                break;

            case Parser.RegKeywords.LinkGroupsFromOrgs:
                LinkGroupsFromOrgs = (from i in parser.curr.value.Split(',')
                                      where i.ToInt() > 0
                                      select i.ToInt()).ToList();
                parser.lineno++;
                break;

            case Parser.RegKeywords.ValidateOrgs:
                ValidateOrgs = parser.curr.value;
                parser.lineno++;
                break;

            case Parser.RegKeywords.Terms:
                ParseTerms(parser);
                break;

            case Parser.RegKeywords.Instructions:
                ParseInstructions(parser);
                break;

            case Parser.RegKeywords.Confirmation:
                ParseConfirmation(parser);
                break;

            case Parser.RegKeywords.ConfirmationTrackingCode:
                ParseTrackingCode(parser);
                break;

            case Parser.RegKeywords.Reminder:
                ParseReminder(parser);
                break;

            case Parser.RegKeywords.SupportEmail:
                ParseSupport(parser);
                break;

            case Parser.RegKeywords.SenderEmail:
                ParseSender(parser);
                break;

            case Parser.RegKeywords.AgeGroups:
                ParseAgeGroups(parser);
                break;

            case Parser.RegKeywords.OrgMemberFees:
            case Parser.RegKeywords.OrgFees:
                OrgFees = OrgFees.Parse(parser);
                break;

            case Parser.RegKeywords.VoteTags:
                ParseVoteTags(parser);
                break;

            case Parser.RegKeywords.Title:
                Title = parser.GetString();
                break;

            case Parser.RegKeywords.Shell:
                Shell = parser.GetString();
                break;

            case Parser.RegKeywords.ShellBs:
                ShellBs = parser.GetString();
                break;

            case Parser.RegKeywords.Fee:
                Fee = parser.GetDecimal();
                break;


// BEGIN support for old Registration Documents
            case Parser.RegKeywords.GiveOrgMembAccess:
                parser.GetBool();
                break;

            case Parser.RegKeywords.UseBootstrap:
                parser.GetBool();
                break;

            case Parser.RegKeywords.AskGrade:
                parser.GetBool();
                parser.GetLabel("Grade");
                break;

            case Parser.RegKeywords.AskShirtSize:
                parser.GetBool();
                asksize = new AskSize();
                AskItems.Add(asksize);
                break;

            case Parser.RegKeywords.ShirtSizes:
                asksize.list = AskSize.ParseShirtSizes(parser);
                break;

            case Parser.RegKeywords.AllowLastYearShirt:
                asksize.AllowLastYear = parser.GetBool();
                break;

            case Parser.RegKeywords.ShirtFee:
                if (asksize == null)
                {
                    asksize = new AskSize();
                    AskItems.Add(asksize);
                }
                asksize.Fee = parser.GetDecimal();
                break;
// END support for old Registration Documents

            case Parser.RegKeywords.Deposit:
                Deposit = parser.GetDecimal();
                break;

            case Parser.RegKeywords.ExtraFee:
                ExtraFee = parser.GetDecimal();
                break;

            case Parser.RegKeywords.MaximumFee:
                MaximumFee = parser.GetDecimal();
                break;

            case Parser.RegKeywords.AllowOnlyOne:
                AllowOnlyOne = parser.GetBool();
                break;

            case Parser.RegKeywords.OtherFeesAdded:
            case Parser.RegKeywords.OtherFeesAddedToOrgFee:
                OtherFeesAddedToOrgFee = parser.GetBool();
                break;

            case Parser.RegKeywords.IncludeOtherFeesWithDeposit:
                IncludeOtherFeesWithDeposit = parser.GetBool();
                break;

            case Parser.RegKeywords.ApplyMaxToOtherFees:
                ApplyMaxToOtherFees = parser.GetBool();
                break;

            case Parser.RegKeywords.AllowReRegister:
                AllowReRegister = parser.GetBool();
                break;

            case Parser.RegKeywords.AllowSaveProgress:
                AllowSaveProgress = parser.GetBool();
                break;

            case Parser.RegKeywords.TargetExtraValues:
                TargetExtraValues = parser.GetBool();
                break;

            case Parser.RegKeywords.TimeSlotLockDays:
                TimeSlotLockDays = parser.GetNullInt();
                break;

            case Parser.RegKeywords.TimeSlots:
                TimeSlots = TimeSlots.Parse(parser);
                if (TimeSlotLockDays.HasValue)
                {
                    TimeSlots.TimeSlotLockDays = TimeSlotLockDays;
                }
                break;
            }
        }
Ejemplo n.º 19
0
 private void SummarizeDropdownChoice(StringBuilder sb, Ask ask)
 {
     sb.AppendFormat("<tr><td>{1}:</td><td>{0}</td></tr>\n",
         ((AskDropdown) ask).SmallGroupChoice(option).Description,
         Util.PickFirst(((AskDropdown) ask).Label, "Options"));
 }
Ejemplo n.º 20
0
 private void SummarizeGradeOption(StringBuilder sb, Ask ask)
 {
     sb.AppendFormat("<tr><td>GradeOption:</td><td>{0}</td></tr>\n",
         GradeOptions(ask).SingleOrDefault(s => s.Value == (gradeoption ?? "00")).Text);
 }
Ejemplo n.º 21
0
 private void SaveDropdownChoice(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues)
     {
         foreach (var op in ((AskDropdown) ask).list)
             person.RemoveExtraValue(DbUtil.Db, op.SmallGroup);
         person.AddEditExtraValue(((AskDropdown) ask).SmallGroupChoice(option).SmallGroup, "true");
     }
     else
     {
         foreach (var op in ((AskDropdown) ask).list)
             op.RemoveFromSmallGroup(DbUtil.Db, om);
         ((AskDropdown) ask).SmallGroupChoice(option).AddToSmallGroup(DbUtil.Db, om, PythonModel);
     }
 }
Ejemplo n.º 22
0
 private void SummarizeYesNoChoices(StringBuilder sb, Ask ask)
 {
     foreach (var a in ((AskYesNoQuestions) ask).list)
         if (YesNoQuestion.ContainsKey(a.SmallGroup))
             sb.Append($"<tr><td>{a.Question}:</td><td>{(YesNoQuestion[a.SmallGroup] == true ? "Yes" : "No")}</td></tr>\n");
 }
Ejemplo n.º 23
0
 private void PopulateYesNoChoices(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues == false)
         foreach (var yn in ((AskYesNoQuestions)ask).list)
         {
             {
                 if (om.IsInGroup("Yes:" + yn.SmallGroup))
                     YesNoQuestion[yn.SmallGroup] = true;
                 if (om.IsInGroup("No:" + yn.SmallGroup))
                     YesNoQuestion[yn.SmallGroup] = false;
             }
         }
     else
         foreach (var yn in ((AskYesNoQuestions)ask).list)
         {
             if (person.GetExtra(yn.SmallGroup) == "Yes")
                 YesNoQuestion[yn.SmallGroup] = true;
             if (person.GetExtra(yn.SmallGroup) == "No")
                 YesNoQuestion[yn.SmallGroup] = false;
         }
 }
Ejemplo n.º 24
0
 public IEnumerable<SelectListItem> GradeOptions(Ask ask)
 {
     var q = from s in ((AskGradeOptions) ask).list
             select new SelectListItem {Text = s.Description, Value = s.Code.ToString()};
     var list = q.ToList();
     list.Insert(0, new SelectListItem {Text = "(please select)", Value = "00"});
     return list;
 }
Ejemplo n.º 25
0
 public Ask ParseAsk()
 {
     var r = new Ask(curr.kw.ToString());
     GetBool();
     return r;
 }
Ejemplo n.º 26
0
 private void AskItems(TextWriter writer, HelperOptions options, dynamic context, params object[] args)
 {
     if (SupportMissionTrip)
         return;
     var list = Person.setting.AskItems;
     if (!list.Any())
         return;
     foreach (var item in list)
     {
         currentAsk = item;
         options.Template(writer, item);
     }
 }
Ejemplo n.º 27
0
 public Dictionary<string, string> GradeOptions(Ask ask)
 {
     var d = ((AskGradeOptions)ask).list.ToDictionary(k => k.Code.ToString(), v => v.Description);
     d.Add("00", "(please select)");
     return d;
 }
Ejemplo n.º 28
0
 private void SaveMenuChoices(OrganizationMember om, Ask ask)
 {
     foreach (var i in MenuItem[ask.UniqueId])
         om.AddToGroup(DbUtil.Db, i.Key, i.Value);
     {
         var menulabel = ((AskMenu) ask).Label;
         foreach (var i in ((AskMenu) ask).MenuItemsChosen(MenuItem[ask.UniqueId]))
         {
             om.AddToMemberDataBelowComments(menulabel);
             var desc = i.amt > 0 
                 ? $"{i.number} {i.desc} (at {i.amt:N2})" 
                 : $"{i.number} {i.desc}";
             om.AddToMemberDataBelowComments(desc);
             menulabel = string.Empty;
         }
     }
 }
Ejemplo n.º 29
0
        public void ReadXml(XmlReader reader)
        {
            var xd = XDocument.Load(reader);

            if (xd.Root == null)
            {
                return;
            }

            foreach (var e in xd.Root.Elements())
            {
                var name = e.Name.ToString();
                switch (name)
                {
                case "Confirmation":
                    Subject = e.Element("Subject")?.Value;
                    Body    = e.Element("Body")?.Value;
                    break;

                case "Reminder":
                    ReminderSubject = e.Element("Subject")?.Value;
                    ReminderBody    = e.Element("Body")?.Value;
                    break;

                case "SupportEmail":
                    SupportSubject = e.Element("Subject")?.Value;
                    SupportBody    = e.Element("Body")?.Value;
                    break;

                case "SenderEmail":
                    SenderSubject = e.Element("Subject")?.Value;
                    SenderBody    = e.Element("Body")?.Value;
                    break;

                case "Instructions":
                    InstructionLogin   = e.Element("Login")?.Value;
                    InstructionSelect  = e.Element("Select")?.Value;
                    InstructionFind    = e.Element("Find")?.Value;
                    InstructionOptions = e.Element("Options")?.Value;
                    InstructionSpecial = e.Element("Special")?.Value;
                    InstructionSubmit  = e.Element("Submit")?.Value;
                    InstructionSorry   = e.Element("Sorry")?.Value;
                    ThankYouMessage    = e.Element("Thanks")?.Value;
                    Terms = e.Element("Terms")?.Value;
                    break;

                case "Fees":
                    Fee                         = e.Element("Fee")?.Value.ToDecimal();
                    Deposit                     = e.Element("Deposit")?.Value.ToDecimal();
                    ExtraFee                    = e.Element("ExtraFee")?.Value.ToDecimal();
                    MaximumFee                  = e.Element("MaximumFee")?.Value.ToDecimal();
                    ApplyMaxToOtherFees         = e.Element("ApplyMaxToOtherFees")?.Value.ToBool2() ?? false;
                    ExtraValueFeeName           = e.Element("ExtraValueFeeName")?.Value;
                    AccountingCode              = e.Element("AccountingCode")?.Value;
                    IncludeOtherFeesWithDeposit = e.Element("IncludeOtherFeesWithDeposit")?.Value.ToBool2() ?? false;
                    OtherFeesAddedToOrgFee      = e.Element("OtherFeesAddedToOrgFee")?.Value.ToBool2() ?? false;
                    AskDonation                 = e.Element("AskDonation")?.Value.ToBool2() ?? false;
                    DonationLabel               = e.Element("DonationLabel")?.Value;
                    DonationFundId              = e.Element("DonationFundId")?.Value.ToInt2();
                    break;

                case "AgeGroups":
                    if (AgeGroups == null)
                    {
                        AgeGroups = new List <AgeGroup>();
                    }
                    foreach (var ee in e.Elements("Group"))
                    {
                        AgeGroups.Add(new AgeGroup
                        {
                            StartAge   = ee.Attribute("StartAge")?.Value.ToInt2() ?? 0,
                            EndAge     = ee.Attribute("EndAge")?.Value.ToInt2() ?? 0,
                            Fee        = ee.Attribute("Fee")?.Value.ToDecimal(),
                            SmallGroup = ee.Value
                        });
                    }
                    break;

                case "OrgFees":
                    if (OrgFees == null)
                    {
                        OrgFees = new List <OrgFee>();
                    }
                    foreach (var ee in e.Elements("Fee"))
                    {
                        OrgFees.Add(new OrgFee
                        {
                            OrgId = ee.Attribute("OrgId")?.Value.ToInt(),
                            Fee   = ee.Attribute("Fee")?.Value.ToDecimal()
                        });
                    }
                    break;

                case "Options":
                    ConfirmationTrackingCode = e.Element("ConfirmationTrackingCode")?.Value;
                    ValidateOrgs             = e.Element("ValidateOrgs")?.Value;
                    Shell   = e.Element("Shell")?.Value;
                    ShellBs = e.Element("ShellBs")?.Value;
                    FinishRegistrationButton = e.Element("FinishRegistrationButton")?.Value;
                    SpecialScript            = e.Element("SpecialScript")?.Value;
                    GroupToJoin       = e.Element("GroupToJoin")?.Value;
                    TimeOut           = e.Element("TimeOut")?.Value.ToInt2();
                    AllowOnlyOne      = e.Element("AllowOnlyOne")?.Value.ToBool2() ?? false;
                    TargetExtraValues = e.Element("TargetExtraValues")?.Value.ToBool2() ?? false;
                    AllowReRegister   = e.Element("AllowReRegister")?.Value.ToBool2() ?? false;
                    AllowSaveProgress = e.Element("AllowSaveProgress")?.Value.ToBool2() ?? false;
                    MemberOnly        = e.Element("MemberOnly")?.Value.ToBool2() ?? false;
                    AddAsProspect     = e.Element("AddAsProspect")?.Value.ToBool2() ?? false;
                    DisallowAnonymous = e.Element("DisallowAnonymous")?.Value.ToBool2() ?? false;
                    break;

                case "NotRequired":
                    NoReqBirthYear = e.Element("NoReqBirthYear")?.Value.ToBool2() ?? false;
                    NotReqDOB      = e.Element("NotReqDOB")?.Value.ToBool2() ?? false;
                    NotReqAddr     = e.Element("NotReqAddr")?.Value.ToBool2() ?? false;
                    NotReqZip      = e.Element("NotReqZip")?.Value.ToBool2() ?? false;
                    NotReqPhone    = e.Element("NotReqPhone")?.Value.ToBool2() ?? false;
                    NotReqGender   = e.Element("NotReqGender")?.Value.ToBool2() ?? false;
                    NotReqMarital  = e.Element("NotReqMarital")?.Value.ToBool2() ?? false;
                    NotReqCampus   = e.Element("NotReqCampus")?.Value.ToBool2() ?? false;
                    break;

                case "TimeSlots":
                    TimeSlots = TimeSlots.ReadXml(e);
                    if (TimeSlots.TimeSlotLockDays.HasValue)
                    {
                        TimeSlotLockDays = TimeSlots.TimeSlotLockDays;
                    }
                    break;

                case "AskItems":
                    foreach (var ele in e.Elements())
                    {
                        AskItems.Add(Ask.ReadXml(ele));
                    }
                    break;
                }
            }
            SetUniqueIds("AskDropdown");
            SetUniqueIds("AskExtraQuestions");
            SetUniqueIds("AskCheckboxes");
            SetUniqueIds("AskText");
            SetUniqueIds("AskMenu");
        }
Ejemplo n.º 30
0
 private void SaveYesNoChoices(OrganizationMember om, Ask ask)
 {
     if (setting.TargetExtraValues == false)
     {
         foreach (var yn in ((AskYesNoQuestions) ask).list)
         {
             om.RemoveFromGroup(DbUtil.Db, "Yes:" + yn.SmallGroup);
             om.RemoveFromGroup(DbUtil.Db, "No:" + yn.SmallGroup);
         }
         foreach (var g in YesNoQuestion)
             om.AddToGroup(DbUtil.Db, (g.Value == true ? "Yes:" : "No:") + g.Key);
     }
     else
         foreach (var g in YesNoQuestion)
             person.AddEditExtraValue(g.Key, g.Value == true ? "Yes" : "No");
 }
Ejemplo n.º 31
0
        private void PopulateTextAnswers(OrganizationMember om, Ask ask)
        {
            FetchQuestionsAnswersList(om);

            if (Text == null)
                Text = new List<Dictionary<string, string>>();
            var tx = new Dictionary<string, string>();
            Text.Add(tx);
            foreach (var q in ((AskText)ask).list)
            {
                if (setting.TargetExtraValues)
                {
                    var v = person.GetExtra(q.Question);
                    if (v.HasValue())
                        tx[q.Question] = v;
                }
                else if (qlist != null)
                {
                    var v = qlist.SingleOrDefault(qq => qq.Question == q.Question && qq.Type == "text");
                    if (v != null)
                        tx[q.Question] = v.Answer;
                }
            }
        }