Esempio n. 1
0
 private void WriteText(APIWriter w)
 {
     if (Text != null)
     {
         for (var i = 0; i < Text.Count; i++)
         {
             if (Text[i] != null && Text[i].Count > 0)
             {
                 foreach (var q in Text[i])
                 {
                     w.Start("Text");
                     w.Attr("set", i);
                     w.Attr("question", q.Key);
                     w.AddText(q.Value);
                     w.End();
                 }
             }
         }
     }
 }
Esempio n. 2
0
 private void WriteExtraAnswers(APIWriter w)
 {
     if (ExtraQuestion != null)
     {
         for (var i = 0; i < ExtraQuestion.Count; i++)
         {
             if (ExtraQuestion[i] != null && ExtraQuestion[i].Count > 0)
             {
                 foreach (var q in ExtraQuestion[i])
                 {
                     w.Start("ExtraQuestion");
                     w.Attr("set", i);
                     w.Attr("question", q.Key);
                     w.AddText(q.Value);
                     w.End();
                 }
             }
         }
     }
 }
Esempio n. 3
0
 private void WriteMenuChoices(APIWriter w)
 {
     if (MenuItem != null)
     {
         for (var i = 0; i < MenuItem.Count; i++)
         {
             if (MenuItem[i] != null && MenuItem[i].Count > 0)
             {
                 foreach (var q in MenuItem[i])
                 {
                     w.Start("MenuItem");
                     w.Attr("set", i);
                     w.Attr("name", q.Key);
                     w.Attr("number", q.Value);
                     w.End();
                 }
             }
         }
     }
 }
Esempio n. 4
0
 private void WriteFundItems(APIWriter w)
 {
     if (FundItem != null && FundItem.Count > 0)
     {
         foreach (var f in FundItem.Where(ff => ff.Value > 0))
         {
             w.Start("FundItem");
             w.Attr("fund", f.Key);
             w.AddText(f.Value.Value.ToString());
             w.End();
         }
     }
 }
Esempio n. 5
0
 private void WriteYesNoChoices(APIWriter w)
 {
     if (YesNoQuestion != null && YesNoQuestion.Count > 0)
     {
         foreach (var q in YesNoQuestion)
         {
             w.Start("YesNoQuestion");
             w.Attr("question", q.Key);
             w.AddText(q.Value.ToString());
             w.End();
         }
     }
 }
Esempio n. 6
0
 private void WriteSpecialTest(APIWriter w)
 {
     if (SpecialTest != null)
     {
         foreach (var d in SpecialTest)
         {
             w.Start("SpecialTest");
             w.Attr("key", d.Key);
             w.AddText(d.Value);
             w.End();
         }
     }
 }
Esempio n. 7
0
 private void WriteDocumentsUpload(APIWriter w)
 {
     if (OrganizationDocument != null && OrganizationDocument.Count > 0)
     {
         foreach (var q in OrganizationDocument)
         {
             w.Start("Documents");
             w.Attr("documentName", q.Key);
             w.AddText(q.Value.ToString());
             w.End();
         }
     }
 }
Esempio n. 8
0
 public void WriteXml(APIWriter w)
 {
     w.StartPending("TimeSlots");
     w.Attr("LockDays", TimeSlotLockDays);
     foreach (var c in list)
     {
         w.Start("Slot")
         .Attr("Time", c.Time.ToString2("t"))
         .Attr("DayOfWeek", c.DayOfWeek)
         .Attr("Limit", c.Limit)
         .AddText(c.Description)
         .End();
     }
     w.EndPending();
 }
Esempio n. 9
0
        public string Export(int id, string name)
        {
            var clause = Db.LoadQueryById(id);
            var w      = new APIWriter();

            w.Start("Search");
            w.Attr("Description", name);

            //var settings = new XmlWriterSettings();
            //settings.Encoding = new System.Text.UTF8Encoding(false);
            //using (w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            //{
            //    w.WriteStartElement("Search");
            //    WriteClause(clause);
            //    w.WriteEndElement();
            //}
            return("");
        }
