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"); } }
public ActionResult Detail(int id, string viewName = "Detail") { Func<Maticsoft.Model.Shop.Products.CategoryInfo, bool> predicate = null; ProductModel model = new ProductModel { ProductInfo = this.productManage.GetModel((long) id) }; model.ProductImages = new Maticsoft.BLL.Shop.Products.ProductImage().ProductImagesList((long) id); model.ProductSkus = this.skuBll.GetProductSkuInfo((long) id); Maticsoft.BLL.Shop.Products.BrandInfo info = new Maticsoft.BLL.Shop.Products.BrandInfo(); if (model.ProductInfo == null) { return base.RedirectToAction("Index", "Home"); } Maticsoft.Model.Shop.Products.BrandInfo modelByCache = info.GetModelByCache(model.ProductInfo.BrandId); if (modelByCache != null) { ((dynamic) base.ViewBag).BrandName = modelByCache.BrandName; } Maticsoft.Model.Shop.Products.ProductCategories categoryModel = new Maticsoft.BLL.Shop.Products.ProductCategories().GetModel((long) id); if (categoryModel != null) { List<Maticsoft.Model.Shop.Products.CategoryInfo> allCateList = Maticsoft.BLL.Shop.Products.CategoryInfo.GetAllCateList(); if (predicate == null) { predicate = c => c.CategoryId == categoryModel.CategoryId; } Maticsoft.Model.Shop.Products.CategoryInfo info3 = allCateList.FirstOrDefault<Maticsoft.Model.Shop.Products.CategoryInfo>(predicate); if (info3 != null) { string[] cateIds = info3.Path.Split(new char[] { '|' }); List<Maticsoft.Model.Shop.Products.CategoryInfo> list2 = (from c in allCateList where cateIds.Contains<string>(c.CategoryId.ToString()) orderby c.Depth select c).ToList<Maticsoft.Model.Shop.Products.CategoryInfo>(); StringBuilder builder = new StringBuilder(); StringBuilder builder2 = new StringBuilder(); if ((list2 != null) && (list2.Count > 0)) { foreach (Maticsoft.Model.Shop.Products.CategoryInfo info4 in list2) { builder2.AppendFormat("<a href='/Product/" + info4.CategoryId + "'>{0}</a> > ", info4.Name); } } ((dynamic) base.ViewBag).Cid = categoryModel.CategoryId; ((dynamic) base.ViewBag).PathInfo = builder.ToString(); ((dynamic) base.ViewBag).CategoryStr = builder2.ToString(); } } PageSetting setting = PageSetting.GetProductSetting(model.ProductInfo, "Product", ApplicationKeyType.Shop); ((dynamic) base.ViewBag).Title = setting.Title; ((dynamic) base.ViewBag).Keywords = setting.Keywords; ((dynamic) base.ViewBag).Description = setting.Description; ((dynamic) base.ViewBag).ConsultCount = this.conBll.GetRecordCount("Status=1 and ProductId=" + id); ((dynamic) base.ViewBag).CommentCount = this.reviewsBll.GetRecordCount("Status=1 and ProductId=" + id); return base.View(viewName, model); }
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(); } } }