コード例 #1
0
ファイル: Supply.cs プロジェクト: huaminglee/myyyyshop
 private void ShowInfo()
 {
     DataSet statisticsSupply = new SupplierInfo().GetStatisticsSupply(base.SupplierId);
     int? nullable = statisticsSupply.Tables[0].Rows[0].Field<int?>("ToalQuantity");
     decimal? nullable2 = statisticsSupply.Tables[0].Rows[0].Field<decimal?>("ToalPrice");
     if (!nullable.HasValue)
     {
         nullable = 0;
     }
     if (!nullable2.HasValue)
     {
         nullable2 = 0M;
     }
     this.lblRemainQuantity.Text = nullable.Value.ToString();
     this.lblRemainPrice.Text = nullable2.Value.ToString("C2");
     int? nullable3 = statisticsSupply.Tables[0].Rows[1].Field<int?>("ToalQuantity");
     decimal? nullable4 = statisticsSupply.Tables[0].Rows[1].Field<decimal?>("ToalPrice");
     if (!nullable3.HasValue)
     {
         nullable3 = 0;
     }
     if (!nullable4.HasValue)
     {
         nullable4 = 0M;
     }
     this.lblSoldQuantity.Text = nullable3.Value.ToString();
     this.lblSoldPrice.Text = nullable4.Value.ToString("C2");
     int? nullable8 = nullable + nullable3;
     this.lblToalQuantity.Text = nullable8.Value.ToString();
     decimal? nullable12 = nullable2 + nullable4;
     this.lblToalPrice.Text = nullable12.Value.ToString("C2");
 }
コード例 #2
0
ファイル: SalesLine.cs プロジェクト: huaminglee/myyyyshop
 private void ShowInfo()
 {
     DataSet statisticsSales = new SupplierInfo().GetStatisticsSales(base.SupplierId, Globals.SafeInt(this.drpYear.SelectedValue, DateTime.Now.Year));
     string strXML = this.CreateXmlStr(statisticsSales, this.SalesType);
     this.litChart.Text = FusionCharts.RenderChart("/FusionCharts/Line.swf", "", strXML, "FusionChartsLine", "900", "500", false, true);
 }
コード例 #3
0
ファイル: OrderHandler.cs プロジェクト: huaminglee/myyyyshop
 private ShoppingCartInfo GetShoppingCart(HttpContext context, User userBuyer, out ShoppingCartHelper shoppingCartHelper)
 {
     ShoppingCartInfo cartInfo = null;
     string str = context.Request.Form["SkuInfos"];
     if (string.IsNullOrWhiteSpace(str))
     {
         shoppingCartHelper = new ShoppingCartHelper(userBuyer.UserID);
         cartInfo = shoppingCartHelper.GetShoppingCart();
     }
     else
     {
         JsonArray array;
         shoppingCartHelper = null;
         try
         {
             array = JsonConvert.Import<JsonArray>(str);
         }
         catch (Exception)
         {
             throw;
         }
         if ((array == null) || (array.Length < 1))
         {
             return null;
         }
         JsonObject obj2 = array.GetObject(0);
         string sku = obj2["SKU"].ToString();
         int num = Globals.SafeInt(obj2["Count"].ToString(), 1);
         int id = Globals.SafeInt(obj2["ProSales"].ToString(), -1);
         Maticsoft.Model.Shop.Products.SKUInfo modelBySKU = this._skuInfoManage.GetModelBySKU(sku);
         if (modelBySKU == null)
         {
             return null;
         }
         Maticsoft.Model.Shop.Products.ProductInfo model = this._productInfoManage.GetModel(modelBySKU.ProductId);
         if (model == null)
         {
             return null;
         }
         ShoppingCartItem itemInfo = new ShoppingCartItem {
             MarketPrice = model.MarketPrice.HasValue ? model.MarketPrice.Value : 0M,
             Name = model.ProductName,
             Quantity = num,
             SellPrice = modelBySKU.SalePrice,
             AdjustedPrice = modelBySKU.SalePrice,
             SKU = modelBySKU.SKU,
             ProductId = modelBySKU.ProductId,
             UserId = userBuyer.UserID
         };
         if (id > 0)
         {
             Maticsoft.Model.Shop.Products.ProductInfo proSaleModel = this._productInfoManage.GetProSaleModel(id);
             if (proSaleModel == null)
             {
                 return null;
             }
             if (DateTime.Now > proSaleModel.ProSalesEndDate)
             {
                 throw new ArgumentNullException("活动已过期");
             }
             itemInfo.AdjustedPrice = proSaleModel.ProSalesPrice;
         }
         List<Maticsoft.Model.Shop.Products.SKUItem> sKUItemsBySkuId = this._skuInfoManage.GetSKUItemsBySkuId(modelBySKU.SkuId);
         if ((sKUItemsBySkuId != null) && (sKUItemsBySkuId.Count > 0))
         {
             itemInfo.SkuValues = new string[sKUItemsBySkuId.Count];
             int index = 0;
             sKUItemsBySkuId.ForEach(delegate (Maticsoft.Model.Shop.Products.SKUItem xx) {
                 itemInfo.SkuValues[index++] = xx.ValueStr;
                 if (!string.IsNullOrWhiteSpace(xx.ImageUrl))
                 {
                     itemInfo.SkuImageUrl = xx.ImageUrl;
                 }
             });
         }
         itemInfo.ThumbnailsUrl = model.ThumbnailUrl1;
         itemInfo.CostPrice = modelBySKU.CostPrice.HasValue ? modelBySKU.CostPrice.Value : 0M;
         itemInfo.Weight = modelBySKU.Weight.HasValue ? modelBySKU.Weight.Value : 0;
         Maticsoft.Model.Shop.Supplier.SupplierInfo modelByCache = new Maticsoft.BLL.Shop.Supplier.SupplierInfo().GetModelByCache(model.SupplierId);
         if (modelByCache != null)
         {
             itemInfo.SupplierId = new int?(modelByCache.SupplierId);
             itemInfo.SupplierName = modelByCache.Name;
         }
         cartInfo = new ShoppingCartInfo();
         cartInfo.Items.Add(itemInfo);
     }
     try
     {
         cartInfo = new SalesRuleProduct().GetWholeSale(cartInfo);
     }
     catch (Exception)
     {
         return null;
     }
     return cartInfo;
 }