Esempio n. 10
0
 private void WriteFamilyAttend(APIWriter w)
 {
     if (FamilyAttend != null && FamilyAttend.Count > 0)
     {
         foreach (var f in FamilyAttend)
         {
             w.Start("FamilyAttend");
             w.Attr("PeopleId", f.PeopleId);
             w.Attr("Name", f.Name);
             w.Attr("Attend", f.Attend);
             w.Attr("Birthday", f.Birthday);
             w.Attr("GenderId", f.GenderId);
             w.Attr("MaritalId", f.MaritalId);
             w.End();
         }
     }
 }
Esempio n. 11
0
        public XDocument StandardColumns(bool includeRoot = true)
        {
            var doc = new XDocument();

            using (var writer = doc.CreateWriter())
            {
                var w = new APIWriter(writer);
                if (includeRoot)
                {
                    w.Start("CustomReports");
                }

                w.Start("Report").Attr("name", "YourReportNameGoesHere");
                if (orgid.HasValue)
                {
                    w.Attr("showOnOrgId", orgid);
                }

                foreach (var c in mc.Columns.Values)
                {
                    w.Start("Column").Attr("name", c.Column).End();
                }

                var protectedevs = from value in Views.GetStandardExtraValues(db, "People")
                                   where value.VisibilityRoles.HasValue()
                                   select value.Name;

                var standards = (from value in Views.GetStandardExtraValues(db, "People")
                                 select value.Name).ToList();

                var extravalues = from ev in db.PeopleExtras
                                  where !protectedevs.Contains(ev.Field)
                                  where (ev.UseAllValues ?? false) == false
                                  group ev by new { ev.Field, ev.Type }
                into g
                orderby g.Key.Field
                select g.Key;

                var familyextravalues = from fe in db.FamilyExtras
                                        where (fe.UseAllValues ?? false) == false
                                        group fe by new { fe.Field, fe.Type }
                into fv
                orderby fv.Key.Field
                select fv.Key;

                foreach (var ev in extravalues)
                {
                    if (!Regex.IsMatch(ev.Type, @"Code|Date|Text|Int|Bit"))
                    {
                        continue;
                    }

                    w.Start("Column");
                    w.Attr("field", ev.Field).Attr("name", "ExtraValue" + ev.Type);
                    if (!standards.Contains(ev.Field))
                    {
                        w.Attr("disabled", "true");
                    }

                    w.End();
                }
                foreach (var fe in familyextravalues)
                {
                    if (!Regex.IsMatch(fe.Type, @"Code|Date|Text|Int|Bit"))
                    {
                        continue;
                    }

                    w.Start("Column");
                    w.Attr("field", fe.Field).Attr("name", "FamilyExtraValue" + fe.Type);

                    w.End();
                }
                var statusflags = from f in db.ViewStatusFlagLists
                                  where f.RoleName == null
                                  orderby f.Name
                                  select f;
                foreach (var f in statusflags)
                {
                    w.Start("Column")
                    .Attr("description", f.Name)
                    .Attr("flag", f.Flag)
                    .Attr("name", "StatusFlag")
                    .End();
                }
                if (orgid.HasValue)
                {
                    var specialcols = from c in mc.SpecialColumns.Values
                                      where c.Context == "org"
                                      where c.Column != "SmallGroup"
                                      select c;
                    foreach (var c in specialcols)
                    {
                        w.Start("Column")
                        .Attr("name", c.Column)
                        .Attr("orgid", orgid)
                        .End();
                    }

                    var smallgroups = from sg in db.MemberTags
                                      where sg.OrgId == orgid
                                      orderby sg.Name
                                      select sg;
                    foreach (var sg in smallgroups)
                    {
                        w.Start("Column")
                        .Attr("smallgroup", sg.Name)
                        .Attr("orgid", orgid)
                        .Attr("name", "SmallGroup")
                        .End();
                    }
                }
                w.End();
                if (includeRoot)
                {
                    w.End();
                }
            }
            return(doc);
        }
