コード例 #1
0
        /// <inheritdoc/>
        public override List <object> CategoriesForRow(ICrmDataSourceRow row)
        {
            var resultArray         = new List <object>();
            AnalysisCategoryValue v = this.CategoryValueForRow(row);

            if (v != null && !v.IsEmptyValue)
            {
                resultArray.Add(v);
            }

            foreach (var subIndices in this.AnalysisField.SubFieldQueryResultFieldIndices)
            {
                string rawValue = row.RawValueAtIndex(subIndices.ToInt());
                if (rawValue != null)
                {
                    v = this.ValueDictionary.ValueOrDefault(rawValue) as AnalysisCategoryValue;
                    if (v == null)
                    {
                        if (!this.AnalysisField.CrmFieldInfo.IsEmptyValue(rawValue))
                        {
                            v = new AnalysisCategoryValue(this, rawValue, row.ValueAtIndex(subIndices.ToInt()));
                            if (v != null)
                            {
                                this.AddToValueDictionary(v);
                            }
                        }
                    }

                    if (v != null)
                    {
                        resultArray.Add(v);
                    }
                }
            }

            if (resultArray.Count > 0)
            {
                return(resultArray);
            }

            return(new List <object> {
                this.EmptyValue()
            });
        }
コード例 #2
0
 /// <inheritdoc />
 public override string RawValueForRow(ICrmDataSourceRow row)
 {
     return(row.RawValueAtIndex(this.AnalysisField.QueryResultFieldIndex));
 }
コード例 #3
0
 /// <inheritdoc/>
 public override bool IsEmptyForRow(ICrmDataSourceRow row)
 {
     return(this.CrmFieldInfo.IsEmptyValue(row.RawValueAtIndex(this.QueryResultFieldIndex)));
 }
        /// <inheritdoc/>
        public override bool ApplyRowXCategoryValueArraySumLine(ICrmDataSourceRow dataSourceRow, List <object> xCategoryValueArray, bool sumLine)
        {
            var v = dataSourceRow.RawValueAtIndex(this.SourceField.QueryResultFieldIndex);
            var recordIdentification = $"{this.YCategoryValue.Key}:{dataSourceRow.RecordIdentificationAtIndex(this.queryTableIndex)}";

            if (this.appliedRecordIdentifications.ValueOrDefault(recordIdentification) != null)
            {
                return(false);
            }

            this.appliedRecordIdentifications[recordIdentification] = 1;
            double doubleValue = v.ToDouble();

            if (this.WeightField != null)
            {
                var weightValue = dataSourceRow.RawValueAtIndex(this.WeightField.QueryResultFieldIndex);
                doubleValue *= weightValue.ToDouble();
            }

            if (this.CurrencyField != null)
            {
                string currencyValue = dataSourceRow.RawValueAtIndex(this.CurrencyField.QueryResultFieldIndex);
                doubleValue = this.ProcessingResultColumn.ProcessingContext.AdjustValueForCurrency(doubleValue, currencyValue);
            }

            if (this.AggregationType.Min)
            {
                if (this.count == 0 || this.aggregatedValue > doubleValue)
                {
                    this.aggregatedValue = doubleValue;
                }
            }
            else if (this.AggregationType.Max)
            {
                if (this.aggregatedValue < doubleValue || this.count == 0)
                {
                    this.aggregatedValue = doubleValue;
                }
            }
            else
            {
                this.aggregatedValue += doubleValue;
            }

            this.count++;
            if (xCategoryValueArray != null)
            {
                foreach (AnalysisProcessingXCategoryValue xCategoryValue in xCategoryValueArray)
                {
                    AnalysisProcessingSimpleXResultColumnValue xResult = this.XResultColumnValueForCategoryValueKey(xCategoryValue.Key);
                    if (this.AggregationType.Min)
                    {
                        if (this.count == 0 || xResult.AggregatedValue > doubleValue)
                        {
                            xResult.AggregatedValue = doubleValue;
                        }
                    }
                    else if (this.AggregationType.Max)
                    {
                        if (xResult.AggregatedValue < doubleValue || this.count == 0)
                        {
                            xResult.AggregatedValue = doubleValue;
                        }
                    }
                    else
                    {
                        xResult.AggregatedValue += doubleValue;
                    }

                    xResult.Count++;
                }
            }

            return(true);
        }
 /// <inheritdoc/>
 public override double NumberResultForResultRow(ICrmDataSourceRow row) => row.RawValueAtIndex(this.SourceField.QueryResultFieldIndex).ToDouble();