コード例 #4
0
ファイル: Show.cs プロジェクト: huaminglee/myyyyshop
 private void ShowInfo()
 {
     Maticsoft.Model.Shop.Supplier.SupplierInfo model = new Maticsoft.BLL.Shop.Supplier.SupplierInfo().GetModel(base.SupplierId);
     if (model != null)
     {
         this.lblSupplierId.Text = model.SupplierId.ToString();
         this.lblName.Text = model.Name;
         this.lblIntroduction.Text = model.Introduction;
         if (model.RegisteredCapital.HasValue)
         {
             this.lblRegisteredCapital.Text = model.RegisteredCapital.ToString();
         }
         this.lblTelPhone.Text = model.TelPhone;
         this.lblCellPhone.Text = model.CellPhone;
         this.lblContactMail.Text = model.ContactMail;
         if (model.RegionId.HasValue)
         {
             this.RegionID.Region_iID = model.RegionId.Value;
         }
         this.lblAddress.Text = model.Address;
         this.lblRemark.Text = model.Remark;
         this.lblContact.Text = model.Contact;
         this.lblUserName.Text = model.UserName;
         if (model.EstablishedDate.HasValue)
         {
             this.lblEstablishedDate.Text = model.EstablishedDate.ToString();
         }
         if (model.EstablishedCity.HasValue)
         {
             this.RegionEstablishedCity.Region_iID = model.EstablishedCity.Value;
         }
         this.lblLOGO.Text = model.LOGO;
         this.lblFax.Text = model.Fax;
         this.lblPostCode.Text = model.PostCode;
         this.lblHomePage.Text = model.HomePage;
         this.lblArtiPerson.Text = model.ArtiPerson;
         this.lblEnteRank.Text = this.GetSuppRank(model.Rank);
         this.lblEnteClassName.Text = this.GetEnteClassName(model.CategoryId);
         if (model.CompanyType.HasValue)
         {
             this.lblCompanyType.Text = this.GetCompanyType(model.CompanyType);
         }
         this.lblBusinessLicense.Text = model.BusinessLicense;
         this.lblTaxNumber.Text = model.TaxNumber;
         this.lblAccountBank.Text = model.AccountBank;
         this.lblAccountInfo.Text = model.AccountInfo;
         this.lblServicePhone.Text = model.ServicePhone;
         this.lblQQ.Text = model.QQ;
         this.lblMSN.Text = model.MSN;
         this.lblStatus.Text = this.GetStatus(model.Status);
         this.lblCreatedDate.Text = model.CreatedDate.ToString();
         this.lblCreatedUserID.Text = model.UserName;
         if (model.UpdatedDate.HasValue)
         {
             this.lblUpdatedDate.Text = model.UpdatedDate.ToString();
         }
         User user = new User();
         if (model.UpdatedUserId.HasValue)
         {
             this.lblUpdatedUserID.Text = user.GetUserNameByCache(model.UpdatedUserId.Value);
         }
         this.lblBalance.Text = model.Balance.ToString("F2");
         this.lblAgentID.Text = model.AgentId.ToString();
     }
 }
