private void BindProductBaseInfo() { 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 info3 = this.categoryManage.GetModel(Globals.SafeInt(listByProductId.Tables[0].Rows[i]["CategoryId"].ToString(), 0)); if (info3 != null) { builder2.Append(this.categoryManage.GetFullNameByCache(info3.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.txtSalePrice.Text = model.LowestSalePrice.ToString("F"); } }
private void DeleteBrands(HttpContext context) { JsonObject obj2 = new JsonObject(); string str = context.Request.Params["idList"]; if (!string.IsNullOrWhiteSpace(str)) { Maticsoft.BLL.Shop.Products.BrandInfo info = new Maticsoft.BLL.Shop.Products.BrandInfo(); Maticsoft.BLL.Shop.Products.ProductInfo info2 = new Maticsoft.BLL.Shop.Products.ProductInfo(); Maticsoft.BLL.Shop.Products.ProductTypeBrand brand = new Maticsoft.BLL.Shop.Products.ProductTypeBrand(); int brandId = Globals.SafeInt(str, 0); if (info2.ExistsBrands(brandId)) { obj2.Put("STATUS", "FAILED"); obj2.Put("DATA", "该品牌正在使用中!"); } if (info.DeleteList(str)) { brand.Delete(null, new int?(brandId)); obj2.Put("STATUS", "SUCCESS"); } else { obj2.Put("STATUS", "FAILED"); obj2.Put("DATA", "系统忙,请稍后再试!"); } } else { obj2.Put("STATUS", "FAILED"); obj2.Put("DATA", "系统忙,请稍后再试!"); } context.Response.Write(obj2.ToString()); }
private void ShowInfo(int ConsultationId) { Maticsoft.Model.Shop.Products.ProductConsults model = new Maticsoft.BLL.Shop.Products.ProductConsults().GetModel(ConsultationId); this.lblConsultationId.Text = model.ConsultationId.ToString(); this.lblUserId.Text = model.UserId.ToString(); this.lblProductId.Text = model.ProductId.ToString(); this.lblUserName.Text = model.UserName; this.lblUserEmail.Text = model.UserEmail; this.lblConsultationText.Text = model.ConsultationText; this.lblCreatedDate.Text = model.CreatedDate.ToString(); this.lblReplyDate.Text = model.ReplyDate.ToString(); this.chkIsReply.Checked = model.IsReply; this.lblReplyText.Text = model.ReplyText; this.lblReplyUserId.Text = model.ReplyUserId.ToString(); this.chkIsStatus.Checked = model.Status == 1; this.lblUserId.Text = new User().GetTrueNameByCache(model.UserId); Maticsoft.Model.Shop.Products.ProductInfo info2 = new Maticsoft.BLL.Shop.Products.ProductInfo().GetModel(model.ProductId); this.lblProductId.Text = info2.ProductName; }
private void ProductInfo(HttpContext context) { JsonObject obj2 = new JsonObject(); string str = context.Request.Params["pid"]; if (!string.IsNullOrWhiteSpace(str)) { long productId = Globals.SafeLong(str, (long) (-1L)); List<Maticsoft.Model.Shop.Products.ProductInfo> modelList = new Maticsoft.BLL.Shop.Products.ProductInfo().GetModelList(productId); if ((modelList != null) && (modelList.Count > 0)) { JsonArray data = new JsonArray(); modelList.ForEach(delegate (Maticsoft.Model.Shop.Products.ProductInfo info) { data.Add(new JsonObject(new string[] { "CategoryId", "TypeId", "ProductId", "BrandId", "ProductName", "ProductCode", "EnterpriseId", "RegionId", "ShortDescription", "Unit", "Description", "Title", "Meta_Description", "Meta_Keywords", "DisplaySequence", "MarketPrice", "HasSKU", "ImageUrl", "ThumbnailUrl1", "MaxQuantity", "MinQuantity", "SaleStatus" }, new object[] { info.CategoryId, info.TypeId, info.ProductId, info.BrandId, info.ProductName, info.ProductCode, info.SupplierId, info.RegionId, info.ShortDescription, info.Unit, info.Description, info.Meta_Title, info.Meta_Description, info.Meta_Keywords, info.DisplaySequence, info.MarketPrice, info.HasSKU, info.ImageUrl, info.ThumbnailUrl1, info.MaxQuantity, info.MinQuantity, info.SaleStatus })); }); obj2.Put("STATUS", "SUCCESS"); obj2.Put("DATA", data); } else { obj2.Put("STATUS", "FAILED"); } } else { obj2.Put("STATUS", "FAILED"); } context.Response.Write(obj2.ToString()); }
protected void ButUpload_Click(object sender, EventArgs e) { try { if ((this.FileUploadProducts.PostedFile != null) && (this.FileUploadProducts.PostedFile.ContentLength > 0)) { string str = Path.GetExtension(this.FileUploadProducts.PostedFile.FileName).ToLower(); ".csv".IndexOf(str); if ((!this.CheckBox1.Checked && !this.CheckBox2.Checked) && (!this.CheckBox3.Checked && !this.CheckBox4.Checked)) { MessageBox.ShowFailTip(this, "请至少选择一种商品推荐方式!"); } else { int num = Convert.ToInt32((this.ProductsBatchUploadDropList.SelectedValue == this.dropItem0Value) ? "-1" : this.ProductsBatchUploadDropList.SelectedValue); int num2 = Convert.ToInt32((this.dropProductTypes.SelectedValue == this.dropItem0Value) ? "-1" : this.dropProductTypes.SelectedValue); int num3 = Convert.ToInt32((this.dropBrands.SelectedValue == this.dropItem0Value) ? "-1" : this.dropBrands.SelectedValue); int num4 = Convert.ToInt32((this.dropEnterprise.SelectedValue == this.dropItem0Value) ? "-1" : this.dropEnterprise.SelectedValue); string str2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="; OleDbConnection selectConnection = new OleDbConnection(str2 + this.FileUploadProducts.PostedFile.FileName.Replace(this.FileUploadProducts.FileName, string.Empty) + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited\""); DataSet dataSet = new DataSet(); new OleDbDataAdapter("select * from " + this.FileUploadProducts.FileName, selectConnection).Fill(dataSet); selectConnection.Close(); int num5 = 0; Maticsoft.Model.Shop.Products.ProductInfo model = new Maticsoft.Model.Shop.Products.ProductInfo(); Maticsoft.BLL.Shop.Products.ProductInfo info2 = new Maticsoft.BLL.Shop.Products.ProductInfo(); for (int i = 0; i < dataSet.Tables[0].Rows.Count; i++) { model.CategoryId = num; model.TypeId = new int?(num2); model.BrandId = num3; model.SupplierId = num4; model.SaleStatus = this.CheckBoxSaleStatus.Checked ? 1 : 0; model.ProductName = dataSet.Tables[0].Rows[i]["商品名称"].ToString(); model.Description = dataSet.Tables[0].Rows[i]["简单介绍"].ToString(); model.AddedDate = Convert.ToDateTime(dataSet.Tables[0].Rows[i]["添加时间"]); model.ImageUrl = dataSet.Tables[0].Rows[i]["清晰图"].ToString(); model.MarketPrice = new decimal?(Convert.ToDecimal(dataSet.Tables[0].Rows[i]["市场价"].ToString())); model.LineId = 1; int num7 = Convert.ToInt32(info2.Add(model)); if (num7 != 0) { Maticsoft.Model.Shop.Products.ProductStationMode mode = new Maticsoft.Model.Shop.Products.ProductStationMode(); Maticsoft.BLL.Shop.Products.ProductStationMode mode2 = new Maticsoft.BLL.Shop.Products.ProductStationMode(); int num8 = 0; for (int j = 1; j <= 4; j++) { CheckBox box = (CheckBox) this.divCheckBox.FindControl("CheckBox" + j); if (box.Checked) { mode.ProductId = num7; mode.DisplaySequence = mode2.GetRecordCount(" ProductId = " + num7) + 1; mode.Type = Convert.ToInt32(box.SkinID); if (mode2.Add(mode) != 0) { num8 = 1; } } } if (num8 == 1) { num8 = 0; num5++; } } } if (num5 > 0) { MessageBox.ShowAndBack(this, "已成功导入 " + num5.ToString() + " 个商品!"); } else { MessageBox.ShowFailTip(this, "导入失败!"); } } } else { MessageBox.ShowFailTip(this, "请选择上传文件!"); } } catch (Exception exception) { MessageBox.ShowFailTip(this, exception.Message); } }
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); }
private void SaveProductInfo() { if (string.IsNullOrWhiteSpace(this.Hidden_SelectValue.Value)) { MessageBox.ShowFailTip(this, "请选择产品分类!"); } else { string text = this.txtProductName.Text; int num = Globals.SafeInt(this.hfCurrentProductType.Value, -1); int num2 = Globals.SafeInt(this.hfCurrentProductBrand.Value, -1); int? nullable = new int?(Globals.SafeInt(this.ajaxRegion.SelectedValue, -1)); string str2 = this.txtUnit.Text; decimal? nullable2 = new decimal?(Globals.SafeDecimal(this.txtMarketPrice.Text, (decimal) -1M)); int num3 = Globals.SafeInt(this.txtDisplaySequence.Text, -1); string str3 = this.txtShortDescription.Text; string str4 = this.txtDescription.Text; string str5 = this.hfProductImages.Value; string str6 = this.hfCurrentAttributes.Value; string str7 = this.hfCurrentBaseProductSKUs.Value; string str8 = this.hfCurrentProductSKUs.Value; bool flag = false; string[] strArray = new string[0]; if (!string.IsNullOrWhiteSpace(str3)) { str3 = Globals.HtmlEncodeForSpaceWrap(str3); } if (!string.IsNullOrWhiteSpace(str5)) { strArray = str5.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); } if (string.IsNullOrWhiteSpace(str6)) { MessageBox.Show(this, "属性信息不存在,请检查已填数据是否正确!"); } else { List<Maticsoft.Model.Shop.Products.AttributeInfo> list = this.GetAttributeInfo4Json(JsonMapper.ToObject(str6)); if (string.IsNullOrWhiteSpace(str7)) { MessageBox.Show(this, "基础SKU信息不存在,请检查已填数据是否正确!"); } else { List<Maticsoft.Model.Shop.Products.SKUInfo> list2 = null; decimal? nullable3 = 0M; flag = !string.IsNullOrWhiteSpace(str8); if (flag) { list2 = this.GetSKUInfo4Json(JsonMapper.ToObject(str8)); if (this.salePriceList.Count > 0) { this.salePriceList.Sort(); nullable3 = new decimal?(Convert.ToDecimal(this.salePriceList[0])); } } else { list2 = this.GetSKUInfo4Json(JsonMapper.ToObject(str7)); nullable3 = new decimal?(Globals.SafeDecimal(this.txtSalePrice.Text, (decimal) -1M)); } Maticsoft.Model.Shop.Products.ProductInfo model = new Maticsoft.BLL.Shop.Products.ProductInfo().GetModel(this.ProductId); string[] strArray2 = this.Hidden_SelectValue.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); model.Product_Categories = strArray2; model.ProductName = text; model.CategoryId = 0; model.TypeId = new int?(num); model.BrandId = num2; model.RegionId = (nullable == -1) ? null : nullable; model.Unit = str2; model.MarketPrice = (nullable2 == -1M) ? null : nullable2; model.LowestSalePrice = nullable3.Value; model.DisplaySequence = num3; model.ProductCode = this.txtProductSKU.Text; model.SaleStatus = -1; model.ShortDescription = str3; model.Description = str4; model.Tags = ""; if (strArray.Length == 0) { model.ImageUrl = model.ThumbnailUrl1 = model.ThumbnailUrl2 = "/Content/themes/base/Shop/images/none.png"; } string newValue = string.Format("/Upload/Shop/Images/Product/{0}/", DateTime.Now.ToString("yyyyMMdd")); string str10 = "/Upload/Shop/Images/ProductThumbs/" + DateTime.Now.ToString("yyyyMMdd") + "/"; ArrayList list3 = new ArrayList(); for (int i = 0; i < strArray.Length; i++) { if (i == 0) { if (strArray[i].Contains(this.tempFile)) { string str11 = string.Format(strArray[i], ""); string str12 = strArray[i]; model.ImageUrl = str11.Replace(this.tempFile, newValue); model.ThumbnailUrl1 = str12.Replace(this.tempFile, str10); list3.Add(str11.Replace(this.tempFile, "")); list3.Add(str12.Replace(this.tempFile, "")); Maticsoft.BLL.Shop.Products.ProductImage.MoveImage(strArray[i], newValue, str10); } } else { string str13 = string.Format(strArray[i], ""); string str14 = strArray[i]; Maticsoft.Model.Shop.Products.ProductImage item = new Maticsoft.Model.Shop.Products.ProductImage { ImageUrl = str13.Replace(this.tempFile, newValue), ThumbnailUrl1 = str14.Replace(this.tempFile, str10) }; model.ProductImages.Add(item); list3.Add(str13.Replace(this.tempFile, "")); list3.Add(str14.Replace(this.tempFile, "")); Maticsoft.BLL.Shop.Products.ProductImage.MoveImage(strArray[i], newValue, str10); } } model.AttributeInfos = list; model.HasSKU = flag; model.SkuInfos = list2; if (ProductManage.ModifyProduct(model)) { try { int count = list3.Count; if (this.skuImageList.Count > 0) { FileManage.MoveFile(base.Server.MapPath(this.tempFile), base.Server.MapPath(this.skuImageFile), this.skuImageList); } } catch (Exception) { } base.Response.Redirect(string.Format("InStock.aspx?SaleStatus={0}", model.SaleStatus)); } else { MessageBox.Show(this, "保存失败! 请重试."); } } } } }
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(); } } }
private void SaveProductInfo() { if (string.IsNullOrWhiteSpace(this.Hidden_SelectValue.Value)) { MessageBox.ShowFailTip(this, "请选择产品分类!"); } else { string text = this.txtProductName.Text; int num = Globals.SafeInt(this.hfCurrentProductType.Value, -1); int num2 = Globals.SafeInt(this.hfCurrentProductBrand.Value, -1); int num3 = Globals.SafeInt(this.drpSupplier.SelectedValue, -1); int? nullable = new int?(Globals.SafeInt(this.ajaxRegion.SelectedValue, -1)); string str2 = this.txtUnit.Text; decimal? nullable2 = new decimal?(Globals.SafeDecimal(this.txtMarketPrice.Text, (decimal) -1M)); int num4 = Globals.SafeInt(this.txtDisplaySequence.Text, -1); string str3 = this.txtShortDescription.Text; string str4 = this.txtDescription.Text; string str5 = this.txtUrlRule.Text; string str6 = this.txtMeta_Title.Text; string str7 = this.txtMeta_Description.Text; string str8 = this.txtMeta_Keywords.Text; string str9 = this.txtSeoImageAlt.Text; string str10 = this.txtSeoImageTitle.Text; string str11 = this.hfProductImages.Value; string str12 = this.hfCurrentAttributes.Value; string str13 = this.hfCurrentBaseProductSKUs.Value; string str14 = this.hfCurrentProductSKUs.Value; bool flag = false; string str15 = this.hfSelectedAccessories.Value; string str16 = this.HiddenField_RelatedProductInfo.Value; string[] strArray = new string[0]; if (!string.IsNullOrWhiteSpace(str3)) { str3 = Globals.HtmlEncodeForSpaceWrap(str3); } if (!string.IsNullOrWhiteSpace(str11)) { strArray = str11.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); } if (string.IsNullOrWhiteSpace(str12)) { MessageBox.Show(this, "属性信息不存在,请检查已填数据是否正确!"); } else { List<Maticsoft.Model.Shop.Products.AttributeInfo> list = this.GetAttributeInfo4Json(JsonMapper.ToObject(str12)); if (string.IsNullOrWhiteSpace(str13)) { MessageBox.Show(this, "基础SKU信息不存在,请检查已填数据是否正确!"); } else { List<Maticsoft.Model.Shop.Products.SKUInfo> list2 = null; decimal? nullable3 = 0M; flag = !string.IsNullOrWhiteSpace(str14); if (flag) { list2 = this.GetSKUInfo4Json(JsonMapper.ToObject(str14)); if (this.salePriceList.Count > 0) { this.salePriceList.Sort(); nullable3 = new decimal?(Convert.ToDecimal(this.salePriceList[0])); } } else { list2 = this.GetSKUInfo4Json(JsonMapper.ToObject(str13)); nullable3 = new decimal?(Globals.SafeDecimal(this.txtSalePrice.Text, (decimal) -1M)); } Maticsoft.Model.Shop.Products.ProductInfo model = new Maticsoft.BLL.Shop.Products.ProductInfo().GetModel(this.ProductId); string[] strArray2 = this.Hidden_SelectValue.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); model.Product_Categories = strArray2; model.ProductName = text; model.CategoryId = 0; model.TypeId = new int?(num); model.BrandId = num2; if (num3 > 0) { model.SupplierId = num3; } else { model.SupplierId = -1; } model.RegionId = (nullable == -1) ? null : nullable; model.Unit = str2; model.MarketPrice = (nullable2 == -1M) ? null : nullable2; model.LowestSalePrice = nullable3.Value; model.DisplaySequence = num4; model.ProductCode = this.txtProductSKU.Text; model.AddedDate = DateTime.Now; model.SaleStatus = Globals.SafeInt(this.rblUpselling.SelectedValue, 0); model.ShortDescription = str3; model.Description = str4; model.SeoUrl = str5; model.Meta_Title = str6; model.Meta_Description = str7; model.Meta_Keywords = str8; model.SeoImageAlt = str9; model.SeoImageTitle = str10; model.Tags = ""; if (strArray.Length == 0) { model.ImageUrl = model.ThumbnailUrl1 = model.ThumbnailUrl2 = "/Content/themes/base/Shop/images/none.png"; } string newValue = string.Format("/Upload/Shop/Images/Product/{0}/", DateTime.Now.ToString("yyyyMMdd")); string str18 = "/Upload/Shop/Images/ProductThumbs/" + DateTime.Now.ToString("yyyyMMdd") + "/"; ArrayList list3 = new ArrayList(); for (int i = 0; i < strArray.Length; i++) { if (i == 0) { if (strArray[i].Contains(this.tempFile)) { string str19 = string.Format(strArray[i], ""); string str20 = strArray[i]; model.ImageUrl = str19.Replace(this.tempFile, newValue); model.ThumbnailUrl1 = str20.Replace(this.tempFile, str18); list3.Add(str19.Replace(this.tempFile, "")); list3.Add(str20.Replace(this.tempFile, "")); Maticsoft.BLL.Shop.Products.ProductImage.MoveImage(strArray[i], newValue, str18); } } else { string str21 = string.Format(strArray[i], ""); string str22 = strArray[i]; Maticsoft.Model.Shop.Products.ProductImage item = new Maticsoft.Model.Shop.Products.ProductImage { ImageUrl = str21.Replace(this.tempFile, newValue), ThumbnailUrl1 = str22.Replace(this.tempFile, str18) }; model.ProductImages.Add(item); list3.Add(str21.Replace(this.tempFile, "")); list3.Add(str22.Replace(this.tempFile, "")); Maticsoft.BLL.Shop.Products.ProductImage.MoveImage(strArray[i], newValue, str18); } } model.AttributeInfos = list; model.HasSKU = flag; model.SkuInfos = list2; string[] strArray3 = str15.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List<Maticsoft.Model.Shop.Products.ProductAccessorie> list4 = new List<Maticsoft.Model.Shop.Products.ProductAccessorie>(); foreach (string str23 in strArray3) { Maticsoft.Model.Shop.Products.ProductAccessorie accessorie = new Maticsoft.Model.Shop.Products.ProductAccessorie { AccessoriesName = this.txtAccessorieName.Text, DiscountAmount = new decimal?(Globals.SafeDecimal(this.txtDiscountAmount.Text, (decimal) 0M)), DiscountType = new int?(this.rdoDiscountType4D.Checked ? 0 : 1), MaxQuantity = new int?(Globals.SafeInt(this.txtMaxQuantity.Text, 1)), MinQuantity = new int?(Globals.SafeInt(this.txtMinQuantity.Text, 1)), SkuId = str23 }; list4.Add(accessorie); } model.ProductAccessories = list4; string[] strArray4 = str16.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); model.RelatedProductId = strArray4; model.ProductId = this.ProductId; if (ProductManage.ModifyProduct(model)) { try { int count = list3.Count; if (this.skuImageList.Count > 0) { FileManage.MoveFile(base.Server.MapPath(this.tempFile), base.Server.MapPath(this.skuImageFile), this.skuImageList); } } catch (Exception) { } base.Response.Redirect(string.Format("ProductsInStock.aspx?SaleStatus={0}", model.SaleStatus)); } else { MessageBox.Show(this, "保存失败! 请重试."); } } } } }
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); }