コード例 #1
0
ファイル: AskCheckboxes.cs プロジェクト: rossspoon/bvcms
 public static AskCheckboxes Parse(Parser parser)
 {
     var cb = new AskCheckboxes();
     cb.Label = parser.GetString("CheckBoxes");
     cb.Min = parser.GetInt(Parser.RegKeywords.Minimum);
     cb.Max = parser.GetInt(Parser.RegKeywords.Maximum);
     cb.Cols = parser.GetInt(Parser.RegKeywords.Columns) ?? 1;
     cb.list = new List<CheckboxItem>();
     if (parser.curr.indent == 0)
         return cb;
     var startindent = parser.curr.indent;
     while (parser.curr.indent == startindent)
     {
         var m = CheckboxItem.Parse(parser, startindent);
         cb.list.Add(m);
     }
     var q = (from i in cb.list
              where i.SmallGroup != "nocheckbox"
              where i.SmallGroup != "comment"
              group i by i.SmallGroup into g
              where g.Count() > 1
              select g.Key).ToList();
     if (q.Any())
         throw parser.GetException("Duplicate SmallGroup in Checkboxes: {0}".Fmt(string.Join(",", q)));
     return cb;
 }
コード例 #2
0
        public static AskCheckboxes Parse(Parser parser)
        {
            var cb = new AskCheckboxes();

            cb.Label = parser.GetString("CheckBoxes");
            cb.Min   = parser.GetInt(Parser.RegKeywords.Minimum);
            cb.Max   = parser.GetInt(Parser.RegKeywords.Maximum);
            cb.Cols  = parser.GetInt(Parser.RegKeywords.Columns) ?? 1;
            cb.list  = new List <CheckboxItem>();
            if (parser.curr.indent == 0)
            {
                return(cb);
            }
            var startindent = parser.curr.indent;

            while (parser.curr.indent == startindent)
            {
                var m = CheckboxItem.Parse(parser, startindent);
                cb.list.Add(m);
            }
            var q = (from i in cb.list
                     where i.SmallGroup != "nocheckbox"
                     where i.SmallGroup != "comment"
                     group i by i.SmallGroup into g
                     where g.Count() > 1
                     select g.Key).ToList();

            if (q.Any())
            {
                throw parser.GetException("Duplicate SmallGroup in Checkboxes: {0}".Fmt(string.Join(",", q)));
            }
            return(cb);
        }
コード例 #3
0
ファイル: AskCheckboxes.cs プロジェクト: stevesloka/bvcms
 public AskCheckboxes ParseAskCheckboxes()
 {
     var cb = new AskCheckboxes();
     cb.Label = GetString("CheckBoxes");
     cb.Minimum = GetInt(RegKeywords.Minimum);
     cb.Maximum = GetInt(RegKeywords.Maximum);
     cb.Columns = GetInt(RegKeywords.Columns) ?? 1;
     cb.list = new List<AskCheckboxes.CheckboxItem>();
     if (curr.indent == 0)
         return cb;
     var startindent = curr.indent;
     while (curr.indent == startindent)
     {
         var i = new AskCheckboxes.CheckboxItem();
         if (curr.kw != Parser.RegKeywords.None)
             throw GetException("unexpected line in CheckBoxes");
         i.Description = GetLine();
         i.SmallGroup = i.Description;
         if (curr.indent <= startindent)
         {
             cb.list.Add(i);
             continue;
         }
         var ind = curr.indent;
         while (curr.indent == ind)
         {
             switch (curr.kw)
             {
                 case Parser.RegKeywords.SmallGroup:
                     i.SmallGroup = GetString(i.Description);
                     break;
                 case Parser.RegKeywords.Fee:
                     i.Fee = GetDecimal();
                     break;
                 case Parser.RegKeywords.Limit:
                     i.Limit = GetNullInt();
                     break;
                 case Parser.RegKeywords.Time:
                     i.MeetingTime = GetDateTime();
                     break;
                 default:
                     throw GetException("unexpected line in CheckboxItem");
             }
         }
         cb.list.Add(i);
     }
     var q = (from i in cb.list
              where i.SmallGroup != "nocheckbox"
              where i.SmallGroup != "comment"
              group i by i.SmallGroup into g
              where g.Count() > 1
              select g.Key).ToList();
     if (q.Any())
         throw GetException($"Duplicate SmallGroup in Checkboxes: {string.Join(",", q)}");
     return cb;
 }