コード例 #5
0
ファイル: CouponList.cs プロジェクト: huaminglee/myyyyshop
 public string GetSupplierName(object target)
 {
     string str = string.Empty;
     if (!StringPlus.IsNullOrEmpty(target))
     {
         int supplierId = Globals.SafeInt(target, 0);
         Maticsoft.Model.Shop.Supplier.SupplierInfo model = new Maticsoft.BLL.Shop.Supplier.SupplierInfo().GetModel(supplierId);
         str = (model == null) ? "" : model.Name;
     }
     return str;
 }
コード例 #6
0
ファイル: OrderHandler.cs プロジェクト: huaminglee/myyyyshop
 private string SubmitOrder(HttpContext context)
 {
     ShoppingCartInfo info2;
     Action<ShoppingCartItem> action = null;
     ShoppingCartHelper shoppingCartHelper;
     OrderInfo mainOrder;
     Maticsoft.Model.Shop.Order.OrderItems tmpOrderItem;
     JsonObject obj2 = new JsonObject();
     PaymentModeInfo paymentModeInfo = this.GetPaymentModeInfo(context);
     if (paymentModeInfo == null)
     {
         obj2.Accumulate("STATUS", "NOPAYMENTMODEINFO");
         return obj2.ToString();
     }
     User buyerUserInfo = this.GetBuyerUserInfo(context);
     if (buyerUserInfo == null)
     {
         obj2.Accumulate("STATUS", "NOLOGIN");
         return obj2.ToString();
     }
     if (buyerUserInfo.UserType == "AA")
     {
         obj2.Accumulate("STATUS", "UNAUTHORIZED");
         return obj2.ToString();
     }
     try
     {
         info2 = this.GetShoppingCart(context, buyerUserInfo, out shoppingCartHelper);
     }
     catch (ArgumentNullException)
     {
         obj2.Accumulate("STATUS", "PROSALEEXPIRED");
         return obj2.ToString();
     }
     if (((info2 == null) || (info2.Items == null)) || (info2.Items.Count < 1))
     {
         obj2.Accumulate("STATUS", "NOSHOPPINGCARTINFO");
         return obj2.ToString();
     }
     List<ShoppingCartItem> list = new List<ShoppingCartItem>();
     foreach (ShoppingCartItem item in info2.Items)
     {
         if (item.Quantity > this._skuInfoManage.GetStockBySKU(item.SKU))
         {
             list.Add(item);
         }
     }
     if (list.Count > 0)
     {
         obj2.Accumulate("STATUS", "NOSTOCK");
         obj2.Accumulate("DATA", list);
         if (shoppingCartHelper != null)
         {
             if (action == null)
             {
                 action = delegate (ShoppingCartItem info) {
                     shoppingCartHelper.RemoveItem(info.ItemId);
                 };
             }
             list.ForEach(action);
         }
         return obj2.ToString();
     }
     Maticsoft.Model.Shop.Shipping.ShippingAddress shippingAddress = this.GetShippingAddress(context);
     if (shippingAddress == null)
     {
         obj2.Accumulate("STATUS", "NOSHIPPINGADDRESS");
         return obj2.ToString();
     }
     Maticsoft.Model.Ms.Regions modelByCache = this._regionManage.GetModelByCache(shippingAddress.RegionId);
     if (modelByCache == null)
     {
         obj2.Accumulate("STATUS", "NOREGIONINFO");
         return obj2.ToString();
     }
     Maticsoft.Model.Shop.Shipping.ShippingType shippingType = this.GetShippingType(context);
     if (shippingType == null)
     {
         obj2.Accumulate("STATUS", "NOSHIPPINGTYPE");
         return obj2.ToString();
     }
     mainOrder = new OrderInfo {
         CreatedDate = DateTime.Now,
         OrderCode = mainOrder.CreatedDate.ToString("yyyyMMddHHmmssfff"),
         PaymentTypeId = paymentModeInfo.ModeId,
         PaymentTypeName = paymentModeInfo.Name,
         PaymentGateway = paymentModeInfo.Gateway,
         Weight = new int?(info2.TotalWeight),
         FreightAdjusted = mainOrder.FreightActual = mainOrder.Freight = new decimal?(info2.CalcFreight(shippingType)),
         CouponAmount = 0
     };
     string couponCode = context.Request.Form["Coupon"];
     Maticsoft.Model.Shop.Coupon.CouponInfo couponInfo = this.couponBll.GetCouponInfo(couponCode, false);
     if (couponInfo != null)
     {
         mainOrder.CouponAmount = new decimal?(couponInfo.CouponPrice);
         mainOrder.CouponCode = couponInfo.CouponCode;
         mainOrder.CouponName = couponInfo.CouponName;
         mainOrder.CouponValue = new decimal?(couponInfo.CouponPrice);
         mainOrder.CouponValueType = 1;
     }
     mainOrder.ProductTotal = info2.TotalSellPrice;
     decimal totalCostPrice = info2.TotalCostPrice;
     mainOrder.OrderCostPrice = totalCostPrice + mainOrder.FreightActual;
     mainOrder.OrderTotal = info2.TotalSellPrice + mainOrder.Freight.Value;
     mainOrder.Amount = (info2.TotalAdjustedPrice + mainOrder.FreightAdjusted.Value) - mainOrder.CouponAmount.Value;
     mainOrder.OrderType = 1;
     mainOrder.OrderStatus = 0;
     mainOrder.BuyerID = buyerUserInfo.UserID;
     mainOrder.BuyerName = buyerUserInfo.UserName;
     mainOrder.BuyerEmail = string.IsNullOrWhiteSpace(buyerUserInfo.Email) ? "*****@*****.**" : buyerUserInfo.Email;
     mainOrder.BuyerCellPhone = buyerUserInfo.Phone;
     Dictionary<int, List<Maticsoft.Model.Shop.Order.OrderItems>> dicSuppOrderItems = new Dictionary<int, List<Maticsoft.Model.Shop.Order.OrderItems>>();
     int orderPoint = 0;
     info2.Items.ForEach(delegate (ShoppingCartItem item) {
         Maticsoft.Model.Shop.Order.OrderItems items = new Maticsoft.Model.Shop.Order.OrderItems {
             Name = item.Name,
             SKU = item.SKU,
             Quantity = item.Quantity,
             ShipmentQuantity = item.Quantity,
             ThumbnailsUrl = item.ThumbnailsUrl,
             Points = item.Points,
             Weight = item.Weight,
             ProductId = item.ProductId,
             Description = item.Description,
             CostPrice = item.CostPrice,
             SellPrice = item.SellPrice,
             AdjustedPrice = item.AdjustedPrice,
             Deduct = new decimal?(item.SellPrice - item.AdjustedPrice),
             SupplierId = item.SupplierId,
             SupplierName = item.SupplierName
         };
         tmpOrderItem = items;
         if ((item.SkuValues != null) && (item.SkuValues.Length > 0))
         {
             tmpOrderItem.Attribute = string.Join(",", item.SkuValues);
         }
         mainOrder.OrderItems.Add(tmpOrderItem);
         if (tmpOrderItem.SupplierId.HasValue && (tmpOrderItem.SupplierId.Value > 0))
         {
             if (dicSuppOrderItems.ContainsKey(tmpOrderItem.SupplierId.Value))
             {
                 dicSuppOrderItems[tmpOrderItem.SupplierId.Value].Add(tmpOrderItem);
             }
             else
             {
                 List<Maticsoft.Model.Shop.Order.OrderItems> list = new List<Maticsoft.Model.Shop.Order.OrderItems> {
                     tmpOrderItem
                 };
                 dicSuppOrderItems.Add(tmpOrderItem.SupplierId.Value, list);
             }
         }
         orderPoint += tmpOrderItem.Points;
     });
     mainOrder.OrderPoint = orderPoint;
     mainOrder.RegionId = new int?(shippingAddress.RegionId);
     mainOrder.ShipRegion = modelByCache.RegionName;
     mainOrder.ShipName = shippingAddress.ShipName;
     mainOrder.ShipEmail = shippingAddress.EmailAddress;
     mainOrder.ShipCellPhone = shippingAddress.CelPhone;
     mainOrder.ShipTelPhone = shippingAddress.TelPhone;
     mainOrder.ShipAddress = shippingAddress.Address;
     mainOrder.ShipZipCode = shippingAddress.Zipcode;
     mainOrder.ShippingModeId = new int?(shippingType.ModeId);
     mainOrder.ShippingModeName = shippingType.Name;
     mainOrder.RealShippingModeId = new int?(shippingType.ModeId);
     mainOrder.RealShippingModeName = shippingType.Name;
     mainOrder.ShippingStatus = 0;
     mainOrder.ExpressCompanyName = shippingType.ExpressCompanyName;
     mainOrder.ExpressCompanyAbb = shippingType.ExpressCompanyEn;
     Maticsoft.BLL.Shop.Supplier.SupplierInfo info4 = new Maticsoft.BLL.Shop.Supplier.SupplierInfo();
     if (dicSuppOrderItems.Count > 1)
     {
         foreach (KeyValuePair<int, List<Maticsoft.Model.Shop.Order.OrderItems>> pair in dicSuppOrderItems)
         {
             OrderInfo subOrder;
             subOrder = new OrderInfo(mainOrder) {
                 Weight = 0,
                 FreightAdjusted = subOrder.FreightActual = subOrder.Freight = 0,
                 OrderPoint = 0,
                 ProductTotal = 0M,
                 OrderCostPrice = 0,
                 OrderOptionPrice = 0,
                 OrderProfit = 0,
                 Amount = 0M
             };
             pair.Value.ForEach(delegate (Maticsoft.Model.Shop.Order.OrderItems info) {
                 int? weight = subOrder.Weight;
                 int num = info.Weight;
                 subOrder.Weight = weight.HasValue ? new int?(weight.GetValueOrDefault() + num) : null;
                 subOrder.OrderPoint += info.Points;
                 subOrder.ProductTotal += info.SellPrice * info.Quantity;
                 decimal? orderCostPrice = subOrder.OrderCostPrice;
                 decimal num2 = info.CostPrice * info.Quantity;
                 subOrder.OrderCostPrice = orderCostPrice.HasValue ? new decimal?(orderCostPrice.GetValueOrDefault() + num2) : null;
                 subOrder.Amount += info.AdjustedPrice * info.Quantity;
             });
             decimal? freightAdjusted = mainOrder.FreightAdjusted;
             decimal count = dicSuppOrderItems.Count;
             subOrder.FreightAdjusted = subOrder.FreightActual = subOrder.Freight = freightAdjusted.HasValue ? new decimal?(freightAdjusted.GetValueOrDefault() / count) : null;
             subOrder.OrderTotal = subOrder.ProductTotal + subOrder.Freight.Value;
             subOrder.Amount += subOrder.FreightAdjusted.Value;
             subOrder.OrderItems = pair.Value;
             subOrder.OrderType = 2;
             Maticsoft.Model.Shop.Supplier.SupplierInfo info5 = info4.GetModelByCache(pair.Key);
             if (info5 == null)
             {
                 obj2.Accumulate("STATUS", "NOSUPPLIERINFO");
                 return obj2.ToString();
             }
             subOrder.SupplierId = new int?(info5.SupplierId);
             subOrder.SupplierName = info5.Name;
             subOrder.CreatedDate = DateTime.Now;
             subOrder.OrderCode = subOrder.CreatedDate.ToString("yyyyMMddHHmmssfff");
             mainOrder.SubOrders.Add(subOrder);
         }
         mainOrder.HasChildren = true;
     }
     else
     {
         mainOrder.SupplierId = info2.Items[0].SupplierId;
         mainOrder.SupplierName = info2.Items[0].SupplierName;
         mainOrder.HasChildren = false;
     }
     try
     {
         mainOrder.OrderId = OrderManage.CreateOrder(mainOrder);
     }
     catch (Exception exception)
     {
         LogHelp.AddErrorLog("订单创建失败: " + exception.Message, exception.StackTrace, context.Request);
     }
     obj2.Accumulate("DATA", new { OrderId = mainOrder.OrderId, OrderCode = mainOrder.OrderCode, Amount = mainOrder.Amount, PaymentTypeId = mainOrder.PaymentTypeId, PaymentTypeName = mainOrder.PaymentTypeName });
     if (mainOrder.OrderId == -1L)
     {
         obj2.Accumulate("STATUS", "FAILED");
         return obj2.ToString();
     }
     if (!string.IsNullOrWhiteSpace(couponCode))
     {
         this.couponBll.UseCoupon(couponCode, mainOrder.BuyerID, mainOrder.BuyerEmail);
     }
     if (shoppingCartHelper != null)
     {
         shoppingCartHelper.ClearShoppingCart();
     }
     obj2.Accumulate("STATUS", "SUCCESS");
     return obj2.ToString();
 }
