Exemplo n.º 1
0
        public static void AddAggTypeDetailItem(
            AggregationTypeDetail item,
            string label,
            string format          = "",
            Bitmaps16x16Enum image = Bitmaps16x16Enum.None)
        {
            item.TypeLabel      = label;
            item.FormatString   = format;
            item.TypeImageIndex = image;

            string key = item.DetailKey;

            if (TypeKeyDict.ContainsKey(key))
            {
                throw new Exception("Type Id already exists: " + key);
            }
            TypeKeyDict[key] = item;

            string typeName = item.TypeName.ToUpper();

            if (TypeNameDict.ContainsKey(typeName))
            {
                throw new Exception("TypeName already exists: " + item.TypeName);
            }
            TypeNameDict[typeName] = item;

            return;
        }
Exemplo n.º 2
0
// Get format string for a date QueryColumn
        public static string GetFormatString(
            QueryColumn qc)
        {
            string formatString = qc.DisplayFormatString;

            if (qc.IsAggregationGroupBy)
            {
                AggregationDef        at  = qc.Aggregation;
                AggregationTypeDetail atd = at.TypeDetail;
                if (atd != null)
                {
                    formatString = atd.FormatString;
                }
            }

            if (Lex.Contains(formatString, "none"))             // remove any none for date format
            {
                formatString = Lex.Replace(formatString, "none", "").Trim();
            }

            if (Lex.IsNullOrEmpty(formatString))
            {
                formatString = DefaultFormat;
            }

            return(formatString);
        }
Exemplo n.º 3
0
        public void SetFromTypeName(string typeName)
        {
            AggregationTypeDetail atd = AggregationTypeDetail.GetByTypeName(typeName);

            SetFromDetail(atd);
            return;
        }
Exemplo n.º 4
0
        public static AggregationTypeDetail AddUndefinedTypeItem()
        {
            AggregationTypeDetail item = new AggregationTypeDetail();

            item.TypeName = "Undefined";
            AddAggTypeDetailItem(item, "None");

            return(item);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Construct from type name
        /// </summary>
        /// <param name="typeName"></param>

        public AggregationDef(string typeName)
        {
            AggregationTypeDetail atd = AggregationTypeDetail.GetByTypeName(typeName);

            if (atd == null)
            {
                throw new Exception("Aggregation type not found: " + typeName);
            }

            SetFromDetail(atd);
            return;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Construct from existing AggregationType Id
        /// </summary>
        /// <param name="typeId"></param>

        public AggregationTypeDetail(string key)
        {
            if (!AggregationTypeDetail.TypeKeyDict.ContainsKey(key))
            {
                throw new Exception("Unrecognized Aggregation type key: " + key);
            }

            AggregationTypeDetail at = AggregationTypeDetail.TypeKeyDict[key];

            at.MemberwiseCopy(this);

            return;
        }
Exemplo n.º 7
0
        public void SetFromDetail(AggregationTypeDetail atd)
        {
            if ((Role == AggregationRole.ColumnGrouping && atd.Role == AggregationRole.RowGrouping) ||
                (Role == AggregationRole.RowGrouping && atd.Role == AggregationRole.ColumnGrouping))
            {
                Role = Role;                 // don't change role if both are grouping roles
            }
            else
            {
                Role = atd.Role;
            }

            SummaryType  = atd.SummaryTypeId;
            GroupingType = atd.GroupingType;

            return;
        }
Exemplo n.º 8
0
        public static AggregationTypeDetail AddGroupingTypeItem(
            GroupingTypeEnum groupingType,
            string label,
            GroupingMethodDelegate groupingDelegate = null,
            string format          = "",
            Bitmaps16x16Enum image = Bitmaps16x16Enum.None)
        {
            AggregationTypeDetail item = new AggregationTypeDetail();

            item.Role           = AggregationRole.RowGrouping;
            item.GroupingType   = groupingType;
            item.TypeName       = groupingType.ToString();
            item.GroupingMethod = groupingDelegate;

            AddAggTypeDetailItem(item, label, format, image);

            return(item);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Set Aggregation by AggregationTypeDetail name
        /// </summary>

        public AggregationTypeDetail SetAggregation(string typeName)
        {
            if (Lex.IsUndefined(typeName) || Lex.Eq(typeName, "none"))             // clear?
            {
                Aggregation = null;
                return(null);
            }

            AggregationTypeDetail atd = AggregationTypeDetail.GetByTypeName(typeName);

            if (Aggregation != null && Lex.Eq(atd.TypeName, Aggregation.TypeName))
            {
                return(atd);                                                                               // same as before
            }
            Aggregation = new AggregationDef(typeName);

            return(atd);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Add an item to the type dictionary
        /// </summary>
        /// <param name="summaryType"></param>
        /// <param name="name"></param>
        /// <param name="label"></param>
        /// <param name="format"></param>
        /// <param name="image"></param>
        /// <param name="supportsSubTypes"></param>
        /// <returns></returns>

        public static AggregationTypeDetail AddSummaryTypeItem(
            SummaryTypeEnum summaryType,
            string label,
            SummarizationMethodDelegate summaryDelegate = null,
            string format          = "",
            bool fractionalResult  = false,
            Bitmaps16x16Enum image = Bitmaps16x16Enum.None)
        {
            AggregationTypeDetail item = new AggregationTypeDetail();

            item.Role                    = AggregationRole.DataSummary;
            item.SummaryTypeId           = summaryType;
            item.TypeName                = summaryType.ToString();
            item.FractionalSummaryResult = fractionalResult;
            item.SummarizationMethod     = summaryDelegate;

            AddAggTypeDetailItem(item, label, format, image);

            return(item);
        }
Exemplo n.º 11
0
/// <summary>
/// Construct from type detail info
/// </summary>
/// <param name="atd"></param>

        public AggregationDef(AggregationTypeDetail atd)
        {
            SetFromDetail(atd);
            return;
        }
Exemplo n.º 12
0
        public AggregationTypeDetail Clone()
        {
            AggregationTypeDetail at = (AggregationTypeDetail)this.MemberwiseClone();

            return(at);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Construct from existing AggregationType
        /// </summary>
        /// <param name="aggType"></param>

        public AggregationTypeDetail(AggregationTypeDetail aggType)
        {
            aggType.MemberwiseCopy(this);
            return;
        }