public static SqlQuerySummaryFunction ToSqlGrouping(this ReportAttributeColumnDef def)
        {
            switch (def.Grouping)
            {
            case ReportColumnGroupingType.Min:
                return(SqlQuerySummaryFunction.Min);

            case ReportColumnGroupingType.Max:
                return(SqlQuerySummaryFunction.Max);

            case ReportColumnGroupingType.Count:
                return(SqlQuerySummaryFunction.Count);

            case ReportColumnGroupingType.Sum:
                return(SqlQuerySummaryFunction.Sum);

            case ReportColumnGroupingType.Avg:
                return(SqlQuerySummaryFunction.Avg);

            case ReportColumnGroupingType.Group:
            case ReportColumnGroupingType.CrossGroup:
                return(SqlQuerySummaryFunction.Group);
            }
            return(SqlQuerySummaryFunction.None);
        }
Beispiel #2
0
        public static ReportAttributeColumnDef AddColumn(this ReportDef def, Guid sourceId, Guid attrDefId, string caption = null)
        {
            Check(def);
            var attr = CheckSourceAttribute(def, sourceId, attrDefId);

            var attrDef = new ReportAttributeDef {
                SourceId = sourceId, AttributeId = attrDefId
            };
            var s = !String.IsNullOrEmpty(caption)
                ? caption
                : attr is AttrDef
                    ? ((AttrDef)attr).Caption ?? ((AttrDef)attr).Name
                    : ((ReportSourceSystemAttributeDef)attr).Caption;
            var columnDef = new ReportAttributeColumnDef
            {
                Attribute = attrDef,
                Caption   = s,
                Visible   = true,
                Id        = Guid.NewGuid()
            };

            def.Columns.Add(columnDef);
            return(columnDef);
        }