Esempio n. 12
0
        public override void ExecuteResult(ControllerContext context)
        {
            context.HttpContext.Response.ContentType = "text/xml";
            var settings = new XmlWriterSettings()
            {
                Encoding = new System.Text.UTF8Encoding(false), Indent = true
            };

            using (var w = XmlWriter.Create(context.HttpContext.Response.OutputStream, settings))
            {
                var x = new APIWriter(w);
                x.NoDefaults = true;
                x.Start("Attendees");
                var m = new CheckInModel();
                List <CheckinFamilyMember> q;
                if (CheckInModel.UseOldCheckin())
                {
                    q = m.FamilyMembersOld(fid, campus, thisday);
                }
                else
                {
                    q = m.FamilyMembers(fid, campus, thisday);
                }

                x.Attr("familyid", fid);
                x.Attr("waslocked", waslocked);

                var count = q.Count();

                if (page > 0)
                {
                    const int INT_PageSize = 10;
                    var       startrow     = (page - 1) * INT_PageSize;
                    if (count > startrow + INT_PageSize)
                    {
                        x.Attr("next", (page + 1));
                    }
                    else
                    {
                        x.Attr("next", "");
                    }
                    if (page > 1)
                    {
                        x.Attr("prev", (page - 1));
                    }
                    else
                    {
                        x.Attr("prev", "");
                    }
                    q = q.Skip(startrow).Take(INT_PageSize).ToList();
                }
                x.Attr("maxlabels", DbUtil.Db.Setting("MaxLabels", "6"));

                // TODO: Consider the option to numbers only. Per Braden Kok @ Granite Springs
                var code = DbUtil.Db.NextSecurityCode().Select(c => c.Code).Single();
                x.Attr("securitycode", code);

                var accommodateCheckInBug = DbUtil.Db.Setting("AccommodateCheckinBug", "false").ToBool();

                foreach (var c in q)
                {
                    var parents = "";

                    if (c.Position == 30)
                    {
                        var child = (from e in DbUtil.Db.People
                                     where e.PeopleId == c.Id
                                     select e).SingleOrDefault();

                        if (child.Family.HeadOfHouseholdId != null)
                        {
                            parents = child.Family.HeadOfHousehold.FirstName;

                            if (child.Family.HeadOfHouseholdSpouseId != null)
                            {
                                parents += " & " + child.Family.HeadOfHouseholdSpouse.FirstName;
                            }
                        }
                        else if (child.Family.HeadOfHouseholdSpouseId != null)
                        {
                            parents = child.Family.HeadOfHouseholdSpouse.FirstName;
                        }
                    }

                    double hoursBeforeClassStarts = 0;
                    if (c.Hour.HasValue)
                    {
                        var midnight = c.Hour.Value.Date;
                        var now      = midnight.Add(Util.Now.TimeOfDay);
                        hoursBeforeClassStarts = c.Hour.Value.Subtract(now).TotalHours;
                        // TZOffset will be positive to the east, negative to the west
                        // but we are trying to get to central time so we subtract
                        // if tzoffset is +1 then we need to -1 to go to CentralTime.
                        hoursBeforeClassStarts -= DbUtil.Db.Setting("TZOffset", "0").ToInt();
                        // now we need to make sure we are within 24 hours (ignore the date change)
                        hoursBeforeClassStarts %= 24;
                    }
                    x.Start("attendee");
                    x.Attr("id", c.Id.ToString());
                    x.Attr("mv", c.MemberVisitor);
                    x.Attr("name", c.DisplayName);
                    x.Attr("preferredname", c.PreferredName);
                    x.Attr("first", accommodateCheckInBug ? c.PreferredName : c.First);
                    x.Attr("last", c.Last);
                    x.Attr("org", c.DisplayClass);
                    x.Attr("orgname", c.OrgName);
                    x.Attr("leader", c.Leader);
                    x.Attr("orgid", c.OrgId.ToString());
                    x.Attr("loc", c.Location);
                    x.Attr("gender", c.Genderid);
                    x.Attr("leadtime", hoursBeforeClassStarts.ToString());
                    x.Attr("age", Person.AgeDisplay(c.Age, c.Id).ToString());
                    x.Attr("numlabels", c.NumLabels.ToString());
                    x.Attr("checkedin", c.CheckedIn.ToString());
                    x.Attr("custody", c.Custody.ToString());
                    x.Attr("transport", c.Transport.ToString());
                    x.Attr("hour", c.Hour.FormatDateTm());
                    x.Attr("requiressecuritylabel", c.RequiresSecurityLabel.ToString());
                    x.Attr("church", c.Church);

                    x.Attr("email", c.Email);
                    x.Attr("dob", c.dob);
                    x.Attr("goesby", c.Goesby);
                    x.Attr("addr", c.Addr);
                    x.Attr("zip", c.Zip);
                    x.Attr("home", c.Home);
                    x.Attr("cell", c.Cell);
                    x.Attr("marital", c.Marital.ToString());
                    x.Attr("allergies", c.Allergies);
                    x.Attr("grade", c.Grade.ToString());
                    x.Attr("parent", c.Parent);
                    x.Attr("emfriend", c.Emfriend);
                    x.Attr("emphone", c.Emphone);
                    x.Attr("activeother", c.Activeother.ToString());
                    x.Attr("haspicture", c.HasPicture.ToString());

                    x.Attr("parents", parents);

                    x.End();
                }
                x.End();
            }
        }