コード例 #7
0
ファイル: ProductAdd.cs プロジェクト: huaminglee/myyyyshop
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         Size size = StringPlus.SplitToSize(ConfigSystem.GetValueByCache("ProductNormalImageSize"), '|', SettingConstant.ProductThumbSize.Width, SettingConstant.ProductThumbSize.Height);
         this.hfProductImagesThumbSize.Value = size.Width + "," + size.Height;
         this.hfIsOpenSku.Value = ConfigSystem.GetValueByCache("Shop_AddProduct_OpenSku");
         this.hfIsOpenFit.Value = ConfigSystem.GetValueByCache("Shop_AddProduct_OpenFit");
         this.hfIsOpenRelated.Value = ConfigSystem.GetValueByCache("Shop_AddProduct_OpenRelated");
         this.txtDisplaySequence.Text = (this.productBll.MaxSequence() + 1).ToString();
         this.BindPackageInfo();
         SupplierInfo info = new SupplierInfo();
         this.drpSupplier.DataSource = info.GetModelList("");
         DataSet allList = info.GetAllList();
         if (!DataSetTools.DataSetIsNull(allList))
         {
             this.drpSupplier.DataSource = allList;
             this.drpSupplier.DataTextField = "Name";
             this.drpSupplier.DataValueField = "SupplierId";
             this.drpSupplier.DataBind();
         }
         this.drpSupplier.Items.Insert(0, new ListItem("无", "0"));
         this.drpSupplier.SelectedIndex = 0;
     }
 }
