Пример #1
0
 public void NullSafeSet(DbCommand statement, object value, int index, ISessionImplementor session)
 {
     if (value == null)
     {
         statement.Parameters[index].Value     = DBNull.Value;
         statement.Parameters[index + 1].Value = DBNull.Value;
     }
     else
     {
         MonetaryAmount currency = (MonetaryAmount)value;
         statement.Parameters[index].Value     = currency.Value;
         statement.Parameters[index + 1].Value = currency.Currency;
     }
 }
 public void NullSafeSet(IDbCommand statement,
                         object value,
                         int index)
 {
     if (value == null)
     {
         ((IDbDataParameter)statement.Parameters[index]).Value     = DBNull.Value;
         ((IDbDataParameter)statement.Parameters[index + 1]).Value = DBNull.Value;
     }
     else
     {
         MonetaryAmount currency = (MonetaryAmount)value;
         ((IDbDataParameter)statement.Parameters[index]).Value     = currency.Value;
         ((IDbDataParameter)statement.Parameters[index + 1]).Value = currency.Currency;
     }
 }
Пример #3
0
        // ********************** Common Methods ********************** //

        public override bool Equals(Object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (!(o is MonetaryAmount))
            {
                return(false);
            }

            MonetaryAmount monetaryAmount = (MonetaryAmount)o;

            if (!currency.Equals(monetaryAmount.currency))
            {
                return(false);
            }
            if (!value.Equals(monetaryAmount.value))
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
		public static MonetaryAmount Convert(MonetaryAmount amount,
		                                     string toCurrency)
		{
			// TODO: This requires some conversion magic and is therefore broken
			return new MonetaryAmount(amount.Value, toCurrency);
		}
Пример #5
0
 public static MonetaryAmount Convert(MonetaryAmount amount,
                                      string toCurrency)
 {
     // TODO: This requires some conversion magic and is therefore broken
     return(new MonetaryAmount(amount.Value, toCurrency));
 }