Esempio n. 13
0
        public void WriteXmlMessages(XmlWriter writer, Messages messages)
        {
            var w = new APIWriter(writer);

            w.Start("Messages");
            w.Attr("id", OrgId);
            w.AddComment($"{Util.UserPeopleId} {Util.Now:g}");

            if (messages.Confirmation)
            {
                w.Start("Confirmation")
                .Add("Subject", Subject)
                .AddCdata("Body", Body)
                .End();
            }

            if (messages.Reminder)
            {
                w.Start("Reminder")
                .Add("Subject", ReminderSubject)
                .AddCdata("Body", ReminderBody)
                .End();
            }

            if (messages.Support)
            {
                w.Start("SupportEmail")
                .Add("Subject", SupportSubject)
                .AddCdata("Body", SupportBody)
                .End();
            }

            if (messages.Support)
            {
                w.Start("SenderEmail")
                .Add("Subject", SenderSubject)
                .AddCdata("Body", SenderBody)
                .End();
            }

            w.StartPending("Instructions");
            if (messages.Login)
            {
                w.AddCdata("Login", InstructionLogin);
            }
            if (messages.Select)
            {
                w.AddCdata("Select", InstructionSelect);
            }
            if (messages.Find)
            {
                w.AddCdata("Find", InstructionFind);
            }
            if (messages.Options)
            {
                w.AddCdata("Options", InstructionOptions);
            }
            if (messages.Special)
            {
                w.AddCdata("Special", InstructionSpecial);
            }
            if (messages.Submit)
            {
                w.AddCdata("Submit", InstructionSubmit);
            }
            if (messages.Sorry)
            {
                w.AddCdata("Sorry", InstructionSorry);
            }
            w.EndPending();

            w.End();
        }
