// Overload for BETWEEN query nodes public QueryNode(QueryNodeType type, string column, QueryOp op, JSONObj value1, JSONObj value2) { // Between and In operators are the only ones that know to look at the values array Debug.Assert(op == QueryOp.Btwn || op == QueryOp.In); this.Type = type; this.Column = column; this.Operator = op; this.Children = new QueryNodeList(); this.Value = JSONObj.obj; Value.Add(value1); Value.Add(value2); }
public static JSONObj Serialize(QueryNode node) { JSONObj masterObj = new JSONObj(JSONObj.ObjectType.OBJECT); masterObj.AddField("type", node.Type.ToString().ToLower()); masterObj.AddField("op", node.Operator.ToString().ToLower()); switch (node.Type) { case QueryNodeType.Group: JSONObj innerObj = new JSONObj(JSONObj.ObjectType.ARRAY); foreach (QueryNode Item in node.Children) { innerObj.Add(Serialize(Item)); } masterObj.AddField("children", innerObj); break; case QueryNodeType.Comparison: masterObj.AddField("column", node.Column); masterObj.AddField("value", node.Value); break; } string test = masterObj.ToString(); return(masterObj); }
public string Finalize() { JSONObj finalObject = new JSONObj(JSONObj.ObjectType.OBJECT); JSONObj eventListObject = new JSONObj(JSONObj.ObjectType.OBJECT); foreach (var telEvent in eventList) { eventListObject.Add(telEvent); } finalObject.AddField("header", headerObject); finalObject.AddField("events", eventListObject); Payload = finalObject.Print(); return(Payload); }