Exemple #1
0
 public void NullSafeSet(IDbCommand cmd, object obj, int index)
 {
     if (obj == null)
     {
         ((IDataParameter)cmd.Parameters[index]).Value = DBNull.Value;
     }
     else
     {
         MonetaryAmount anyCurrency = (MonetaryAmount)obj;
         MonetaryAmount amountInUSD =
             MonetaryAmount.Convert(anyCurrency, "USD");
         ((IDataParameter)cmd.Parameters[index]).Value = amountInUSD.Value;
     }
 }