Exemple #1
0
 internal void UpdateLines(PaymentClasses.Payment Payment)
 {
     //Start the transaction.
     StartTransaction();
     try
     {
         SqlCommand Cmd = GetCommand("PAY_Get_Payment_ID");
         Payment.CopyTo(Cmd);
         Cmd.ExecuteNonQuery();
         Payment.PaymentId = (int)Cmd.Parameters["@PaymentId"].Value;
         Cmd = GetCommand("PAY_Update_Item_AccountNumber");
         for (int i = 0; i < Payment.LineItems.Count; i++)
         {
             Insert_Record(Cmd, Payment.PaymentId, Payment.LineItems[i]);
         }
         CompleteTransaction(true);
     }
     catch (SqlException e)
     {
         CompleteTransaction(false);
         if (e.Number != 50000)
         {
             throw;
         }
         throw new BusinessRuleException(e);
     }
     catch
     {
         CompleteTransaction(false);
         throw;
     }
 }
Exemple #2
0
        /// <summary>
        /// Creates the records for the payment in the appropriate tables.  Returns
        /// the paymentID.
        /// </summary>
        /// <param name="Payment">
        /// A record with the complete payment information, with properties including the card, billing
        /// address, line items etc.
        /// </param>
        internal CyberResponse Begin_Transaction(PaymentClasses.Payment Payment)
        {
            //Start the transaction.
            if (LogInsert)
            {
                CSAAWeb.AppLogger.Logger.Log(Payment.ToString());
            }
            StartTransaction();
            try
            {
                CyberResponse Result = null;
                bool          IsNew  = false;
                Payment.PaymentId = Insert_Payment(Payment, out IsNew);
                if (IsNew)
                {
                    Insert_Lines(Payment.PaymentId, Payment.LineItems);
                    Insert_Record(GetCommand("PAY_Update_Payment_User"), Payment.PaymentId, Payment.User);
                }
                if (Payment.Card != null)
                {
                    Insert_Record(GetCommand("PAY_Insert_Card_Detail"), Payment.PaymentId, Payment.Card);
                }
                if (Payment.PaymentType == PaymentTypes.CreditCard)
                {
                    Result = InsertCardRequest(Payment);
                }
                else
                {
                    Result = new CyberResponse();
                }
                CompleteTransaction(true);
                Result.ReceiptNumber = Payment.ReceiptNumber;
                return(Result);
            }
            catch (SqlException e)
            {
                //Modified by Cognizant to log the SqlException - on 03-31-2005
                Logger.Log(e);

                CompleteTransaction(false);
                if (e.Number != 50000)
                {
                    throw;
                }
                throw new BusinessRuleException(e);
            }
            catch
            {
                CompleteTransaction(false);
                throw;
            }
        }
Exemple #3
0
        /// <summary>
        /// Inserts a record into the main payment table.
        /// </summary>
        /// <param name="Payment">The payment to insert.</param>
        /// <param name="IsNew">(bool) output parameter indicating if the record is new or already exists.</param>
        private int Insert_Payment(PaymentClasses.Payment Payment, out bool IsNew)
        {
            SqlCommand Cmd = GetCommand("PAY_Insert_Payment");

            Payment.CopyTo(Cmd);
            Cmd.ExecuteNonQuery();
            IsNew = (bool)Cmd.Parameters["@New"].Value;
            if (Cmd.Parameters["@ReceiptNumber"].Value != DBNull.Value)
            {
                Payment.ReceiptNumber = (string)Cmd.Parameters["@ReceiptNumber"].Value;
            }
            return((int)Cmd.Parameters["@PaymentId"].Value);
        }