public ActionResult Lookups(string id) { var ret = AuthenticateDeveloper(); if (ret.StartsWith("!")) { return(Content($"<Lookups error=\"{ret.Substring(1)}\" />")); } if (!id.HasValue()) { return(Content("Lookups error=\"not found\">")); } var q = DbUtil.Db.ExecuteQuery <LookupController.Row>("select * from lookup." + id); var w = new APIWriter(); w.Start("Lookups"); w.Attr("name", id); foreach (var i in q) { w.Start("Lookup"); w.Attr("Id", i.Id); w.AddText(i.Description); w.End(); } w.End(); DbUtil.LogActivity("APIMeta Lookups"); return(Content(w.ToString(), "text/xml")); }
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(); } } }
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(); } } }
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(); } } }
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(); } } }
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(); } } } } }
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(); } } } } }
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; } } }
public override void WriteXml(APIWriter w) { w.Start(Type); w.AddText(Label ?? "Suggested Amount"); w.End(); }
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; } } }