Esempio n. 14
0
        public void WriteXml(XmlWriter writer)
        {
            var w = new APIWriter(writer);

            w.Attr("id", OrgId);
            w.AddComment($"{Util.UserPeopleId} {Util.Now:g}");

            w.StartPending("Confirmation")
            .Add("Subject", Subject)
            .AddCdata("Body", Body)
            .EndPending();

            w.StartPending("Reminder")
            .Add("Subject", ReminderSubject)
            .AddCdata("Body", ReminderBody)
            .EndPending();

            w.StartPending("SupportEmail")
            .Add("Subject", SupportSubject)
            .AddCdata("Body", SupportBody)
            .EndPending();

            w.StartPending("SenderEmail")
            .Add("Subject", SenderSubject)
            .AddCdata("Body", SenderBody)
            .EndPending();

            w.StartPending("Fees")
            .Add("Fee", Fee)
            .Add("Deposit", Deposit)
            .Add("ExtraFee", ExtraFee)
            .Add("MaximumFee", MaximumFee)
            .Add("ExtraValueFeeName", ExtraValueFeeName)
            .Add("AccountingCode", AccountingCode)
            .Add("PushpayFundName", PushpayFundName)
            .AddIfTrue("ApplyMaxToOtherFees", ApplyMaxToOtherFees)
            .AddIfTrue("IncludeOtherFeesWithDeposit", IncludeOtherFeesWithDeposit)
            .AddIfTrue("OtherFeesAddedToOrgFee", OtherFeesAddedToOrgFee)
            .AddIfTrue("AskDonation", AskDonation)
            .Add("DonationLabel", DonationLabel)
            .Add("DonationFundId", DonationFundId)
            .EndPending();


            w.StartPending("OrgFees");
            foreach (var i in OrgFees)
            {
                w.Start("Fee")
                .Attr("OrgId", i.OrgId)
                .Attr("Fee", i.Fee)
                .End();
            }
            w.EndPending();


            w.StartPending("AgeGroups");
            foreach (var i in AgeGroups)
            {
                w.Start("Group")
                .Attr("StartAge", i.StartAge)
                .Attr("EndAge", i.EndAge)
                .Attr("Fee", i.Fee)
                .AddText(i.SmallGroup)
                .End();
            }
            w.EndPending();

            w.StartPending("Instructions")
            .AddCdata("Login", InstructionLogin)
            .AddCdata("Select", InstructionSelect)
            .AddCdata("Find", InstructionFind)
            .AddCdata("Options", InstructionOptions)
            .AddCdata("Special", InstructionSpecial)
            .AddCdata("Submit", InstructionSubmit)
            .AddCdata("Sorry", InstructionSorry)
            .AddCdata("Thanks", ThankYouMessage)
            .AddCdata("Terms", Terms)
            .EndPending();

            w.StartPending("Options")
            .AddCdata("ConfirmationTrackingCode", ConfirmationTrackingCode)
            .Add("ValidateOrgs", ValidateOrgs)
            .Add("Shell", Shell)
            .Add("ShellBs", ShellBs)
            .Add("FinishRegistrationButton", FinishRegistrationButton)
            .Add("SpecialScript", SpecialScript)
            .Add("OnEnrollScript", OnEnrollScript)
            .Add("GroupToJoin", GroupToJoin)
            .Add("TimeOut", TimeOut)
            .AddIfTrue("AllowOnlyOne", AllowOnlyOne)
            .AddIfTrue("TargetExtraValues", TargetExtraValues)
            .AddIfTrue("AllowReRegister", AllowReRegister)
            .AddIfTrue("AllowSaveProgress", AllowSaveProgress)
            .AddIfTrue("MemberOnly", MemberOnly)
            .AddIfTrue("AddAsProspect", AddAsProspect)
            .AddIfTrue("DisallowAnonymous", DisallowAnonymous)
            .EndPending();

            w.StartPending("NotRequired")
            .AddIfTrue("NoReqBirthYear", NoReqBirthYear)
            .AddIfTrue("NotReqDOB", NotReqDOB)
            .AddIfTrue("NotReqAddr", NotReqAddr)
            .AddIfTrue("NotReqZip", NotReqZip)
            .AddIfTrue("NotReqPhone", NotReqPhone)
            .AddIfTrue("NotReqGender", NotReqGender)
            .AddIfTrue("NotReqMarital", NotReqMarital)
            .AddIfTrue("NotReqCampus", NotReqCampus)
            .AddIfTrue("ShowDOBOnFind", ShowDOBOnFind)
            .AddIfTrue("ShowPhoneOnFind", ShowPhoneOnFind)
            .EndPending();

            TimeSlots?.WriteXml(w);

            w.StartPending("AskItems");
            foreach (var a in AskItems)
            {
                a.WriteXml(w);
            }
            w.EndPending();
        }