コード例 #8
0
 private ShoppingCartInfo GetCartInfo4SKU(Maticsoft.Model.Shop.Products.ProductInfo productInfo, Maticsoft.Model.Shop.Products.SKUInfo skuInfo, int quantity, Maticsoft.Model.Shop.Products.ProductInfo proSaleInfo)
 {
     ShoppingCartInfo info = new ShoppingCartInfo();
     ShoppingCartItem cartItem = new ShoppingCartItem {
         MarketPrice = productInfo.MarketPrice.HasValue ? productInfo.MarketPrice.Value : 0M,
         Name = productInfo.ProductName,
         Quantity = (quantity < 1) ? 1 : quantity,
         SellPrice = skuInfo.SalePrice,
         AdjustedPrice = skuInfo.SalePrice,
         SKU = skuInfo.SKU,
         ProductId = skuInfo.ProductId,
         UserId = base.currentUser.UserID
     };
     if (proSaleInfo != null)
     {
         cartItem.AdjustedPrice = proSaleInfo.ProSalesPrice;
     }
     if (productInfo.SupplierId > 0)
     {
         Maticsoft.Model.Shop.Supplier.SupplierInfo modelByCache = new Maticsoft.BLL.Shop.Supplier.SupplierInfo().GetModelByCache(productInfo.SupplierId);
         if (modelByCache != null)
         {
             cartItem.SupplierId = new int?(modelByCache.SupplierId);
             cartItem.SupplierName = modelByCache.Name;
         }
     }
     List<Maticsoft.Model.Shop.Products.SKUItem> sKUItemsBySkuId = new Maticsoft.BLL.Shop.Products.SKUInfo().GetSKUItemsBySkuId(skuInfo.SkuId);
     if ((sKUItemsBySkuId != null) && (sKUItemsBySkuId.Count > 0))
     {
         cartItem.SkuValues = new string[sKUItemsBySkuId.Count];
         int index = 0;
         sKUItemsBySkuId.ForEach(delegate (Maticsoft.Model.Shop.Products.SKUItem xx) {
             cartItem.SkuValues[index++] = xx.ValueStr;
             if (!string.IsNullOrWhiteSpace(xx.ImageUrl))
             {
                 cartItem.SkuImageUrl = xx.ImageUrl;
             }
         });
     }
     cartItem.ThumbnailsUrl = productInfo.ThumbnailUrl1;
     cartItem.CostPrice = skuInfo.CostPrice.HasValue ? skuInfo.CostPrice.Value : 0M;
     cartItem.Weight = skuInfo.Weight.HasValue ? skuInfo.Weight.Value : 0;
     info.Items.Add(cartItem);
     return info;
 }
