/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="transaction">The transaction to use for creating the response</param>
 public AuthorizeRecurringTransactionResponse(Transaction transaction)
 {
     if (transaction == null)
     {
         _Status       = TransactionStatus.Failed;
         _Transactions = new TransactionCollection();
     }
     else
     {
         _Status       = transaction.TransactionStatus;
         _Transactions = new TransactionCollection();
         _Transactions.Add(transaction);
     }
 }
示例#2
0
        public static TransactionCollection LoadForPayment(Int32 paymentId, int maximumRows, int startRowIndex, string sortExpression)
        {
            //DEFAULT SORT EXPRESSION
            if (string.IsNullOrEmpty(sortExpression))
            {
                sortExpression = "TransactionDate";
            }
            //CREATE THE DYNAMIC SQL TO LOAD OBJECT
            StringBuilder selectQuery = new StringBuilder();

            selectQuery.Append("SELECT");
            if (maximumRows > 0)
            {
                selectQuery.Append(" TOP " + (startRowIndex + maximumRows).ToString());
            }
            selectQuery.Append(" " + Transaction.GetColumnNames(string.Empty));
            selectQuery.Append(" FROM ac_Transactions");
            selectQuery.Append(" WHERE PaymentId = @paymentId");
            selectQuery.Append(" ORDER BY " + sortExpression);
            Database  database      = Token.Instance.Database;
            DbCommand selectCommand = database.GetSqlStringCommand(selectQuery.ToString());

            database.AddInParameter(selectCommand, "@paymentId", System.Data.DbType.Int32, paymentId);
            //EXECUTE THE COMMAND
            TransactionCollection results = new TransactionCollection();
            int thisIndex = 0;
            int rowCount  = 0;

            using (IDataReader dr = database.ExecuteReader(selectCommand))
            {
                while (dr.Read() && ((maximumRows < 1) || (rowCount < maximumRows)))
                {
                    if (thisIndex >= startRowIndex)
                    {
                        Transaction transaction = new Transaction();
                        Transaction.LoadDataReader(transaction, dr);
                        results.Add(transaction);
                        rowCount++;
                    }
                    thisIndex++;
                }
                dr.Close();
            }
            return(results);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 public AuthorizeRecurringTransactionResponse()
 {
     _Status       = TransactionStatus.Failed;
     _Transactions = new TransactionCollection();
 }