示例#1
0
        public override Rounding GetRounding(int index)
        {
            if (!IsRounding(index))
            {
                return(null);
            }

            return(RoundingFactory.Build(ColumnsDef.Single(
                                             c => c.Index == index &&
                                             c.Role == ColumnRole.Value)));
        }
示例#2
0
 public int GetMinColumnIndexDefined()
 {
     if (ColumnsDef.Count > 0)
     {
         return(ColumnsDef.Min(cd => cd.Index));
     }
     else
     {
         return(-1);
     }
 }
示例#3
0
        public override Rounding GetRounding(string name)
        {
            if (!IsRounding(name))
            {
                return(null);
            }

            return(RoundingFactory.Build(ColumnsDef.Single(
                                             c => c.Name == name &&
                                             c.Role == ColumnRole.Value)));
        }
示例#4
0
 public int GetMaxColumnOrdinalDefined()
 {
     if (ColumnsDef.Count > 0)
     {
         return(ColumnsDef.Where(cd => cd.Identifier is ColumnOrdinalIdentifier).Max(cd => ((ColumnOrdinalIdentifier)(cd.Identifier)).Ordinal));
     }
     else
     {
         return(-1);
     }
 }
示例#5
0
        public override Rounding GetRounding(int index)
        {
            if (!IsRounding(index))
            {
                return(null);
            }

            return(RoundingFactory.Build(ColumnsDef.Single(
                                             c => (c.Identifier as ColumnOrdinalIdentifier)?.Ordinal == index &&
                                             c.Role == ColumnRole.Value)));
        }
示例#6
0
        private bool IsType(int index, ColumnType type)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Type != type))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Type == type))
            {
                return(true);
            }

            return(IsValue(index) && ValuesDefaultType == type);
        }
示例#7
0
        public bool IsBoolean(int index)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Type != ColumnType.Boolean))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Type == ColumnType.Boolean))
            {
                return(true);
            }

            return(false);
        }
示例#8
0
        public bool IsDateTime(int index)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Type != ColumnType.DateTime))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Type == ColumnType.DateTime))
            {
                return(true);
            }

            return(false);
        }
示例#9
0
        public bool IsNumeric(int index)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Type != ColumnType.Numeric))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Type == ColumnType.Numeric))
            {
                return(true);
            }

            return(IsValue(index));
        }
示例#10
0
        protected override bool IsType(int index, ColumnType type)
        {
            if (ColumnsDef.Any(c => (c.Identifier as ColumnOrdinalIdentifier)?.Ordinal == index && c.Type != type))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => (c.Identifier as ColumnOrdinalIdentifier)?.Ordinal == index && c.Type == type))
            {
                return(true);
            }

            return(IsValue(index) && ValuesDefaultType == type);
        }
示例#11
0
        protected override bool IsValue(int index)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Role != ColumnRole.Value))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Role == ColumnRole.Value))
            {
                return(true);
            }

            switch (KeysDef)
            {
            case KeysChoice.First:
                if (index == 0)
                {
                    return(false);
                }
                break;

            case KeysChoice.AllExpectLast:
                if (index != GetLastColumnIndex())
                {
                    return(false);
                }
                break;

            case KeysChoice.All:
                return(false);
            }

            switch (ValuesDef)
            {
            case ValuesChoice.AllExpectFirst:
                return(index != 0);

            case ValuesChoice.Last:
                return(index == GetLastColumnIndex());

            case ValuesChoice.None:
                return(false);
            }

            return(false);
        }
示例#12
0
        protected override bool IsType(string name, ColumnType type)
        {
            if (ColumnsDef.Any(c => c.Name == name && c.Type != type))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Name == name && c.Type == type))
            {
                return(true);
            }

            if (IsKey(name))
            {
                return(type == ColumnType.Text);
            }

            return(IsValue(name) && ValuesDefaultType == type);
        }
示例#13
0
        public Tolerance GetTolerance(int index)
        {
            if (!IsNumeric(index) && !IsDateTime(index))
            {
                return(null);
            }

            var col = ColumnsDef.FirstOrDefault(c => c.Index == index);

            if (col == null || !col.IsToleranceSpecified)
            {
                if (IsNumeric(index))
                {
                    return(DefaultTolerance);
                }
                else
                {
                    return(DateTimeTolerance.None);
                }
            }

            return(ToleranceFactory.Instantiate(col));
        }
示例#14
0
        public override Tolerance GetTolerance(string name)
        {
            if (GetColumnType(name) != ColumnType.Numeric && GetColumnType(name) != ColumnType.DateTime)
            {
                return(null);
            }

            var col = ColumnsDef.FirstOrDefault(c => c.Name == name);

            if (col == null || !col.IsToleranceSpecified)
            {
                if (IsNumeric(name))
                {
                    return(DefaultTolerance);
                }
                else
                {
                    return(DateTimeTolerance.None);
                }
            }

            return(ToleranceFactory.Instantiate(col));
        }
示例#15
0
        public bool IsValue(int index)
        {
            if (ColumnsDef.Any(c => c.Index == index && c.Role != ColumnRole.Value))
            {
                return(false);
            }

            if (ColumnsDef.Any(c => c.Index == index && c.Role == ColumnRole.Value))
            {
                return(true);
            }

            switch (ValuesDef)
            {
            case ValuesChoice.AllExpectFirst:
                return(index != 0);

            case ValuesChoice.Last:
                return(index == GetLastColumnIndex());
            }

            return(false);
        }
示例#16
0
        public decimal GetTolerance(int index)
        {
            var col = ColumnsDef.FirstOrDefault(c => c.Index == index);

            return(col == null ? DefaultTolerance : col.Tolerance);
        }