コード例 #1
0
        private void SetCellValue(int i_Row, int i_Col, object i_Value, SummaryTypes i_Type)
        {
            if (i_Value != null)
            {
                string m_Value = string.Empty;
                switch (i_Type)
                {
                case SummaryTypes.AverageMinus:
                case SummaryTypes.AveragePlus:
                case SummaryTypes.Average:
                case SummaryTypes.Total:
                case SummaryTypes.TotalMinus:
                case SummaryTypes.TotalPlus:
                    m_Value = this.FormatValue(i_Value, FormatTypes.Decimal);
                    break;

                case SummaryTypes.RelatedPercent:
                case SummaryTypes.GroupPercent:
                case SummaryTypes.Percent:
                    m_Value = this.FormatValue(i_Value, FormatTypes.Precent);
                    break;

                case SummaryTypes.Frequence:
                    m_Value = this.FormatValue(i_Value, FormatTypes.Int);
                    break;

                default:
                    m_Value = this.FormatValue(i_Value, FormatTypes.String);
                    break;
                }
                this.PrintingTable.GetCell(i_Row, i_Col).Text = m_Value;
            }
        }
コード例 #2
0
        private string FormatValue(object i_value, SummaryTypes i_Type)
        {
            switch (i_Type)
            {
            case SummaryTypes.Frequence:
            case SummaryTypes.TotalPointsBB:
                return(string.Format("{0:0}", i_value));

            case SummaryTypes.ComputedPercent:                        //Modified at 2008-9-25 13:59:44@Simon
            case SummaryTypes.Percent:
            case SummaryTypes.RelatedPercent:
            case SummaryTypes.GroupPercent:
            case SummaryTypes.DistPercent:                      //Modified at 2008-10-6 14:01:25@Scott
            case SummaryTypes.DistGroupPercent:                 //Modified at 2008-10-6 15:08:29@Scott
                return(string.Format("{0:0%}", i_value));

            case SummaryTypes.Average:
            case SummaryTypes.AverageMinus:
            case SummaryTypes.AveragePlus:
            case SummaryTypes.Max:
            case SummaryTypes.Min:
            case SummaryTypes.Total:
            case SummaryTypes.TotalMinus:
            case SummaryTypes.TotalPlus:
                return(string.Format("{0:0.00}", i_value));

            default:
                return(i_value.ToString());
            }
        }
コード例 #3
0
        private void SetSummaryColumnStyle(SummaryTypes type, int col)
        {
            switch (type)
            {
            case SummaryTypes.Frequence:
                this.ColumnStyleRows.FreqencyColumns.Add(col);
                break;

            case SummaryTypes.ComputedPercent:                              //Modified at 2008-9-25 13:57:36@Simon
            case SummaryTypes.Percent:
            case SummaryTypes.RelatedPercent:
            case SummaryTypes.GroupPercent:
            case SummaryTypes.DistPercent:                      //Modified at 2008-10-6 14:01:25@Scott
            case SummaryTypes.DistGroupPercent:                 //Modified at 2008-10-6 15:08:29@Scott
            case SummaryTypes.TopPercent:
                this.ColumnStyleRows.PercentColumns.Add(col);
                break;

            case SummaryTypes.Total:
            case SummaryTypes.TotalMinus:
            case SummaryTypes.TotalPlus:
            case SummaryTypes.TotalPointsBB:
                this.ColumnStyleRows.TotalColumns.Add(col);
                break;

            case SummaryTypes.Average:
            case SummaryTypes.AverageMinus:
            case SummaryTypes.AveragePlus:
                this.ColumnStyleRows.AverageColumns.Add(col);
                break;

            default:
                break;
            }
        }
コード例 #4
0
ファイル: Metric.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Initializes a new instance of the <see cref="Metric"/> class.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="name">The name.</param>
        /// <param name="guid">The unique identifier.</param>
        /// <param name="summaryType">Type of the summary.</param>
        /// <param name="metricField">The metric field.</param>
        /// <param name="metricFieldSystemName">Name of the metric field system.</param>
        /// <param name="groupFieldOneSystemName">Name of the group field one system.</param>
        /// <param name="groupFieldTwoSystemName">Name of the group field two system.</param>
        /// <param name="groupFieldThreeSystemName">Name of the group field three system.</param>
        /// <param name="groupFieldFourSystemName">Name of the group field four system.</param>
        /// <param name="filterGuid">The filter unique identifier.</param>
        /// <param name="filterDefinition">The filter definition.</param>
        /// <param name="lockFilter">if set to <c>true</c> [lock filter].</param>
        public Metric(
            int id,
            string name, 
            Guid guid,
            SummaryTypes summaryType,
            Func<object, double> metricField,
            string metricFieldSystemName,
            string groupFieldOneSystemName,
            string groupFieldTwoSystemName,
            string groupFieldThreeSystemName,
            string groupFieldFourSystemName,
            Guid filterGuid,
            string filterDefinition,
            bool lockFilter
            )
        {
            this.Id = id;
            this.Name = name;
            this.Guid = guid;

            this.SummaryType = summaryType;
            this.MetricField = metricField;

            this.MetricFieldSystemName = metricFieldSystemName;
            this.GroupFieldOneSystemName = groupFieldOneSystemName;
            this.GroupFieldTwoSystemName = groupFieldTwoSystemName;
            this.GroupFieldThreeSystemName = groupFieldThreeSystemName;
            this.GroupFieldFourSystemName = groupFieldFourSystemName;
            this.FilterGuid = filterGuid;
            this.FilterDefinition = filterDefinition;
            this.LockFilter = lockFilter;
        }
