private void Bind() { if (!string.IsNullOrEmpty(nId)) { if (bll == null) { bll = new BLL.Product(); } Model.Product model = bll.GetModel(nId); if (model != null) { ListItem li = null; li = ddlCategory.Items.FindByValue(model.CategoryId); if (li != null) { li.Selected = true; } txtProductName.Value = model.ProductName; txtSubtitle.Value = model.Subtitle; txtPrice.Value = model.ProductPrice.ToString(); txtPNum.Value = model.PNum; txtStockNum.Value = model.StockNum.ToString(); txtMarketPrice.Value = model.MarketPrice.ToString(); txtPayOptions.Value = model.PayOptions; hCustomAttrs.Value = model.CustomAttrs; hEditor1.Value = model.Descr; //商品图片 hPImagMain.Value = model.MainImage; hUploadify.Value = model.ImagesAppend; ViewState["ProductModel"] = model; } } }
public static Model.ProductInfo GetProduct(string productId) { BLL.Product bll = new BLL.Product(); if (!enableCaching) { return(bll.GetModel(productId)); } string key = "product_" + productId; Model.ProductInfo data = (Model.ProductInfo)HttpRuntime.Cache[key]; if (data == null) { data = bll.GetModel(productId); AggregateCacheDependency cd = DependencyFactory.GetProductDependency(); HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(productTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null); } return(data); }