public IHttpActionResult FillCatalog() { try { ViewModel.Search SearchLegalUser = new ViewModel.Search(); SearchLegalUser.Order = " order by tblCatalog.IDRet, tblCatalog.[Sort] Asc"; SearchLegalUser.JsonResult = " FOR JSON path"; JArray JsonCatalog = BisCatalog.GetJsonCatalogData(SearchLegalUser); foreach (JObject JItem in JsonCatalog) { JItem.Add(new JProperty("SizeOfPDF", SizeOfFile(JItem["PDFUrl"].ToString()))); } return(Ok(JsonCatalog)); } catch { return(NotFound()); } }
private void ProcessInbox(DRequestCompletedEventArgs e, string QId) { try { JsonObject JDef = JsonStatus.Parse(e.ResponseString); JsonArray JData = JDef.GetNamedArray("data"); foreach (JsonValue JItem in JData) { InboxMessage BoxMessage = new InboxMessage(JItem.GetObject()); Member.Activities.AddUI(new Activity(BoxMessage.Name, BoxMessage.OpenComment) { TimeStamp = BoxMessage.TimeStamp }); } } catch (Exception) { } }
public void ShowQueryEqualByParameter( IEnumerable <JKeyValuePair> query, string[] args, string parameter, bool key = true, JItemType itemType = JItemType.SingleValue) { if (args.Contains(parameter)) { if (args.Length > (Array.IndexOf(args, parameter) + 1)) { Console.WriteLine($"Queries with value Equal to {args[Array.IndexOf(args, parameter) + 1]}"); var student = new JString("Student"); var certainQuery = query.Where(x => (key ? x.Key : x.Value) .Equals(JItem.Factory(itemType, args[Array.IndexOf(args, parameter) + 1])) ).Select(x => x.FindContainerOrReturnParent(student)); ShowQuery(certainQuery); } } }
public JProperty(JItem parent, string name, object value) : base(parent, name, JItemType.Property) { _value = value; }
public JArray(JItem parent, string name) : base(parent, name, JItemType.Object) { }
/// <summary> /// Converts JSON text from 'getstats' command to human-friendly HTML. /// </summary> public static string GetStatsHtml(string json, string serviceName = null, string version = null) { dynamic data = JsonConvert.DeserializeObject(json); if (serviceName == null) { serviceName = data.service.name; } if (version == null) { version = data.service.version; } JObject root = null; JItem currentParent = null; using (StringReader stringReader = new StringReader(json)) { using (JsonTextReader reader = new JsonTextReader(stringReader)) { bool done = false; JsonToken token = JsonToken.Undefined; object value = null; JsonToken prevToken = JsonToken.Undefined; object prevValue = null; do { done = !reader.Read(); if (!done) { prevToken = token; prevValue = value; token = reader.TokenType; value = reader.Value; if (token == JsonToken.StartObject) { if (currentParent == null) { root = new JObject(null, serviceName + " v" + version); currentParent = root; } else { string name = prevToken == JsonToken.PropertyName ? prevValue.ToString() : ""; JObject obj = new JObject(currentParent, name); currentParent.Items.Add(obj); currentParent = obj; } } else if (token == JsonToken.EndObject) { currentParent = currentParent.Parent; } else if (token == JsonToken.StartArray) { string name = prevToken == JsonToken.PropertyName ? prevValue.ToString() : ""; JArray arr = new JArray(currentParent, name); currentParent.Items.Add(arr); currentParent = arr; } else if (token == JsonToken.EndArray) { currentParent = currentParent.Parent; } else if ((token == JsonToken.Boolean) || (token == JsonToken.Date) || (token == JsonToken.Float) || (token == JsonToken.Integer) || (token == JsonToken.String) || (token == JsonToken.Raw)) { if (prevToken == JsonToken.PropertyName) { string name = prevToken == JsonToken.PropertyName ? prevValue.ToString() : ""; JProperty prop = new JProperty(currentParent, name, value); currentParent.Items.Add(prop); } else if (prevToken == JsonToken.StartArray) { JObject val = new JObject(currentParent, value.ToString()); currentParent.Items.Add(val); } } } }while (!done); } } string body = root.Render(null); return(HTML.Replace("##TITLE##", "").Replace("##BODY##", body)); }
public Tree(JItem root) { JRoot = root; InitializeComponent(); treeView1.Nodes.Add(new JItemNode(JRoot)); }
public void Activate(JItem jitem) { this.jitem = jitem; ConstructDataString(); jtooltip.SetActive(true); }