コード例 #9
0
 public ActionResult AddCart(string sku, int count = 1, string viewName = "AddCart")
 {
     if (string.IsNullOrWhiteSpace(sku))
     {
         return base.RedirectToAction("Index", "Home");
     }
     int userId = (base.currentUser == null) ? -1 : base.currentUser.UserID;
     ShoppingCartHelper helper = new ShoppingCartHelper(userId);
     ShoppingCartItem cartItem = new ShoppingCartItem();
     ProductModel model = new ProductModel();
     Maticsoft.Model.Shop.Products.SKUInfo modelBySKU = this.skuBll.GetModelBySKU(sku);
     if (modelBySKU == null)
     {
         return base.Content("NOSKU");
     }
     List<Maticsoft.Model.Shop.Products.SKUInfo> list2 = new List<Maticsoft.Model.Shop.Products.SKUInfo> {
         modelBySKU
     };
     model.ProductSkus = list2;
     model.ProductInfo = this.productBll.GetModelByCache(modelBySKU.ProductId);
     if ((model.ProductInfo != null) && (model.ProductSkus != null))
     {
         cartItem.Name = model.ProductInfo.ProductName;
         cartItem.Quantity = count;
         cartItem.SKU = model.ProductSkus[0].SKU;
         cartItem.ProductId = model.ProductInfo.ProductId;
         cartItem.UserId = userId;
         if (model.ProductInfo.SupplierId > 0)
         {
             Maticsoft.Model.Shop.Supplier.SupplierInfo modelByCache = new Maticsoft.BLL.Shop.Supplier.SupplierInfo().GetModelByCache(model.ProductInfo.SupplierId);
             if (modelByCache != null)
             {
                 cartItem.SupplierId = new int?(modelByCache.SupplierId);
                 cartItem.SupplierName = modelByCache.Name;
             }
         }
         List<Maticsoft.Model.Shop.Products.SKUItem> sKUItemsBySkuId = this.skuBll.GetSKUItemsBySkuId(modelBySKU.SkuId);
         if ((sKUItemsBySkuId != null) && (sKUItemsBySkuId.Count > 0))
         {
             cartItem.SkuValues = new string[sKUItemsBySkuId.Count];
             int index = 0;
             sKUItemsBySkuId.ForEach(delegate (Maticsoft.Model.Shop.Products.SKUItem xx) {
                 cartItem.SkuValues[index++] = xx.ValueStr;
                 if (!string.IsNullOrWhiteSpace(xx.ImageUrl))
                 {
                     cartItem.SkuImageUrl = xx.ImageUrl;
                 }
             });
         }
         cartItem.ThumbnailsUrl = model.ProductInfo.ThumbnailUrl1;
         cartItem.CostPrice = model.ProductSkus[0].CostPrice.HasValue ? model.ProductSkus[0].CostPrice.Value : 0M;
         cartItem.MarketPrice = model.ProductInfo.MarketPrice.HasValue ? model.ProductInfo.MarketPrice.Value : 0M;
         cartItem.SellPrice = cartItem.AdjustedPrice = model.ProductSkus[0].SalePrice;
         cartItem.Weight = model.ProductSkus[0].Weight.HasValue ? model.ProductSkus[0].Weight.Value : 0;
         helper.AddItem(cartItem);
         ShoppingCartInfo shoppingCart = helper.GetShoppingCart();
         ((dynamic) base.ViewBag).TotalPrice = shoppingCart.TotalSellPrice;
         ((dynamic) base.ViewBag).ItemCount = shoppingCart.Quantity;
     }
     ((dynamic) base.ViewBag).Title = "添加购物车";
     return base.RedirectToAction("CartInfo");
 }
