internal Exception CheckTotalAndFractionDigits(decimal value, int totalDigits, int fractionDigits, bool checkTotal, bool checkFraction)
        {
            decimal maxValue = FacetsChecker.Power(10, totalDigits) - 1; //(decimal)Math.Pow(10, totalDigits) - 1 ;
            int     powerCnt = 0;

            if (value < 0)
            {
                value = Decimal.Negate(value); //Need to compare maxValue allowed against the absolute value
            }
            while (Decimal.Truncate(value) != value)
            { //Till it has a fraction
                value = value * 10;
                powerCnt++;
            }

            if (checkTotal & (value > maxValue || powerCnt > totalDigits))
            {
                return(new LinqToXsdException());
            }
            if (checkFraction & powerCnt > fractionDigits)
            {
                return(new LinqToXsdException());
            }
            return(null);
        }
 public AtomicSimpleTypeValidator(XmlSchemaSimpleType type,
                                  RestrictionFacets facets)
     : base(XmlSchemaDatatypeVariety.Atomic,
            type,
            FacetsChecker.GetFacetsChecker(type.Datatype.TypeCode),
            facets)
 {
 }
 internal SimpleTypeValidator(XmlSchemaDatatypeVariety variety,
                              XmlSchemaSimpleType type,
                              FacetsChecker facetsChecker,
                              RestrictionFacets facets)
 {
     this.restrictionFacets = facets;
     this.facetsChecker     = facetsChecker;
     this.dataType          = type.Datatype;
     this.variety           = variety;
 }