/// <summary>
        /// Initializes a new instance of the <see cref="AnalysisResultCell"/> class.
        /// </summary>
        /// <param name="values">Values</param>
        /// <param name="row">Row</param>
        /// <param name="column">Column</param>
        public AnalysisResultCell(List <object> values, AnalysisRow row, AnalysisColumn column)
        {
            Row    = row;
            Column = column;
            var result = 0.0;

            if (column.IsTextColumn || values?.Any() == false)
            {
                Value       = 0;
                StringValue = string.Empty;
            }

            var collection      = values?.OfType <AnalysisProcessingResultColumnValue>();
            var lstAnalysis     = collection?.ToList();
            var aggregationType = column.ResultColumn.AggregationType;

            if (lstAnalysis?.Any() == true)
            {
                result = GetAggregatedResult(aggregationType, lstAnalysis);
            }

            Value       = result;
            StringValue = column.ResultColumn.DisplayStringFromNumber(Value);
            var xCategoryValues = column.XCategoryValues;

            if (xCategoryValues?.Any() == true)
            {
                XResultCells = GetAnalysisXResultCells(lstAnalysis, aggregationType, column);
            }
        }
 /// <summary>
 /// Adds row
 /// </summary>
 /// <param name="row">Row</param>
 public void AddRow(AnalysisRow row)
 {
     if (this.rows == null)
     {
         this.rows = new List <object> {
             row
         };
     }
     else
     {
         this.rows.Add(row);
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="AnalysisResultCell"/> class.
        /// </summary>
        /// <param name="value">Value.AnalysisValueFunction</param>
        /// <param name="row">Row</param>
        /// <param name="column">Column</param>
        public AnalysisResultCell(AnalysisProcessingResultColumnValue value, AnalysisRow row, AnalysisColumn column)
        {
            this.Row    = row;
            this.Column = column;
            if (this.Column.ResultColumn.ValueOptions?.IsText ?? false)
            {
                this.StringValue = value.TextResult;
                this.RawValue    = this.StringValue;
                this.Value       = 0;
                var xCategoryValues = column.XCategoryValues;
                if (xCategoryValues.Count > 0)
                {
                    var xResultCells = new List <AnalysisXResultCell>();
                    foreach (AnalysisXColumn xCategoryValue in xCategoryValues)
                    {
                        xResultCells.Add(new AnalysisXResultCell(value.TextResultForXCategoryValueKey(xCategoryValue.Key)));
                    }

                    this.XResultCells = xResultCells;
                }
            }
            else
            {
                this.Value       = value.Result;
                this.StringValue = column.ResultColumn.DisplayStringFromNumber(this.Value);
                this.RawValue    = this.Value.ToString();
                var xCategoryValues = column.XCategoryValues;
                if (xCategoryValues?.Count > 0)
                {
                    var xResultCells = new List <AnalysisXResultCell>();
                    foreach (AnalysisXColumn xCategoryValue in xCategoryValues)
                    {
                        var num = value.ResultForXCategoryValueKey(xCategoryValue.Key);
                        xResultCells.Add(new AnalysisXResultCell(num, column.ResultColumn.DisplayStringFromNumber(num)));
                    }

                    this.XResultCells = xResultCells;
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AnalysisRowDetails"/> class.
 /// </summary>
 /// <param name="resultRow">Result row</param>
 /// <param name="dataSourceRow">Data source row</param>
 public AnalysisRowDetails(AnalysisRow resultRow, ICrmDataSourceRow dataSourceRow)
 {
     this.DataSourceRow     = dataSourceRow;
     this.AnalysisResultRow = resultRow;
 }