コード例 #10
0
ファイル: ProductModify.cs プロジェクト: huaminglee/myyyyshop
 private void BindProductBaseInfo()
 {
     SupplierInfo info = new SupplierInfo();
     this.drpSupplier.DataSource = info.GetModelList("");
     DataSet allList = info.GetAllList();
     if (!DataSetTools.DataSetIsNull(allList))
     {
         this.drpSupplier.DataSource = allList;
         this.drpSupplier.DataTextField = "Name";
         this.drpSupplier.DataValueField = "SupplierId";
         this.drpSupplier.DataBind();
     }
     this.drpSupplier.Items.Insert(0, new ListItem("无", "0"));
     this.drpSupplier.SelectedIndex = 0;
     Maticsoft.Model.Shop.Products.ProductInfo model = new Maticsoft.BLL.Shop.Products.ProductInfo().GetModel(this.ProductId);
     if (model != null)
     {
         Maticsoft.BLL.Shop.Products.ProductCategories categories = new Maticsoft.BLL.Shop.Products.ProductCategories();
         this.hfCategoryId.Value = model.CategoryId.ToString();
         DataSet listByProductId = categories.GetListByProductId(model.ProductId);
         StringBuilder builder = new StringBuilder();
         StringBuilder builder2 = new StringBuilder();
         for (int i = 0; i < listByProductId.Tables[0].Rows.Count; i++)
         {
             builder.Append(listByProductId.Tables[0].Rows[i]["CategoryId"] + "_" + listByProductId.Tables[0].Rows[i]["CategoryPath"]);
             builder.Append(",");
             Maticsoft.Model.Shop.Products.CategoryInfo info4 = this.categoryManage.GetModel(Globals.SafeInt(listByProductId.Tables[0].Rows[i]["CategoryId"].ToString(), 0));
             if (info4 != null)
             {
                 builder2.Append(this.categoryManage.GetFullNameByCache(info4.CategoryId));
                 builder2.Append("  ");
             }
         }
         this.Hidden_SelectValue.Value = builder.ToString().TrimEnd(new char[] { ',' });
         this.Hidden_SelectName.Value = this.LitPName.Text = builder2.ToString();
         this.rptSelectCategory.DataSource = categories.GetListByProductId(model.ProductId);
         this.rptSelectCategory.DataBind();
         if (model.RegionId.HasValue)
         {
             this.ajaxRegion.Area_iID = model.RegionId.Value;
             this.ajaxRegion.SelectedValue = model.RegionId.Value.ToString();
         }
         this.txtSeoImageAlt.Text = model.SeoImageAlt;
         this.txtSeoImageTitle.Text = model.SeoImageTitle;
         this.txtMeta_Title.Text = model.Meta_Title;
         this.txtMeta_Keywords.Text = model.Meta_Keywords;
         this.txtMeta_Description.Text = model.Meta_Description;
         this.txtUrlRule.Text = model.SeoUrl;
         this.txtSalePrice.Text = model.LowestSalePrice.ToString("F");
         this.rblUpselling.SelectedValue = model.SaleStatus.ToString();
         if ((model.SupplierId > 0) && (this.drpSupplier.Items.FindByValue(model.SupplierId.ToString()) != null))
         {
             this.drpSupplier.SelectedValue = model.SupplierId.ToString();
         }
     }
 }
