public static void Write(this ColumnQueryElement element, CSideWriter writer) { WriteDeclaration(element.ID, element.IndentationLevel, "Column", element.Name, writer); element.Properties.Where(p => p.HasValue).Write(PropertiesStyle.Field, writer); writer.WriteLine("}"); writer.Unindent(); writer.InnerWriter.WriteLine(); }
public static IEnumerable<ParameterBase> ToParameters(this ColumnQueryElement columnQueryElement) { yield return new SimpleParameter("ID", columnQueryElement.ID); yield return new SimpleParameter("Name", columnQueryElement.Name); foreach (var parameter in columnQueryElement.AllProperties.WithAValue.SelectMany(p => p.ToParameters())) { yield return parameter; } yield return new ScriptBlockParameter( "SubObjects", columnQueryElement.Properties.ColumnFilter.Select(f => f.ToInvocation())); }
protected override IEnumerable<QueryElement> CreateItems() { var columnQueryElement = new ColumnQueryElement(DataSource, ID, Name, GetIndentation()); columnQueryElement.Properties.Description = Description; columnQueryElement.Properties.ReverseSign = NullableBooleanFromSwitch(nameof(ReverseSign)); columnQueryElement.Properties.DateMethod = GetDateMethod(); columnQueryElement.Properties.TotalsMethod = GetTotalsMethod(); columnQueryElement.Properties.MethodType = GetMethodType(columnQueryElement.Properties.DateMethod, columnQueryElement.Properties.TotalsMethod); var subObjects = SubObjects?.Invoke().Select(o => o.BaseObject) ?? Enumerable.Empty<object>(); columnQueryElement.Properties.ColumnFilter.AddRange(subObjects.OfType<TableFilterLine>()); yield return columnQueryElement; }