public override Rounding GetRounding(int index) { if (!IsRounding(index)) { return(null); } return(RoundingFactory.Build(ColumnsDef.Single( c => c.Index == index && c.Role == ColumnRole.Value))); }
public int GetMinColumnIndexDefined() { if (ColumnsDef.Count > 0) { return(ColumnsDef.Min(cd => cd.Index)); } else { return(-1); } }
public override Rounding GetRounding(string name) { if (!IsRounding(name)) { return(null); } return(RoundingFactory.Build(ColumnsDef.Single( c => c.Name == name && c.Role == ColumnRole.Value))); }
public int GetMaxColumnOrdinalDefined() { if (ColumnsDef.Count > 0) { return(ColumnsDef.Where(cd => cd.Identifier is ColumnOrdinalIdentifier).Max(cd => ((ColumnOrdinalIdentifier)(cd.Identifier)).Ordinal)); } else { return(-1); } }
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))); }
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); }
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); }
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); }
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)); }
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); }
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); }
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); }
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)); }
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)); }
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); }
public decimal GetTolerance(int index) { var col = ColumnsDef.FirstOrDefault(c => c.Index == index); return(col == null ? DefaultTolerance : col.Tolerance); }