Esempio n. 15
0
        public void WriteXml(XmlWriter writer)
        {
            var optionsAdded   = false;
            var checkoxesAdded = false;
            var w = new APIWriter(writer);

            foreach (PropertyInfo pi in typeof(OnlineRegPersonModel).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                     .Where(vv => vv.CanRead && vv.CanWrite))
            {
                switch (pi.Name)
                {
                case "FundItem":
                    if (FundItem != null && FundItem.Count > 0)
                    {
                        foreach (var f in FundItem.Where(ff => ff.Value > 0))
                        {
                            w.Start("FundItem");
                            w.Attr("fund", f.Key);
                            w.AddText(f.Value.Value.ToString());
                            w.End();
                        }
                    }
                    break;

                case "FamilyAttend":
                    if (FamilyAttend != null && FamilyAttend.Count > 0)
                    {
                        foreach (var f in FamilyAttend)
                        {
                            w.Start("FamilyAttend");
                            w.Attr("PeopleId", f.PeopleId);
                            w.Attr("Name", f.Name);
                            w.Attr("Attend", f.Attend);
                            w.Attr("Birthday", f.Birthday);
                            w.Attr("GenderId", f.GenderId);
                            w.Attr("MaritalId", f.MaritalId);
                            w.End();
                        }
                    }
                    break;

                case "ExtraQuestion":
                    if (ExtraQuestion != null)
                    {
                        for (var i = 0; i < ExtraQuestion.Count; i++)
                        {
                            if (ExtraQuestion[i] != null && ExtraQuestion[i].Count > 0)
                            {
                                foreach (var q in ExtraQuestion[i])
                                {
                                    w.Start("ExtraQuestion");
                                    w.Attr("set", i);
                                    w.Attr("question", q.Key);
                                    w.AddText(q.Value);
                                    w.End();
                                }
                            }
                        }
                    }
                    break;

                case "YesNoQuestion":
                    if (YesNoQuestion != null && YesNoQuestion.Count > 0)
                    {
                        foreach (var q in YesNoQuestion)
                        {
                            w.Start("YesNoQuestion");
                            w.Attr("question", q.Key);
                            w.AddText(q.Value.ToString());
                            w.End();
                        }
                    }
                    break;

                case "option":
                    if (option != null && option.Count > 0 && !optionsAdded)
                    {
                        foreach (var o in option)
                        {
                            w.Add("option", o);
                        }
                    }
                    optionsAdded = true;
                    break;

                case "Checkbox":
                    if (Checkbox != null && Checkbox.Count > 0 && !checkoxesAdded)
                    {
                        foreach (var c in Checkbox)
                        {
                            w.Add("Checkbox", c);
                        }
                    }
                    checkoxesAdded = true;
                    break;

                case "MenuItem":
                    if (MenuItem != null)
                    {
                        for (var i = 0; i < MenuItem.Count; i++)
                        {
                            if (MenuItem[i] != null && MenuItem[i].Count > 0)
                            {
                                foreach (var q in MenuItem[i])
                                {
                                    w.Start("MenuItem");
                                    w.Attr("set", i);
                                    w.Attr("name", q.Key);
                                    w.Attr("number", q.Value);
                                    w.End();
                                }
                            }
                        }
                    }
                    break;

                case "MissionTripPray":
                    if (Parent.SupportMissionTrip)
                    {
                        w.Add(pi.Name, MissionTripPray);
                    }
                    break;

                case "MissionTripGoerId":
                    if (Parent.SupportMissionTrip)
                    {
                        w.Add(pi.Name, MissionTripGoerId);
                    }
                    break;

                case "IsFilled":
                    if (IsFilled)
                    {
                        w.Add(pi.Name, IsFilled);
                    }
                    break;

                case "CreatingAccount":
                    if (CreatingAccount)
                    {
                        w.Add(pi.Name, CreatingAccount);
                    }
                    break;

                case "MissionTripNoNoticeToGoer":
                    if (MissionTripNoNoticeToGoer)
                    {
                        w.Add(pi.Name, MissionTripNoNoticeToGoer);
                    }
                    break;

                case "memberus":
                    if (memberus)
                    {
                        w.Add(pi.Name, memberus);
                    }
                    break;

                case "otherchurch":
                    if (otherchurch)
                    {
                        w.Add(pi.Name, otherchurch);
                    }
                    break;

                default:
                    w.Add(pi.Name, pi.GetValue(this, null));
                    break;
                }
            }
        }
