Exemplo n.º 1
0
 public void Test_PaymentStatusEnum()
 {
     foreach (PaymentStatusEnum o in PaymentStatusEnum.Options)
     {
         Assert("PaymentStatusEnum could not be retrieved by Code)", o.Equals(PaymentStatusEnum.GetInstance(o.Code)));
     }
     Assert("Function should have been invalid", !PaymentStatusEnum.GetInstance("xxx").IsValid);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Builds a data object from the current row in a data reader..
        /// </summary>
        /// <param name="dataReader">Container for database row.</param>
        /// <returns>Data object built from current row.</returns>
        private static PaymentData GetDataObjectFromReader(SqlDataReader dataReader)
        {
            PaymentData data = new PaymentData();

            if (dataReader.IsDBNull(dataReader.GetOrdinal("PaymentId")))
            {
                data.PaymentId = IdType.UNSET;
            }
            else
            {
                data.PaymentId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("PaymentId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("TournamentId")))
            {
                data.Tournament.TournamentId = IdType.UNSET;
            }
            else
            {
                data.Tournament.TournamentId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("TournamentId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("AuthorizationNumber")))
            {
                data.AuthorizationNumber = StringType.UNSET;
            }
            else
            {
                data.AuthorizationNumber = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("AuthorizationNumber")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("ReferenceNumber")))
            {
                data.ReferenceNumber = StringType.UNSET;
            }
            else
            {
                data.ReferenceNumber = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("ReferenceNumber")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("TransactionNumber")))
            {
                data.TransactionNumber = StringType.UNSET;
            }
            else
            {
                data.TransactionNumber = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("TransactionNumber")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Amount")))
            {
                data.Amount = CurrencyType.UNSET;
            }
            else
            {
                data.Amount = new CurrencyType(dataReader.GetDecimal(dataReader.GetOrdinal("Amount")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("ProcessDate")))
            {
                data.ProcessDate = DateType.UNSET;
            }
            else
            {
                data.ProcessDate = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("ProcessDate")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("PaymentStatus")))
            {
                data.PaymentStatus = PaymentStatusEnum.UNSET;
            }
            else
            {
                data.PaymentStatus = PaymentStatusEnum.GetInstance(dataReader.GetString(dataReader.GetOrdinal("PaymentStatus")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("GolferId")))
            {
                data.Golfer.GolferId = IdType.UNSET;
            }
            else
            {
                data.Golfer.GolferId = new IdType(dataReader.GetInt32(dataReader.GetOrdinal("GolferId")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("CreditCardNumber")))
            {
                data.CreditCard.Number = StringType.UNSET;
            }
            else
            {
                data.CreditCard.Number = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("CreditCardNumber")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("ExpirationDate")))
            {
                data.CreditCard.ExpirationDate = DateType.UNSET;
            }
            else
            {
                data.CreditCard.ExpirationDate = new DateType(Spring2.Core.Util.DateUtil.ToDateTimeFromCreditCardDate(dataReader.GetString(dataReader.GetOrdinal("ExpirationDate"))));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("CardholderName")))
            {
                data.CreditCard.Name = StringType.UNSET;
            }
            else
            {
                data.CreditCard.Name = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("CardholderName")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Address1")))
            {
                data.CreditCard.Address.Address1 = StringType.UNSET;
            }
            else
            {
                data.CreditCard.Address.Address1 = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Address1")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Address2")))
            {
                data.CreditCard.Address.Address2 = StringType.UNSET;
            }
            else
            {
                data.CreditCard.Address.Address2 = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Address2")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("City")))
            {
                data.CreditCard.Address.City = StringType.UNSET;
            }
            else
            {
                data.CreditCard.Address.City = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("City")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("State")))
            {
                data.CreditCard.Address.State = USStateCodeEnum.UNSET;
            }
            else
            {
                data.CreditCard.Address.State = USStateCodeEnum.GetInstance(dataReader.GetString(dataReader.GetOrdinal("State")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("Country")))
            {
                data.CreditCard.Address.Country = StringType.UNSET;
            }
            else
            {
                data.CreditCard.Address.Country = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("Country")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("PostalCode")))
            {
                data.CreditCard.Address.PostalCode = StringType.UNSET;
            }
            else
            {
                data.CreditCard.Address.PostalCode = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("PostalCode")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("ConfirmationCode")))
            {
                data.ConfirmationCode = StringType.UNSET;
            }
            else
            {
                data.ConfirmationCode = StringType.Parse(dataReader.GetString(dataReader.GetOrdinal("ConfirmationCode")));
            }
            if (dataReader.IsDBNull(dataReader.GetOrdinal("PaymentDate")))
            {
                data.PaymentDate = DateType.UNSET;
            }
            else
            {
                data.PaymentDate = new DateType(dataReader.GetDateTime(dataReader.GetOrdinal("PaymentDate")));
            }

            return(data);
        }