示例#1
0
        public void AddValue(object value)
        {
            Count++;

            if (Value == null && value != null)
            {
                Value = value;
            }
            else
            {
                switch (Aggregate)
                {
                case EAggregate.Sum:
                case EAggregate.Average:
                    Value = DataType.Add(SourceColumn.DataType, Value ?? 0, value);
                    break;

                case EAggregate.Min:
                    var compare = DataType.Compare(SourceColumn.DataType, value, Value);
                    if (compare == DataType.ECompareResult.Less)
                    {
                        Value = value;
                    }
                    break;

                case EAggregate.Max:
                    var compare1 = DataType.Compare(SourceColumn.DataType, value, Value);
                    if (compare1 == DataType.ECompareResult.Greater)
                    {
                        Value = value;
                    }
                    break;
                }
            }
        }
示例#2
0
        public int CompareToNoNulls(DataObject tob)
        {
            DataType ttype = DataType;

            // Strings must be handled as a special case.
            if (ttype is StringType)
            {
                // We must determine the locale to compare against and use that.
                var stype = (StringType)ttype;

                // If there is no locale defined for this type we use the locale in the
                // given type.
                if (stype.Locale == null)
                {
                    ttype = tob.DataType;
                }
            }

            return(ttype.Compare(this, tob));
        }