public ActionResult SubmitOrder(string sku, int count = 1, int shippingTypeId = -1, int c = -1, string viewName = "SubmitOrder") { ShoppingCartInfo cartInfo = new ShoppingCartInfo(); if (string.IsNullOrWhiteSpace(sku)) { int userId = (base.currentUser == null) ? -1 : base.currentUser.UserID; cartInfo = new ShoppingCartHelper(userId).GetShoppingCart(); } else { Maticsoft.BLL.Shop.Products.SKUInfo info2 = new Maticsoft.BLL.Shop.Products.SKUInfo(); Maticsoft.BLL.Shop.Products.ProductInfo info3 = new Maticsoft.BLL.Shop.Products.ProductInfo(); Maticsoft.Model.Shop.Products.SKUInfo modelBySKU = info2.GetModelBySKU(sku); if (modelBySKU == null) { return new RedirectResult("/Error"); } Maticsoft.Model.Shop.Products.ProductInfo productInfo = info3.GetModel(modelBySKU.ProductId); if (productInfo == null) { return new RedirectResult("/Error"); } Maticsoft.Model.Shop.Products.ProductInfo proSaleInfo = null; if (c > 0) { proSaleInfo = info3.GetProSaleModel(c); if (proSaleInfo == null) { return new RedirectResult("/Error"); } if (DateTime.Now > proSaleInfo.ProSalesEndDate) { return base.RedirectToAction("ProSaleDetail", "Product", new { area = "Shop", id = c }); } } cartInfo = this.GetCartInfo4SKU(productInfo, modelBySKU, count, proSaleInfo); } if (cartInfo.Items.Count < 1) { return (ActionResult) this.Redirect(((dynamic) base.ViewBag).BasePath + "ShoppingCart/CartInfo"); } try { cartInfo = new SalesRuleProduct().GetWholeSale(cartInfo); } catch (Exception exception) { throw exception; } Maticsoft.Model.Shop.Shipping.ShippingType model = this._shippingTypeManage.GetModel(shippingTypeId); ((dynamic) base.ViewBag).Freight = cartInfo.CalcFreight(model); ((dynamic) base.ViewBag).TotalQuantity = cartInfo.Quantity; ((dynamic) base.ViewBag).TotalAdjustedPrice = cartInfo.TotalAdjustedPrice; ((dynamic) base.ViewBag).ProductTotal = cartInfo.TotalSellPrice; ((dynamic) base.ViewBag).TotalPrice = cartInfo.TotalAdjustedPrice + ((dynamic) base.ViewBag).Freight; ((dynamic) base.ViewBag).TotalPromPrice = cartInfo.TotalSellPrice - cartInfo.TotalAdjustedPrice; ((dynamic) base.ViewBag).Title = "提交订单"; return base.View(viewName, cartInfo); }
public ActionResult ShowPayAndShip(int payId = -1, int shipId = -1, string sku = new string(), int count = 1, int c = -1, string viewName = "_ShowPayAndShip") { ShoppingCartInfo shoppingCart; PayAndShip model = new PayAndShip { ListPaymentMode = PaymentModeManage.GetPaymentModes() }; if (payId > 0) { model.CurrentPaymentMode = PaymentModeManage.GetPaymentModeById(payId); } else if ((model.ListPaymentMode != null) && (model.ListPaymentMode.Count > 0)) { model.CurrentPaymentMode = model.ListPaymentMode[0]; model.ListShippingType = this._shippingTypeManage.GetListByPay(model.CurrentPaymentMode.ModeId); } else { PaymentModeInfo info = new PaymentModeInfo { ModeId = -1, Name = "未选择支付方式" }; model.CurrentPaymentMode = info; } if (shipId > 0) { model.CurrentShippingType = this._shippingTypeManage.GetModelByCache(shipId); } else if ((model.ListShippingType != null) && (model.ListShippingType.Count > 0)) { model.CurrentShippingType = model.ListShippingType[0]; } else { Maticsoft.Model.Shop.Shipping.ShippingType type = new Maticsoft.Model.Shop.Shipping.ShippingType { ModeId = -1, Name = "未选择配送方式" }; model.CurrentShippingType = type; } if (string.IsNullOrWhiteSpace(sku)) { int userId = (base.currentUser == null) ? -1 : base.currentUser.UserID; shoppingCart = new ShoppingCartHelper(userId).GetShoppingCart(); } else { Maticsoft.BLL.Shop.Products.SKUInfo info3 = new Maticsoft.BLL.Shop.Products.SKUInfo(); Maticsoft.BLL.Shop.Products.ProductInfo info4 = new Maticsoft.BLL.Shop.Products.ProductInfo(); Maticsoft.Model.Shop.Products.SKUInfo modelBySKU = info3.GetModelBySKU(sku); if (modelBySKU == null) { ((dynamic) base.ViewBag).Freight = 0; return base.View(viewName, model); } Maticsoft.Model.Shop.Products.ProductInfo productInfo = info4.GetModel(modelBySKU.ProductId); if (productInfo == null) { ((dynamic) base.ViewBag).Freight = 0; return base.View(viewName, model); } Maticsoft.Model.Shop.Products.ProductInfo proSaleInfo = null; if (c > 0) { proSaleInfo = info4.GetProSaleModel(c); if (proSaleInfo == null) { ((dynamic) base.ViewBag).Freight = 0; return base.View(viewName, model); } } shoppingCart = this.GetCartInfo4SKU(productInfo, modelBySKU, count, proSaleInfo); } ((dynamic) base.ViewBag).Freight = shoppingCart.CalcFreight(model.CurrentShippingType); return base.View(viewName, model); }