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();
         }
     }
 }
示例#2
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;
                }
            }
        }
示例#3
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;
                }
            }
        }