Ejemplo n.º 1
0
 public static bool AddUpdateOrderPayment(Guid orderID, IOrderPaymentItem paymentItem)
 {
     bool returnValue = false;
     SqlParameter[] param = prepareParameters(orderID, paymentItem);
     returnValue = SQLWrapper.ExecuteStoredProcedure("ORD_AddUpdateOrderPayment", param);
     return returnValue;
 }
Ejemplo n.º 2
0
 public static bool AddUpdateOrderPayment(Guid orderID, IOrderPaymentItem paymentItem,ref SQLWrapper sw)
 {
     SqlParameter[] param = prepareParameters(orderID,paymentItem);
     return sw.ExecuteStoredProcedureInTransaction("ORD_AddUpdateOrderPayment", param);
 }
Ejemplo n.º 3
0
 private static void setParameterValues(ref SqlParameter[] param, Guid orderID, IOrderPaymentItem paymentItem)
 {
     param[0].Value = orderID;
     param[1].Value = paymentItem.Sequence;
     param[2].Value = paymentItem.PaymentDate;
     param[3].Value = paymentItem.Amount;
     param[4].Value = paymentItem.PaymentRemarks;
     switch (paymentItem.PaymentType)
     {
         case OrderPaymentTypes.GiftCertificate:
             {
                 GiftCertificatePayment itm = (GiftCertificatePayment)paymentItem;
                 if (itm.GCInfo == null)
                 {
                     throw new Exception("Invalid gift card information for the payment.");
                 }
                 param[5].Value = ""; // cc number
                 param[6].Value = ""; // cc name
                 param[7].Value = DBNull.Value; // cc expiry date
                 param[8].Value = ""; // bank name
                 param[9].Value = ""; // owner name
                 param[10].Value = 0; // amount
                 param[11].Value = ""; // check number
                 param[12].Value = itm.GCInfo.Number;
                 param[13].Value = itm.GCInfo.TotalValue;
                 param[14].Value = itm.GCInfo.AvailableBalance;
                 break;
             }
         case OrderPaymentTypes.CreditCard:
             {
                 CreditCardPayment itm = (CreditCardPayment)paymentItem;
                 if (itm.CCInfo == null)
                 {
                     throw new Exception("Invalid credit card information for the payment.");
                 }
                 param[5].Value = itm.CCInfo.CardNumber;
                 param[6].Value = itm.CCInfo.CardName;
                 param[7].Value = itm.CCInfo.CardExpiryDate;
                 param[8].Value = ""; // bank name
                 param[9].Value = ""; // owner name
                 param[10].Value = 0; // amount
                 param[11].Value = ""; // check number
                 break;
             }
         case OrderPaymentTypes.Check:
             {
                 CheckPayment itm = (CheckPayment)paymentItem;
                 if (itm.ChkInfo == null)
                 {
                     throw new Exception("Invalid check information for the payment.");
                 }
                 param[5].Value = ""; // cc number
                 param[6].Value = ""; // cc name
                 param[7].Value = DBNull.Value; // cc expiry date
                 param[8].Value = itm.ChkInfo.BankName;
                 param[9].Value = itm.ChkInfo.AccountName;
                 param[10].Value = itm.ChkInfo.CheckAmount;
                 param[11].Value = itm.ChkInfo.CheckNumber;
                 param[12].Value = ""; // gc number
                 param[13].Value = 0; // total value
                 param[14].Value = 0; // available value
                 break;
             }
         default:
             {
                 OrderPaymentItem itm = (OrderPaymentItem)paymentItem;
                 param[5].Value = ""; // cc number
                 param[6].Value = ""; // cc name
                 param[7].Value = DBNull.Value; // cc expiry date
                 param[8].Value = ""; // bank name
                 param[9].Value = ""; // owner name
                 param[10].Value = 0; // amount
                 param[11].Value = ""; // check number
                 param[12].Value = ""; // gc number
                 param[13].Value = 0; // total value
                 param[14].Value = 0; // available value
                 break;
             }
     }
 }
Ejemplo n.º 4
0
 private static SqlParameter[] prepareParameters(Guid orderID, IOrderPaymentItem paymentItem)
 {
     SqlParameter[] param  =
     {
         new SqlParameter("OrderID",typeof(Guid )),
         new SqlParameter("Sequence",typeof(int )),
         new SqlParameter("PaymentDate",typeof(DateTime )),
         new SqlParameter("Amount",typeof(decimal )),
         new SqlParameter("PaymentRemarks",typeof(string )),
         new SqlParameter("PaymentType",typeof(int )),
         new SqlParameter("CCNumber",typeof(string )),
         new SqlParameter("CCName",typeof(string )),
         new SqlParameter("CCExpiryDate",typeof(DateTime )),
         new SqlParameter("CCOwnerName",typeof(string )),
         new SqlParameter("CHKBankName",typeof(string )),
         new SqlParameter("CHKOwnerName",typeof(string )),
         new SqlParameter("CHKAmount",typeof(decimal )),
         new SqlParameter("CHKNumber",typeof(string )),
         new SqlParameter("GCNumber",typeof(string )),
         new SqlParameter("GCTotalValue",typeof(decimal )),
         new SqlParameter("GCAvailableValue",typeof(decimal ))
     };
     setParameterValues(ref param, orderID,paymentItem );
     return param;
 }