コード例 #4
0
ファイル: Ask.cs プロジェクト: rastographics/bvcms
        public static Ask ReadXml(XElement ele)
        {
            var ask = ele.Name.ToString();

            switch (ask)
            {
            case "AskCheckboxes":
                return(AskCheckboxes.ReadXml(ele));

            case "AskDropdown":
                return(AskDropdown.ReadXml(ele));

            case "AskExtraQuestions":
                return(AskExtraQuestions.ReadXml(ele));

            case "AskGradeOptions":
                return(AskGradeOptions.ReadXml(ele));

            case "AskHeader":
                return(AskHeader.ReadXml(ele));

            case "AskInstruction":
                return(AskInstruction.ReadXml(ele));

            case "AskMenu":
                return(AskMenu.ReadXml(ele));

            case "AskRequest":
                return(AskRequest.ReadXml(ele));

            case "AskSize":
                return(AskSize.ReadXml(ele));

            case "AskSuggestedFee":
                return(AskSuggestedFee.ReadXml(ele));

            case "AskText":
                return(AskText.ReadXml(ele));

            case "AskTickets":
                return(AskTickets.ReadXml(ele));

            case "AskYesNoQuestions":
                return(AskYesNoQuestions.ReadXml(ele));

            case "AskDocuments":
                return(AskDocuments.ReadXml(ele));

            default:
                return(new Ask(ask));
            }
        }
コード例 #5
0
ファイル: AskCheckboxes.cs プロジェクト: vanutama/bvcms
 public static new AskCheckboxes ReadXml(XElement ele)
 {
     var cb = new AskCheckboxes
     {
         Minimum = ele.Attribute("Minimum")?.Value.ToInt2(),
         Maximum = ele.Attribute("Maximum")?.Value.ToInt2(),
         Columns = ele.Attribute("Columns")?.Value.ToInt2(),
         Label = ele.Element("Label")?.Value,
     };
     foreach (var ee in ele.Elements("CheckboxItem"))
         cb.list.Add(CheckboxItem.ReadXml(ee));
     return cb;
 }
コード例 #6
0
        public new static AskCheckboxes ReadXml(XElement ele)
        {
            var cb = new AskCheckboxes
            {
                Minimum = ele.Attribute("Minimum")?.Value.ToInt2(),
                Maximum = ele.Attribute("Maximum")?.Value.ToInt2(),
                Columns = ele.Attribute("Columns")?.Value.ToInt2(),
                Label   = ele.Element("Label")?.Value,
            };

            foreach (var ee in ele.Elements("CheckboxItem"))
            {
                cb.list.Add(CheckboxItem.ReadXml(ee));
            }
            return(cb);
        }
コード例 #7
0
ファイル: AskCheckboxes.cs プロジェクト: stevesloka/bvcms
 public void Output(StringBuilder sb, AskCheckboxes ask)
 {
     if (ask.list.Count == 0)
         return;
     AddValueNoCk(0, sb, "Checkboxes", ask.Label);
     AddValueCk(1, sb, "Minimum", ask.Minimum);
     AddValueCk(1, sb, "Maximum", ask.Maximum);
     AddValueCk(1, sb, "Columns", ask.Columns);
     foreach (var i in ask.list)
     {
         AddValueCk(1, sb, i.Description);
         AddValueCk(2, sb, "SmallGroup", i.SmallGroup);
         AddValueCk(2, sb, "Fee", i.Fee);
         AddValueCk(2, sb, "Limit", i.Limit);
         AddValueCk(2, sb, "Time", i.MeetingTime.ToString2("s"));
     }
     sb.AppendLine();
 }
コード例 #8
0
        public new static AskCheckboxes ReadXml(XElement ele)
        {
            var cb = new AskCheckboxes
            {
                TargetExtraValue = ele.Attribute("TargetExtraValue").ToBool(),
                Minimum          = ele.Attribute("Minimum").ToInt2(),
                Maximum          = ele.Attribute("Maximum").ToInt2(),
                Columns          = ele.Attribute("Columns").ToInt2(),
                Label            = ele.Element("Label")?.Value,
            };

            foreach (var ee in ele.Elements("CheckboxItem"))
            {
                if (ee.Element("Description")?.Value != null)
                {
                    cb.list.Add(CheckboxItem.ReadXml(ee));
                }
            }
            return(cb);
        }
コード例 #9
0
ファイル: Settings.cs プロジェクト: sengithub/SenSourcecode
        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;
            }
        }