public void Begin(Orders orders) { command = connection.CreateCommand(); transaction = connection.BeginTransaction("OrderInsert"); command.Connection = connection; command.Transaction = transaction; OrderInsertData orderAdd = new OrderInsertData(); OrderDetailsInsertData orderDetailsAdd = new OrderDetailsInsertData(); ShoppingCartByGuidDeleteData shoppingCartDelete = new ShoppingCartByGuidDeleteData(); try { //insert order orderAdd.Orders = orders; orderAdd.Add(transaction); //insert order details //Products.Count only applies of using collection rather than array. for (int i = 0; i < orders.OrderDetails.Products.Length; i++) { orderDetailsAdd.OrderDetails.OrderId = orders.OrderId; orderDetailsAdd.OrderDetails.ProductId = orders.OrderDetails.Products[i].ProductId; orderDetailsAdd.OrderDetails.Quantity = orders.OrderDetails.Products[i].Quantity; orderDetailsAdd.Add(transaction); } transaction.Commit(); } catch(Exception ex) { transaction.Rollback("OrderInsert"); throw ex; } }
public OrderInsertDataParameters(Orders orders) { Orders = orders; this.Build(); }
public OrderSelectDataByIdParamters(Orders orders) { Orders = orders; this.Build(); }
public void GetTransactionDetails(Orders order) { GetTransactionDetailsRequestType detailRequest = new GetTransactionDetailsRequestType(); detailRequest.TransactionID = order.TransactionId; //PayPal API version detailRequest.Version = "2.0"; GetTransactionDetailsReq request = new GetTransactionDetailsReq(); request.GetTransactionDetailsRequest = detailRequest; GetTransactionDetailsResponseType response = service.GetTransactionDetails(request); string sErrors = this.CheckForErrors(response); if (sErrors == string.Empty) { PaymentInfoType payment = response.PaymentTransactionDetails.PaymentInfo; order.OrderTotal = GetAmountValue(payment.GrossAmount); order.Tax = GetAmountValue(payment.TaxAmount); IsSubmissionSuccess = true; } else { IsSubmissionSuccess = false; } }