public OrderViewModel BeginOrderEntry(OrderViewModel orderViewModel) { // OrderViewModel orderViewModel = new OrderViewModel(); CustomerDataAccessService customerDataAccessService = new CustomerDataAccessService(); // Customer customer = customerDataAccessService.GetCustomerInformation(orderViewModel.Customer.CustomerID); orderViewModel.Customer = customerDataAccessService.GetCustomerInformation(orderViewModel.Customer.CustomerID); OrderDataAccessService orderDataAccessService = new OrderDataAccessService(); orderViewModel.Shippers = orderDataAccessService.GetShippers(); // OrderBusinessService orderBusinessService = new OrderBusinessService(); //orderViewModel.Order = orderBusinessService.InitializeOrderHeader(customer); return orderViewModel; }
public void MigrateUser(string Email, string FirstName, string LastName) { CustomerDataAccessService customerDataAccessService = new CustomerDataAccessService(); customerDataAccessService.MigrateUser(Email, FirstName, LastName); }
public ActionResult CheckoutReview() { int CustomerID = 0; string ErrorMessage = ""; string retMsg = ""; string token = ""; string PayerID = "5678912340"; NVPCodec decoder = new NVPCodec(); token = Session["token"].ToString(); OrderViewModel orderViewModel = new OrderViewModel(); NVPAPICaller payPalCaller = new NVPAPICaller(); CustomerDataAccessService customerDataAccessService = new CustomerDataAccessService(); var Cart = ShoppingCartActions.GetCart(); string CartID = Cart.ShoppingCartId; orderViewModel.Order.CartID = CartID; bool ret = payPalCaller.GetCheckoutDetails(token, ref PayerID, ref decoder, ref retMsg); if (ret) { Session["payerId"] = PayerID; CustomerID = customerDataAccessService.GetCustomerIdNumber(User.Identity.Name); orderViewModel.Order.CustomerID = CustomerID; orderViewModel.Order.OrderDate = Convert.ToDateTime(decoder["TIMESTAMP"].ToString()); orderViewModel.Order.UserName = User.Identity.Name; orderViewModel.Order.FirstName = decoder["FIRSTNAME"].ToString(); orderViewModel.Order.LastName = decoder["LASTNAME"].ToString(); orderViewModel.Order.SheepToStreet = decoder["SHIPTOSTREET"].ToString(); orderViewModel.Order.ShipCity = decoder["SHIPTOCITY"].ToString(); orderViewModel.Order.ShipToState = decoder["SHIPTOSTATE"].ToString(); orderViewModel.Order.ShipPostalCode = decoder["SHIPTOZIP"].ToString(); orderViewModel.Order.ShipCountry = decoder["SHIPTOCOUNTRYCODE"].ToString(); orderViewModel.Order.Email = decoder["EMAIL"].ToString(); orderViewModel.Order.OrderTotal = Convert.ToDouble(decoder["AMT"].ToString()); orderViewModel.Customer.CustomerID = CustomerID; // Verify total payment amount as set on CheckoutStart.aspx. try { decimal paymentAmountOnCheckout = Convert.ToDecimal(Session["payment_amt"].ToString()); decimal paymentAmoutFromPayPal = Convert.ToDecimal(decoder["AMT"].ToString()); if (paymentAmountOnCheckout != paymentAmoutFromPayPal) { ErrorMessage = "Amount%20total%20mismatch."; return RedirectToAction("CheckoutError", ErrorMessage); } } catch (Exception) { ErrorMessage = "Amount%20total%20mismatch."; return RedirectToAction("CheckoutError", ErrorMessage); } //Process the order OrderApplicationService orderApplicationService = new OrderApplicationService(); orderViewModel = orderApplicationService.CreateOrder(orderViewModel); orderViewModel = orderApplicationService.BeginOrderEntry(orderViewModel); Session["currentOrderId"] = orderViewModel.Order.OrderID; } else { RedirectToAction("CheckoutError", retMsg); } return View("CheckoutReview", orderViewModel); }