Пример #1
0
        public settingsPropertyEntry(DataColumn dc)
        {
            index       = dc.Ordinal;
            priority    = dc.Ordinal;
            displayName = dc.Caption;
            name        = dc.ColumnName;
            description = dc.GetDesc();
            type        = dc.DataType;

            var t = dc.GetValueType();

            if (t != typeof(String))
            {
                type = t;
            }

            categoryName = dc.GetGroup();
            format       = dc.GetFormat();
            letter       = dc.GetLetter();
            aggregation  = dc.GetAggregation();
            //spe.index = dc.Ordinal;
            importance = dc.GetImportance();
            expression = dc.Expression;
            unit       = dc.GetUnit();
            textColor  = dc.GetTextColor().ColorToHex();
            width      = dc.GetWidth();
            Alignment  = dc.GetAligment();

            //spe.displayName = dc.Caption;
            //spe.name = dc.ColumnName;
            //spe.description = dc.GetDesc();
            //spe.type = dc.DataType;
            //spe.categoryName = dc.GetGroup();
            //spe.format = dc.GetFormat();
            //spe.letter = dc.GetLetter();
            //spe.aggregation = dc.GetAggregation();
            ////spe.index = dc.Ordinal;
            //spe.importance = dc.GetImportance();
            //spe.expression = dc.Expression;
            //spe.unit = dc.GetUnit();
            //spe.priority = dc.Ordinal;
            //spe.width = dc.GetWidth();

            color            = dc.GetDefaultBackground().ColorToHex();
            isHiddenInReport = dc.ExtendedProperties.ContainsKey(imbAttributeName.reporting_hide);

            setAcceptableValues();
        }
Пример #2
0
        public DataColumnInReportDefinition Add(DataColumnInReportTypeEnum columnType, DataColumn column, dataPointAggregationType aggregation, string unit = "")
        {
            DataColumnInReportDefinition output = new DataColumnInReportDefinition();

            output.columnType       = columnType;
            output.aggregation      = aggregation;
            output.columnSourceName = column.ColumnName;
            output.columnPriority   = column.GetPriority();
            output.format           = column.GetFormat();

            Type   valueType = typeof(string);
            string name = ""; string description = ""; string letter = "";

            switch (aggregation)
            {
            default:
            case dataPointAggregationType.max:
            case dataPointAggregationType.min:
            case dataPointAggregationType.sum:
            case dataPointAggregationType.firstEntry:
            case dataPointAggregationType.lastEntry:
            case dataPointAggregationType.range:
                valueType = column.DataType;
                break;

            case dataPointAggregationType.avg:
            case dataPointAggregationType.stdev:
            case dataPointAggregationType.var:
            case dataPointAggregationType.entropy:
                valueType = typeof(double);
                if (output.format.isNullOrEmpty())
                {
                    output.format = "F5";
                }
                break;

            case dataPointAggregationType.count:
                valueType = typeof(int);
                break;
            }
            letter = column.GetLetter();

            if (columnType == DataColumnInReportTypeEnum.dataSummed)
            {
                if (!letter.isNullOrEmpty())
                {
                    letter = aggregation.ToString() + "(" + letter + ")";
                }
                output.columnLetter = letter;

                output.columnDescription = "(" + aggregation.ToString() + ") of " + column.ColumnName + ". " + column.GetDesc();
            }
            output.columnName       = column.ColumnName + " (" + aggregation.ToString() + ")";
            output.columnSourceName = column.ColumnName;

            output.importance      = column.GetImportance();
            output.columnUnit      = column.GetUnit();
            output.columnValueType = valueType;
            output.columnDefault   = valueType.GetDefaultValue();
            output.columnGroup     = column.GetGroup();

            output.spe = column.GetSPE();
            Add(column.ColumnName, output);

            return(output);
        }