Пример #1
0
        public ReportDefinition <TEntity> AddCollectionField <TCollectionElement>(
            Expression <Func <TEntity, IEnumerable <TCollectionElement> > > property,
            Expression <Func <TCollectionElement, object> > formatter,
            Expression <Func <TCollectionElement, object> > noValueFormatter = null,
            Expression <Func <TCollectionElement, object> > commentFormatter = null,
            ReportFieldKind kind   = ReportFieldKind.String,
            ReportFieldStyle style = ReportFieldStyle.Normal,
            Func <TCollectionElement, string> link = null,
            string title = null,
            string key   = null,
            Action <ReportCollectionField <TEntity, TCollectionElement> > configure = null)
        {
            var reportCollectionField = new ReportCollectionField <TEntity, TCollectionElement>(
                property,
                title,
                null,
                null,
                null,
                ReportFieldKind.Collection,
                ReportFieldStyle.Normal,
                null,
                key);

            reportCollectionField.CollectionField =
                new ReportField <TCollectionElement>(title, formatter, noValueFormatter, commentFormatter, kind, style, link, key);
            configure?.Invoke(reportCollectionField);
            _fields.Add(reportCollectionField);
            return(this);
        }
Пример #2
0
 public ReportCollectionField(
     Expression <Func <TEntity, IEnumerable <TCollectionElement> > > propertyExpression,
     string title, Expression <Func <TEntity, object> > formatter,
     Expression <Func <TEntity, object> > noValueFormatter = null,
     Expression <Func <TEntity, object> > commentFormatter = null, ReportFieldKind kind = ReportFieldKind.String,
     ReportFieldStyle style = ReportFieldStyle.Normal, Func <TEntity, string> link      = null, string key = null) :
     base(title, formatter, noValueFormatter, commentFormatter, kind, style, link, key)
 {
     PropertyExpression = propertyExpression;
     Property           = propertyExpression.GetAccessedProperty();
 }
Пример #3
0
        public ReportDefinition <TEntity> AddCustomField(
            string title,
            Expression <Func <TEntity, object> > formatter,
            Expression <Func <TEntity, object> > noValueFormatter = null,
            Expression <Func <TEntity, object> > commentFormatter = null,
            ReportFieldKind kind        = ReportFieldKind.Auto,
            ReportFieldStyle style      = ReportFieldStyle.Normal,
            Func <TEntity, string> link = null,
            string key = null,
            Action <ReportField <TEntity> > configure = null)
        {
            var reportField = new ReportField <TEntity>(title, formatter, noValueFormatter, commentFormatter, kind, style, link, key);

            configure?.Invoke(reportField);
            _fields.Add(reportField);
            return(this);
        }
Пример #4
0
        public ReportDefinition <TEntity> AddField <TProperty>(
            Expression <Func <TEntity, TProperty> > property,
            string title = null,
            Expression <Func <TEntity, object> > noValueFormatter = null,
            Expression <Func <TEntity, object> > commentFormatter = null,
            ReportFieldKind kind        = ReportFieldKind.Auto,
            ReportFieldStyle style      = ReportFieldStyle.Normal,
            Func <TEntity, string> link = null,
            string key = null,
            Action <ReportField <TEntity> > configure = null)
        {
            var propertyInfo = property.GetAccessedProperty();

            return(AddCustomField(
                       title ?? propertyInfo.Name.IntelliSpace(),
                       BuildLambda(property),
                       noValueFormatter,
                       commentFormatter,
                       kind,
                       style,
                       link,
                       key ?? title ?? propertyInfo.Name,
                       configure));
        }