private void ReadYesNoChoices(XElement e)
        {
            if (YesNoQuestion == null)
            {
                YesNoQuestion = new Dictionary <string, bool?>();
            }
            var ynq = e.Attribute("question");

            if (ynq != null)
            {
                YesNoQuestion.Add(ynq.Value, e.Value.ToBool());
            }
        }
Beispiel #2
0
        public void ReadXml(XmlReader reader)
        {
            var s = reader.ReadOuterXml();
            var x = XDocument.Parse(s);

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

            var eqset   = 0;
            var menuset = 0;

            foreach (var e in x.Root.Elements())
            {
                var name = e.Name.ToString();
                switch (name)
                {
                case "FundItem":
                    if (FundItem == null)
                    {
                        FundItem = new Dictionary <int, decimal?>();
                    }
                    var fu = e.Attribute("fund");
                    if (fu != null)
                    {
                        FundItem.Add(fu.Value.ToInt(), e.Value.ToDecimal());
                    }
                    break;

                case "FamilyAttend":
                    var fa = new FamilyAttendInfo();
                    fa.PeopleId  = GetAttr(e, "PeopleId").ToInt2();
                    fa.Attend    = GetAttr(e, "Attend").ToBool();
                    fa.Name      = GetAttr(e, "Name");
                    fa.Birthday  = GetAttr(e, "Birthday");
                    fa.Email     = GetAttr(e, "Email");
                    fa.MaritalId = GetAttr(e, "MaritalId").ToInt2();
                    fa.GenderId  = GetAttr(e, "GenderId").ToInt2();
                    if (FamilyAttend == null)
                    {
                        FamilyAttend = new List <FamilyAttendInfo>();
                    }
                    FamilyAttend.Add(fa);
                    break;

                case "ExtraQuestion":
                    if (ExtraQuestion == null)
                    {
                        ExtraQuestion = new List <Dictionary <string, string> >();
                    }
                    var eqsetattr = e.Attribute("set");
                    if (eqsetattr != null)
                    {
                        eqset = eqsetattr.Value.ToInt();
                    }
                    if (ExtraQuestion.Count == eqset)
                    {
                        ExtraQuestion.Add(new Dictionary <string, string>());
                    }
                    var eq = e.Attribute("question");
                    if (eq != null)
                    {
                        ExtraQuestion[eqset].Add(eq.Value, e.Value);
                    }
                    break;

                case "YesNoQuestion":
                    if (YesNoQuestion == null)
                    {
                        YesNoQuestion = new Dictionary <string, bool?>();
                    }
                    var ynq = e.Attribute("question");
                    if (ynq != null)
                    {
                        YesNoQuestion.Add(ynq.Value, e.Value.ToBool());
                    }
                    break;

                case "option":
                    if (option == null)
                    {
                        option = new List <string>();
                    }
                    option.Add(e.Value);
                    break;

                case "Checkbox":
                    if (Checkbox == null)
                    {
                        Checkbox = new List <string>();
                    }
                    Checkbox.Add(e.Value);
                    break;

                case "MenuItem":
                    if (MenuItem == null)
                    {
                        MenuItem = new List <Dictionary <string, int?> >();
                    }
                    var menusetattr = e.Attribute("set");
                    if (menusetattr != null)
                    {
                        menuset = menusetattr.Value.ToInt();
                    }
                    if (MenuItem.Count == menuset)
                    {
                        MenuItem.Add(new Dictionary <string, int?>());
                    }
                    var aname  = e.Attribute("name");
                    var number = e.Attribute("number");
                    if (aname != null && number != null)
                    {
                        MenuItem[menuset].Add(aname.Value, number.Value.ToInt());
                    }
                    break;

                case "MissionTripPray":
                    MissionTripPray = e.Value.ToBool();
                    break;

                case "MissionTripGoerId":
                    MissionTripGoerId = e.Value.ToInt();
                    break;

                case "CreatingAccount":
                    CreatingAccount = e.Value.ToBool();
                    break;

                default:
                    Util.SetPropertyFromText(this, TranslateName(name), e.Value);
                    break;
                }
            }
        }
Beispiel #3
0
        public void ReadXml(XmlReader reader)
        {
            var s = reader.ReadOuterXml();
            var x = XDocument.Parse(s);

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

            var eqset = 0;

            foreach (var e in x.Root.Elements())
            {
                var name = e.Name.ToString();
                switch (name)
                {
                case "FundItem":
                    if (FundItem == null)
                    {
                        FundItem = new Dictionary <int, decimal?>();
                    }
                    var fu = e.Attribute("fund");
                    if (fu != null)
                    {
                        FundItem.Add(fu.Value.ToInt(), e.Value.ToDecimal());
                    }
                    break;

                case "ExtraQuestion":
                    if (ExtraQuestion == null)
                    {
                        ExtraQuestion = new List <Dictionary <string, string> >();
                    }
                    var eqsetattr = e.Attribute("set");
                    if (eqsetattr != null)
                    {
                        eqset = eqsetattr.Value.ToInt();
                    }
                    if (ExtraQuestion.Count == eqset)
                    {
                        ExtraQuestion.Add(new Dictionary <string, string>());
                    }
                    var eq = e.Attribute("question");
                    if (eq != null)
                    {
                        ExtraQuestion[eqset].Add(eq.Value, e.Value);
                    }
                    break;

                case "YesNoQuestion":
                    if (YesNoQuestion == null)
                    {
                        YesNoQuestion = new Dictionary <string, bool?>();
                    }
                    var ynq = e.Attribute("question");
                    if (ynq != null)
                    {
                        YesNoQuestion.Add(ynq.Value, e.Value.ToBool());
                    }
                    break;

                case "option":
                    if (option == null)
                    {
                        option = new List <string>();
                    }
                    option.Add(e.Value);
                    break;

                case "Checkbox":
                    if (Checkbox == null)
                    {
                        Checkbox = new List <string>();
                    }
                    Checkbox.Add(e.Value);
                    break;

                case "MenuItem":
                    if (MenuItem == null)
                    {
                        MenuItem = new Dictionary <string, int?>();
                    }
                    var aname  = e.Attribute("name");
                    var number = e.Attribute("number");
                    if (aname != null && number != null)
                    {
                        MenuItem.Add(aname.Value, number.Value.ToInt());
                    }
                    break;

                default:
                    Util.SetPropertyFromText(this, name, e.Value);
                    break;
                }
            }
        }