public QueryExpressionGroupData GetDataObject() { var data = new QueryExpressionGroupData { GroupOperator = GroupMenuButton.Content.ToString() }; foreach (var item in NestedExpressions) { var group = item as QueryExpressionGroup; if (group != null) { if (data.Groups == null) { data.Groups = new List <QueryExpressionGroupData>(); } data.Groups.Add(group.GetDataObject()); continue; } var expression = item as QueryExpression; if (expression != null) { if (data.Expressions == null) { data.Expressions = new List <QueryExpressionData>(); } data.Expressions.Add(expression.GetDataObject()); } } return(data); }
public void LoadFromData(QueryExpressionGroupData expressionGroup) { if (!string.IsNullOrEmpty(expressionGroup.GroupOperator)) { GroupMenuButton.Content = expressionGroup.GroupOperator; } foreach (var expression in expressionGroup.Expressions) { var zExpression = AddExpression(); zExpression.LoadFromData(expression); } if (expressionGroup.Groups == null) { return; } foreach (var group in expressionGroup.Groups) { var zExpressionGroup = AddSingleExpressionGroup(); zExpressionGroup.LoadFromData(@group); } }