protected void btnAddProduct_Click(object sender, EventArgs e) { int productId = int.Parse(txtProductId.Text); int quantity = int.Parse(txtQuantity.Text); int suiteId = int.Parse(lblSuiteId.Text); NoName.NetShop.Product.BLL.ProductModelBll pbll = new NoName.NetShop.Product.BLL.ProductModelBll(); SolutionProductBll spbll = new SolutionProductBll(); NoName.NetShop.Product.Model.ProductModel pmodel = pbll.GetModel(productId); SuiteBll sbll = new SuiteBll(); if (pmodel != null) { NoName.NetShop.Solution.Model.SolutionProductModel spmodel = new SolutionProductModel(); spmodel.Price = pmodel.MerchantPrice; spmodel.ProductId = pmodel.ProductId; spmodel.Quantity = quantity; spmodel.SuiteId = suiteId; spbll.Save(spmodel); sbll.SetPriceFromRefrence(suiteId); } ShowInfo(suiteId); }
private void ShowProductInfo(int productId) { NetShop.Product.BLL.ProductModelBll pbll = new NoName.NetShop.Product.BLL.ProductModelBll(); NetShop.Product.Model.ProductModel pmodel = pbll.GetModel(productId); this.litProductName.Text = pmodel.ProductName; this.litTopProductName.Text = pmodel.ProductName; this.litMerchantPrice.Text = pmodel.MerchantPrice.ToString("F2"); this.litTradePrice.Text = pmodel.TradePrice.ToString("F2"); this.litProductId.Text = pmodel.ProductId.ToString(); this.litStock.Text = pmodel.Stock > 0 ? "库存充足" : "暂时缺货"; this.imgProductL.ImageUrl = ProductMainImageRule.GetMainImageUrl(pmodel.MediumImage); this.imgProductM.ImageUrl = ProductMainImageRule.GetMainImageUrl(pmodel.LargeImage); }
private string AddFavorite(HttpContext context) { NameValueCollection nv = GetParas(context); bool result = false; string code = ""; string message = ""; if (context.User.Identity.IsAuthenticated && ((ShopIdentity)context.User.Identity) != null) { FavoriteBll fbll = new FavoriteBll(); FavoriteModel favModel = new FavoriteModel(); favModel.ContentId = int.Parse(nv["cid"]); favModel.UserId = ((ShopIdentity)context.User.Identity).UserId; favModel.ContentType = (ContentType)int.Parse(nv["ctype"]); switch (favModel.ContentType) { case ContentType.Product: NoName.NetShop.Product.BLL.ProductModelBll pbll = new NoName.NetShop.Product.BLL.ProductModelBll(); NoName.NetShop.Product.Model.ProductModel pmodel = pbll.GetModel(favModel.ContentId); favModel.FavoriteName = pmodel.ProductName; favModel.FavoriteUrl = pmodel.ProductUrl; break; case ContentType.Solution: NoName.NetShop.Solution.BLL.SuiteBll sbll = new NoName.NetShop.Solution.BLL.SuiteBll(); NoName.NetShop.Solution.Model.SuiteModel smodel = sbll.GetModel(favModel.ContentId); favModel.FavoriteName = smodel.SuiteName; favModel.FavoriteUrl = ConfigurationManager.AppSettings["siteurl"] + "/solution/suitedetail.aspx?suite=" + smodel.SuiteId; break; } fbll.Add(favModel); result = true; message = "收藏成功"; } else { result = false; message = "您还没有登录,请先登录!"; } return(GetJsonResult(result, code, message)); }
public string GetQuestionTargetTitle(int QuestionType,int TargetID) { /* <asp:ListItem Text="商品提问" Value="1"></asp:ListItem> <asp:ListItem Text="资讯提问" Value="2"></asp:ListItem> <asp:ListItem Text="投诉" Value="3"></asp:ListItem> <asp:ListItem Text="维修申请" Value="4"></asp:ListItem> * */ switch (QuestionType) { case 1: ProductModel p = new NoName.NetShop.Product.BLL.ProductModelBll().GetModel(TargetID); return p==null?String.Empty:p.ProductName; case 2: NewsModel n = new NoName.NetShop.News.BLL.NewsModelBll().GetModel(TargetID); return n == null ? String.Empty : n.Title; default: return String.Empty; } }
public string GetQuestionTargetTitle(int QuestionType, int TargetID) { /* * <asp:ListItem Text="商品提问" Value="1"></asp:ListItem> * <asp:ListItem Text="资讯提问" Value="2"></asp:ListItem> * <asp:ListItem Text="投诉" Value="3"></asp:ListItem> * <asp:ListItem Text="维修申请" Value="4"></asp:ListItem> * */ switch (QuestionType) { case 1: ProductModel p = new NoName.NetShop.Product.BLL.ProductModelBll().GetModel(TargetID); return(p == null?String.Empty:p.ProductName); case 2: NewsModel n = new NoName.NetShop.News.BLL.NewsModelBll().GetModel(TargetID); return(n == null ? String.Empty : n.Title); default: return(String.Empty); } }