public TradingHoursRecord(JSONObject body) { this.Quotes = new LinkedList <HoursRecord>(); this.Trading = new LinkedList <HoursRecord>(); this.Symbol = (string)body["symbol"]; if (body["quotes"] != null) { JSONArray jsonarray = (JSONArray)body["quotes"]; foreach (JSONObject i in jsonarray) { HoursRecord rec = new HoursRecord(i); this.Quotes.AddLast(rec); } } if (body["trading"] != null) { JSONArray jsonarray = (JSONArray)body["trading"]; foreach (JSONObject i in jsonarray) { HoursRecord rec = new HoursRecord(i); this.Trading.AddLast(rec); } } }
public bool FieldsFromJSONObject(JSONObject value, string str) { this.symbol = (string)value["symbol"]; quotes = new LinkedList <HoursRecord>(); if (value["quotes"] != null) { JSONArray jsonarray = (JSONArray)value["quotes"]; foreach (JSONObject i in jsonarray) { HoursRecord rec = new HoursRecord(); rec.FieldsFromJSONObject(i); quotes.AddLast(rec); } } trading = new LinkedList <HoursRecord>(); if (value["trading"] != null) { JSONArray jsonarray = (JSONArray)value["trading"]; foreach (JSONObject i in jsonarray) { HoursRecord rec = new HoursRecord(); rec.FieldsFromJSONObject(i); trading.AddLast(rec); } } if ((symbol == null) || (quotes.Count == 0) || (trading.Count == 0)) { return(false); } return(true); }