コード例 #11
0
 public ActionResult SubmitOrder(string sku, int count = 1, string viewName = "SubmitOrder")
 {
     if (!string.IsNullOrWhiteSpace(sku))
     {
         base.Session["SubmitOrder_SKU"] = sku;
         base.Session["SubmitOrder_COUNT"] = count;
     }
     else if (!string.IsNullOrWhiteSpace(base.Session["SubmitOrder_SKU"] as string))
     {
         sku = base.Session["SubmitOrder_SKU"] as string;
         count = Globals.SafeInt(base.Session["SubmitOrder_COUNT"], 1);
     }
     ((dynamic) base.ViewBag).SkuInfo = sku;
     ((dynamic) base.ViewBag).SkuCount = count;
     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 info5 = info3.GetModel(modelBySKU.ProductId);
         if (info5 == null)
         {
             return new RedirectResult("/Error");
         }
         ShoppingCartItem cartItem = new ShoppingCartItem {
             MarketPrice = info5.MarketPrice.HasValue ? info5.MarketPrice.Value : 0M,
             Name = info5.ProductName,
             Quantity = count,
             SellPrice = modelBySKU.SalePrice,
             AdjustedPrice = modelBySKU.SalePrice,
             SKU = modelBySKU.SKU,
             ProductId = modelBySKU.ProductId,
             UserId = base.currentUser.UserID
         };
         if (info5.SupplierId > 0)
         {
             Maticsoft.Model.Shop.Supplier.SupplierInfo modelByCache = new Maticsoft.BLL.Shop.Supplier.SupplierInfo().GetModelByCache(info5.SupplierId);
             if (modelByCache != null)
             {
                 cartItem.SupplierId = new int?(modelByCache.SupplierId);
                 cartItem.SupplierName = modelByCache.Name;
             }
         }
         List<Maticsoft.Model.Shop.Products.SKUItem> sKUItemsBySkuId = info2.GetSKUItemsBySkuId(modelBySKU.SkuId);
         if ((sKUItemsBySkuId != null) && (sKUItemsBySkuId.Count > 0))
         {
             cartItem.SkuValues = new string[sKUItemsBySkuId.Count];
             int index = 0;
             sKUItemsBySkuId.ForEach(delegate (Maticsoft.Model.Shop.Products.SKUItem xx) {
                 cartItem.SkuValues[index++] = xx.ValueStr;
                 if (!string.IsNullOrWhiteSpace(xx.ImageUrl))
                 {
                     cartItem.SkuImageUrl = xx.ImageUrl;
                 }
             });
         }
         cartItem.ThumbnailsUrl = info5.ThumbnailUrl1;
         cartItem.CostPrice = modelBySKU.CostPrice.HasValue ? modelBySKU.CostPrice.Value : 0M;
         cartItem.Weight = modelBySKU.Weight.HasValue ? modelBySKU.Weight.Value : 0;
         cartInfo.Items.Add(cartItem);
     }
     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;
     }
     int modeId = Globals.SafeInt(base.Request.QueryString["shipId"], 0);
     Maticsoft.Model.Shop.Shipping.ShippingType model = this._shippingTypeManage.GetModel(modeId);
     ((dynamic) base.ViewBag).Freight = cartInfo.CalcFreight(model);
     ((dynamic) base.ViewBag).TotalQuantity = cartInfo.Quantity;
     ((dynamic) base.ViewBag).TotalAdjustedPrice = cartInfo.TotalAdjustedPrice;
     ((dynamic) base.ViewBag).TotalPrice = cartInfo.TotalAdjustedPrice + ((dynamic) base.ViewBag).Freight;
     ((dynamic) base.ViewBag).Title = "提交订单";
     return base.View(viewName, cartInfo);
 }