コード例 #5
0
        public GroupSummaryCollection CreateSummaies(SummaryTypes type)
        {
            GroupSummaryCollection collection = new GroupSummaryCollection();

            foreach (ChartSeries chartSeries in this)
            {
                collection.Add(chartSeries.CreateSummary(type));
            }

            return(collection);
        }
コード例 #6
0
        public GroupSummary CreateSummary(SummaryTypes type)
        {
            GroupSummary summary = new GroupSummary();

            summary.Field = this._Field;

            summary.Filter = this._Filter.Copy();

            summary.SummaryType = type;

            summary.ColumnHeading = this.SeriesName;

            return(summary);
        }
コード例 #7
0
        private bool CheckSummaryType(SummaryTypes type)
        {
            if (this.Series.Count == 0)
            {
                return(false);
            }

            foreach (ChartSeries series in this.Series)
            {
                if (series.Field == null || series.Field == string.Empty)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #8
0
ファイル: MetricDefinition.cs プロジェクト: mparsin/Elements
        /// <summary>
        /// Initializes new instance of <see cref="T:Cebos.Veyron.Library.Process.Publisher.Definitions.MetricDefinition"/>.
        /// </summary>
        /// <param name="id">Metric's Id number.</param>
        /// <param name="name">The name of the metric.</param>
        /// <param name="guid">The <see cref="T:System.Guid"/> object that is used as unique identifier of the metric object.</param>
        /// <param name="summaryType">Type of the summary.</param>
        /// <param name="lockFilter">if set to <c>true</c> [lock filter].</param>
        /// <param name="snapshotFrequency">The snapshot frequency.</param>
        /// <param name="metricFieldSystemName">The system name of the field who's values used as metric measure.</param>
        /// <param name="groupFieldOneSystemName">The system name of the field by which to group values.</param>
        /// <param name="groupFieldTwoSystemName">The system name of the field by which to group values.</param>
        /// <param name="groupFieldThreeSystemName">The system name of the field by which to group values.</param>
        /// <param name="groupFieldFourSystemName">The system name of the field by which to group values.</param>
        /// <param name="filterGuid">The unique identifier of the filter that used in metric.</param>
        /// <param name="filterDefinition">The filter definition used to store overriden filter certainly filter with overriden UDP property.</param>
        /// <param name="orderByMetricField">The system name of the field by which to sort values or value groups if any defined.</param>
        /// <param name="orderByAscending">Whether to sorts values in ascending order.</param>
        /// <param name="orderByMetricFieldType">The type of the field which is used as sort criteria.</param>
        public MetricDefinition(
            int id,
            string name,
            Guid guid,
            SummaryTypes summaryType,
            bool lockFilter,
            string snapshotFrequency,
            string metricFieldSystemName,
            string groupFieldOneSystemName,
            string groupFieldTwoSystemName,
            string groupFieldThreeSystemName,
            string groupFieldFourSystemName,
            Guid filterGuid,
            string filterDefinition,
            string orderByMetricField,
            bool? orderByAscending,
            ColumnTypes orderByMetricFieldType)
        {
            Id = id;
            Name = name;
            Guid = guid;

            SummaryType = summaryType;
            LockFilter = lockFilter;
            SnapshotFrequency = snapshotFrequency;
            MetricFieldSystemName = metricFieldSystemName;
            GroupFieldOneSystemName = groupFieldOneSystemName;
            GroupFieldTwoSystemName = groupFieldTwoSystemName;
            GroupFieldThreeSystemName = groupFieldThreeSystemName;
            GroupFieldFourSystemName = groupFieldFourSystemName;
            FilterGuid = filterGuid;
            FilterDefinition = filterDefinition;

            OrderByMetricField = orderByMetricField;
            OrderByAscending = orderByAscending;
            OrderByMetricFieldType = orderByMetricFieldType;
        }
コード例 #9
0
 /// <summary>
 /// Creates aggregate function instance.
 /// </summary>
 /// <param name="functionName">The function name.</param>
 /// <param name="aggregationType">The aggregation type.</param>
 /// <param name="value">The aggregate result value.</param>
 /// <returns>AggregateFunction</returns>
 private static AggregateFunction<object, object> CreateAggregateFunction(string functionName, SummaryTypes aggregationType, object value)
 {
     return new AggregateFunction<object, object>
     {
         Caption = string.Format(CultureInfo.InvariantCulture, "{0}:", AggregateHelper.GetAttribute(aggregationType).FullName),
         FunctionName = functionName,
         AggregationExpression = x => value
     };
 }
コード例 #10
0
ファイル: AggregateHelper.cs プロジェクト: mparsin/Elements
 /// <summary>
 /// Builds function name.
 /// </summary>
 /// <param name="columnName">The column name.</param>
 /// <param name="aggregationType">The aggregation type.</param>
 /// <returns>System.String</returns>
 public static string BuildFunctionName(string columnName, SummaryTypes aggregationType)
 {
     return string.Format(CultureInfo.InvariantCulture, "{0}{1}", columnName, aggregationType);
 }
コード例 #11
0
ファイル: AggregateHelper.cs プロジェクト: mparsin/Elements
 /// <summary>
 /// Indicates that the specified aggregate type is calculated per page.
 /// </summary>
 /// <param name="aggregateType">The aggregate type.</param>
 /// <returns><c>true</c> if this aggregate type is designed 
 /// to be calculated on a single page of data, otherwise <c>false</c>.</returns>
 public static bool IsPageAggregateType(SummaryTypes aggregateType)
 {
     return GetAttribute(aggregateType).IsForPageScope;
 }
コード例 #12
0
ファイル: AggregateHelper.cs プロジェクト: mparsin/Elements
 /// <summary>
 /// Gets the attribute.
 /// </summary>
 /// <param name="aggrEnum">The aggr enum.</param>
 /// <returns>AggregateAttribute.</returns>
 public static AggregateAttribute GetAttribute(SummaryTypes aggrEnum)
 {
     return (AggregateAttribute)typeof(SummaryTypes).GetField(aggrEnum.ToString()).GetCustomAttributes(false).First();
 }
コード例 #13
0
 /// <summary>
 /// Add all the details for a summary type to this
 /// </summary>
 /// <param name="content">The content type</param>
 /// <param name="t">Ths summary type for the content type</param>
 public void AddSummaryType(Type content, Type t)
 {
     SummaryTypes.Add(content.FullName, t.FullName);
     AddTypeInner(t);
     AddSummaryMap(content);
 }
コード例 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AggregateDescriptor"/> class.
 /// </summary>
 /// <param name="columnName">Name of the column.</param>
 /// <param name="aggregateType">The aggregate type.</param>
 /// <param name="preprocess">Specifies whether value should be modified in advance.</param>
 public AggregateDescriptor(string columnName, SummaryTypes aggregateType, bool preprocess)
 {
     ColumnName = columnName;
     AggregateType = aggregateType;
     RequiresPreprocessing = preprocess;
 }
コード例 #15
0
 /// <summary>
 /// Gets a short name of aggregate function.
 /// </summary>
 /// <param name="aggregateType">The type of aggregate function.</param>
 /// <returns>A short function name.</returns>
 public static string GetAggregateFunctionShortName(SummaryTypes aggregateType)
 {
     return AggregateHelper.GetAttribute(aggregateType).ShortName;
 }
コード例 #16
0
 public Summary()
 {
     SummaryType = SummaryTypes.Info;
     PauzeTime   = 0L;
 }
コード例 #17
0
 private static AggregateDefinition CreateAggregateDefinition(GridViewBoundColumnBase gridColumn, IColumnItem columnItem, SummaryTypes aggregateType)
 {
     return AggregateDefinition.Create(
         columnName: string.IsNullOrEmpty(columnItem.AdditionalDataPropertyName)
             ? columnItem.Property.Name
             : columnItem.AdditionalDataPropertyName,
         summaryType: aggregateType.ToString(),
         customConverter: gridColumn.DataMemberBinding.Converter == null
             ? null
             : gridColumn.DataMemberBinding.Converter.GetType().AssemblyQualifiedName,
         targetType: columnItem.Property.PropertyType.FullName,
         typeName: columnItem.Property.PropertyType.ToString(),
         converterParameter: gridColumn.DataMemberBinding.ConverterParameter == null
             ? null
             : gridColumn.DataMemberBinding.ConverterParameter.ToString());
 }
コード例 #18
0
 /// <summary>
 /// Gets the order of aggregate function.
 /// </summary>
 /// <param name="aggregateType">The type of aggregate function.</param>
 /// <returns>The order of the function.</returns>
 public static short GetAggregateFunctionOrder(SummaryTypes aggregateType)
 {
     return AggregateHelper.GetAttribute(aggregateType).Order;
 }
コード例 #19
0
        /// <summary>
        /// Does the calculate.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="summaryType">Type of the summary.</param>
        /// <returns>System.Object.</returns>
        private static object DoCalculate(ReadOnlyCollection<object> data, SummaryTypes summaryType)
        {
            if (data == null)
                return null;

            switch (summaryType)
            {
                case SummaryTypes.Count:
                case SummaryTypes.CountAll:
                    return data.Count;

                case SummaryTypes.Min:
                case SummaryTypes.MinAll:
                    return data.Min();

                case SummaryTypes.Max:
                case SummaryTypes.MaxAll:
                    return data.Max();

                case SummaryTypes.Sum:
                case SummaryTypes.SumAll:
                    return GetSum(data);

                case SummaryTypes.Avg:
                case SummaryTypes.AvgAll:
                    return data.Count == 0 ? default(decimal) : GetSum(data) / data.Count;
            }

            return null;
        }