Esempio n. 16
0
        public void WriteXml(XmlWriter writer)
        {
            var optionsAdded   = false;
            var checkoxesAdded = false;
            var menuitemsAdded = false;
            var w = new APIWriter(writer);

            foreach (PropertyInfo pi in typeof(OnlineRegPersonModel).GetProperties(BindingFlags.Public | BindingFlags.Instance)
                     .Where(vv => vv.CanRead && vv.CanWrite))
            {
                switch (pi.Name)
                {
                case "FundItem":
                    if (FundItem != null && FundItem.Count > 0)
                    {
                        foreach (var f in FundItem.Where(ff => ff.Value > 0))
                        {
                            w.Start("FundItem");
                            w.Attr("fund", f.Key);
                            w.AddText(f.Value.Value.ToString());
                            w.End();
                        }
                    }
                    break;

                case "ExtraQuestion":
                    if (ExtraQuestion != null)
                    {
                        for (var i = 0; i < ExtraQuestion.Count; i++)
                        {
                            if (ExtraQuestion[i] != null && ExtraQuestion[i].Count > 0)
                            {
                                foreach (var q in ExtraQuestion[i])
                                {
                                    w.Start("ExtraQuestion");
                                    w.Attr("set", i);
                                    w.Attr("question", q.Key);
                                    w.AddText(q.Value);
                                    w.End();
                                }
                            }
                        }
                    }
                    break;

                case "YesNoQuestion":
                    if (YesNoQuestion != null && YesNoQuestion.Count > 0)
                    {
                        foreach (var q in YesNoQuestion)
                        {
                            w.Start("YesNoQuestion");
                            w.Attr("question", q.Key);
                            w.AddText(q.Value.ToString());
                            w.End();
                        }
                    }
                    break;

                case "option":
                    if (option != null && option.Count > 0 && !optionsAdded)
                    {
                        foreach (var o in option)
                        {
                            w.Add("option", o);
                        }
                    }
                    optionsAdded = true;
                    break;

                case "Checkbox":
                    if (Checkbox != null && Checkbox.Count > 0 && !checkoxesAdded)
                    {
                        foreach (var c in Checkbox)
                        {
                            w.Add("Checkbox", c);
                        }
                    }
                    checkoxesAdded = true;
                    break;

                case "MenuItem":
                    if (MenuItem != null && !menuitemsAdded)
                    {
                        foreach (var kv in MenuItem)
                        {
                            w.Start("MenuItem");
                            w.Attr("name", kv.Key);
                            w.Attr("number", kv.Value);
                            w.End();
                        }
                    }
                    menuitemsAdded = true;
                    break;

                default:
                    w.Add(pi.Name, pi.GetValue(this, null));
                    break;
                }
            }
        }