Exemplo n.º 1
0
 /// <summary>
 ///     Returns a DECIMAL parameter value.
 /// </summary>
 /// <param name="value">The parameter value</param>
 /// <param name="precision">The parameter precision.</param>
 /// <param name="scale">The parameter scale.</param>
 /// <returns>A <see cref="IDbParameterValue" />.</returns>
 public IDbParameterValue Decimal(decimal?value, TSqlDecimalPrecision precision, TSqlDecimalScale scale)
 {
     if (!value.HasValue)
     {
         return(new TSqlDecimalNullValue(precision, scale));
     }
     return(new TSqlDecimalValue(value.Value, precision, scale));
 }
Exemplo n.º 2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TSqlDecimalNullValue" /> class.
        /// </summary>
        /// <param name="precision">The maximum total number of decimal digits that will be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.</param>
        /// <param name="scale">The maximum number of decimal digits that can be stored to the right of the decimal point. Scale must be a value from 0 through p. The default scale is 0.</param>
        public TSqlDecimalNullValue(TSqlDecimalPrecision precision, TSqlDecimalScale scale)
        {
            if (scale > precision)
            {
                throw new ArgumentOutOfRangeException("scale", scale,
                                                      string.Format("The scale ({0}) must be less than or equal to the precision ({1}).", scale, precision));
            }

            _precision = precision;
            _scale     = scale;
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Returns a DECIMAL parameter value.
 /// </summary>
 /// <param name="value">The parameter value</param>
 /// <param name="precision">The parameter precision.</param>
 /// <returns>A <see cref="IDbParameterValue" />.</returns>
 public IDbParameterValue Decimal(decimal?value, TSqlDecimalPrecision precision)
 {
     return(Decimal(value, precision, TSqlDecimalScale.Default));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Compares this instance to a <see cref="TSqlDecimalPrecision"/>.
 /// </summary>
 /// <param name="other">The other instance.</param>
 /// <returns>
 /// A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes <paramref name="other"/> in the sort order.  Zero This instance occurs in the same position in the sort order as <paramref name="other"/>. Greater than zero This instance follows <paramref name="other"/> in the sort order.
 /// </returns>
 public int CompareTo(TSqlDecimalPrecision other)
 {
     return(_value.CompareTo(other));
 }