Exemplo n.º 1
0
        /// <summary>
        /// 订单后台-添加订单-查询商品
        /// </summary>
        /// <param name="request">
        /// 请求对象
        /// </param>
        /// <param name="searchModel">
        /// 查询对象
        /// </param>
        /// <returns>
        /// 查询结果
        /// </returns>
        public ActionResult OrderEditQueryOrderProduct(
            [DataSourceRequest] DataSourceRequest request,
            OrderProductSearchModel searchModel)
        {
            int rowCount = 0;
            int pageCount;
            var productService = new ProductService();
            var condition = productService.BuildProductQueryCondition(
                searchModel.ProductCategoryID < 1 ? string.Empty : searchModel.ProductCategoryID.ToString(),
                searchModel.SubProductCategoryID < 1 ? string.Empty : searchModel.SubProductCategoryID.ToString(),
                searchModel.ProductBrandID < 1 ? string.Empty : searchModel.ProductBrandID.ToString(),
                searchModel.SubProductBrandID < 1 ? string.Empty : searchModel.SubProductBrandID.ToString(),
                searchModel.ProductName,
                searchModel.Barcode,
                string.Empty,
                string.Empty);
            var paging = new Paging("view_Product_Paging", null, "ID", condition, request.Page, request.PageSize);
            var list = productService.Query(paging, out pageCount, out rowCount);
            if (list == null)
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }

            var modelList = new List<OrderProductModel>();

            foreach (var item in list)
            {
                var model = DataTransfer.Transfer<OrderProductModel>(item, typeof(ProductSearchResult));
                model.ProductID = item.ID;
                model.ProductName = item.Name;
                model.Path = item.ThumbnailPath;
                model.TransactPrice = item.GoujiuPrice;
                model.ID = 0;
                modelList.Add(model);
            }

            var result = new DataSourceResult { Data = modelList, Total = rowCount };

            return Json(result, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 品牌下的商品分类
 /// </summary>
 /// <param name="productIdString">
 /// 商品编号.
 /// </param>
 /// <returns>
 /// The <see cref="string"/>.
 /// </returns>
 public string SimlarProduct(string productIdString)
 {
     if (!string.IsNullOrEmpty(productIdString))
     {
         string[] CharProduct = productIdString.Split(',');
         var sb = new StringBuilder();
         foreach (var s in CharProduct)
         {
             sb.Append("" + s + " OR ID=");
         }
         var list = new ProductService().QueryProductFromInfo(sb.ToString());
         sb.Clear();
         if (list != null)
         {
             foreach (var item in list)
             {
                 sb.Append("<ul class=\"goods_list\">");
                 sb.Append(" <li class=\"goods_pic\"> <a href=\"##\" target=\"_blank\" title=\"" + item.SEOTitle + "\">");
                 sb.Append(" <img class=\"lazyload\" src=\"##\" alt='" + item.SEOKeywords + "' /></a></li>");
                 sb.Append(" <li class=\"goods_name\"><a href=\"http://www.gjw.com/product/item-id-3866.htm\" target=\"_blank\" title='53度 茅台 孝道酒 500ml'>" + item.Name + "<span class=\"red\"></span></a></li>");
                 sb.Append("<li class=\"goods_price\">¥" + item.GoujiuPrice + "</li>");
                 sb.Append(" <li class=\"goods_pinglun\"><span><a href=\"http://www.gjw.com/product/item-id-3866.htm#Comment\"  target=\"_blank\">已有33人评论</a></span></li></ul>");
             }
         }
         return sb.ToString();
     }
     return "";
 }
Exemplo n.º 3
0
 /// <summary>
 /// The order.
 /// </summary>
 /// <returns>
 /// The <see cref="PartialViewResult"/>.
 /// </returns>
 public PartialViewResult Order()
 {
     var list = new ProductService().Query(ProductType.HotSale, 10, null);
     return this.PartialView("Order");
 }
Exemplo n.º 4
0
        private bool CheckBuyProducts(List<CartProduct> buyProducts,out string errorMessage)
        {
            var products = new List<CartProduct>();
            var messageSB = new StringBuilder();
            var whereStr = new StringBuilder();

            whereStr.Append("ID in (");
            for (int i = 0; i < buyProducts.Count; i++)
            {
                if (i < buyProducts.Count - 1)
                {
                    whereStr.Append(buyProducts[i].ProductID).Append(",");
                }
                else
                {
                    whereStr.Append(buyProducts[i].ProductID);
                }
            }
            whereStr.Append(")");

            var productList = new ProductService().Query(ProductType.Rand, 100, whereStr.ToString());

            if (productList == null || productList.Count < 1)
            {
                errorMessage = "商品不存在或已下架。";
                LogUtils.Log("根据商品ID从数据批量获取商品信息为NULL;商品查询条件:" + whereStr, "BuildCartProducts", Category.Warn);
                return false;
            }

            foreach (var cartProduct in buyProducts)
            {
                var quantity = 0;
                var response = this.CheckSpecialPromote(cartProduct.ProductID, ref quantity);

                if (response != null) //特殊全场活动赠品
                {
                    if (response.State == 0) //不允许领取赠品
                    {
                        messageSB.Append("商品:").Append(cartProduct.ProductName).Append(" ").Append(response.Message).Append("\r\n");
                        continue;
                    }
                    else
                    {
                        cartProduct.GoujiuPrice = 0;
                        if (cartProduct.Quantity > quantity) //若数量大于可赠送数量
                        {
                            messageSB.Append("商品:")
                                .Append(cartProduct.ProductName)
                                .Append(" ")
                                .Append("为活动赠品,最多可领取 " + quantity + "件。")
                                .Append("\r\n");
                            continue;
                        }
                    }
                }

                var product = productList.FirstOrDefault(p => p.ID == cartProduct.ProductID);

                if (product.Status != 2)
                {
                    messageSB.Append("商品:" + product.Name).Append(" 已下架;").Append("\r\n");
                }
                else if (product.InventoryNumber < 1)
                {
                    messageSB.Append("商品:" + product.Name).Append(" 库存不足;").Append("\r\n");
                }
                else if (product.InventoryNumber < cartProduct.Quantity)
                {
                    messageSB.Append("商品:" + product.Name).Append(" 库存剩余").Append(product.InventoryNumber).Append("件;\r\n");
                    products.Add(this.ConvertToCartProduct(product, product.InventoryNumber));
                }
                else
                {
                    products.Add(this.ConvertToCartProduct(product, cartProduct.Quantity));
                }
            }

            errorMessage = messageSB.ToString();

            if (!string.IsNullOrWhiteSpace(messageSB.ToString())) //检查不通过
            {
                return false;
            }

            //检查通过
            return true;
        }
Exemplo n.º 5
0
        public ActionResult Item(int id)
        {
            ProductSearchResult product = new ProductService().QueryByID(id);
            if (product == null)
            {
                Response.StatusCode = 404;
                return this.Content(Utils.ReadFile("Error/404.htm"));
            }

            Response.Cache.SetOmitVaryStar(true);
            var result = DataTransfer.Transfer<ProductModel>(product, typeof(ProductSearchResult));
            result.Introduce = Utils.AppendLazy(result.Introduce);
            result.Introduce = Utils.AppendLazy(result.Introduce, "input");
            ViewBag.ID = id;
            //if (this.GetUserID() != 0)
            //{
            //    try
            //    {
            //        var userBrowseHistoryService = new UserBrowseHistoryService();
            //        var userBrowseHistory = new User_BrowseHistory { UserID = this.GetUserID(), ProductID = id };
            //        userBrowseHistoryService.Add(userBrowseHistory);
            //    }
            //    catch (Exception exception)
            //    {
            //        throw new Exception(exception.Message);
            //    }
            //}

            SetSEO(result.Name);

            return this.View(result);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 搜索建议
 /// </summary>
 /// <param name="search"></param>
 /// <returns></returns>
 public JsonResult SearchSuggest(string search)
 {
     List<ProductSearchSuggest> list = new ProductService().SearchSuggest(search);
     if (list == null || list.Count == 0) return null;
     return this.Json(list, JsonRequestBehavior.AllowGet);
 }
Exemplo n.º 7
0
        private List<CartProduct> BuildCartProducts(int[] proIds, int[] quantity)
        {
            var products = new List<CartProduct>();
            var whereStr = new StringBuilder();
            var messageSB = new StringBuilder();
            whereStr.Append("ID in (");
            for (int i = 0; i < proIds.Length; i++)
            {
                if (i < proIds.Length - 1)
                {
                    whereStr.Append(proIds[i]).Append(",");
                }
                else
                {
                    whereStr.Append(proIds[i]);
                }
            }
            whereStr.Append(")");

            var list = new ProductService().Query(ProductType.Rand, 100, whereStr.ToString());

            if (list == null)
            {
                LogUtils.Log("根据商品ID从数据批量获取商品信息为NULL;商品列表:" + proIds, "BuildCartProducts", Category.Warn);
                return new List<CartProduct>();
            }

            for (int i = 0; i < proIds.Length; i++)
            {
                var product = list.FirstOrDefault(p => p.ID == proIds[i]);
                if (product != null)
                {
                    if (quantity[i] <= 0)
                    {
                        messageSB.Append("商品:" + product.Name).Append(" 购买数量不能为0").Append("\r\n");
                    }
                    else if (product.Status!=2)
                    {
                        messageSB.Append("商品:" + product.Name).Append(" 已下架;").Append("\r\n");
                    }
                    else if (product.InventoryNumber < 1)
                    {
                        messageSB.Append("商品:" + product.Name).Append(" 库存不足;").Append("\r\n");
                    }
                    else if (product.InventoryNumber < quantity[i])
                    {
                        messageSB.Append("商品:" + product.Name).Append(" 库存剩余").Append(product.InventoryNumber).Append("件;\r\n");
                        products.Add(this.ConvertToCartProduct(product, product.InventoryNumber));
                    }
                    else
                    {
                        products.Add(this.ConvertToCartProduct(product, quantity[i]));
                    }
                }
            }

            ViewBag.ExtraMessage = messageSB.ToString();

            return products;
        }
Exemplo n.º 8
0
 public ActionResult Trinket(int count)
 {
     var list = new ProductService().Query(
         ProductType.Rand,
         count,
         "Status=2 and InventoryNumber>0 and IsDelete= 0 and ProductCategoryID <> 9");
     return this.View("Trinket", list);
 }
Exemplo n.º 9
0
        private AjaxResponse Edit(int productId, int quantity, bool isAdd)
        {
            AjaxResponse ajaxResponse = null;
            if (productId < 1 || quantity < 1)
            {
                LogUtils.Log(
                    string.Format("加入或者修改购物车时商品/数量 参数错误,错误参数为:productId:{0},quantity:{1}", productId, quantity),
                    "Cart/Edit",
                    Category.Error,
                    this.UserSession.VisitorKey,
                    this.GetUserID(), "Cart/Edit");

                return new AjaxResponse(-1, "商品错误~~");
            }
            var userId = this.UserSession.UserID;
            if (userId < 0)
            {
                LogUtils.Log(
                    string.Format("加入或者修改购物车时用户编码错误,错误参数为:userId:{0}", userId),
                    "Cart/Edit",
                    Category.Error,
                    this.UserSession.VisitorKey,
                    this.GetUserID(),
                    "Cart/Edit");

                return new AjaxResponse(-2, "用户编码错误!");
            }

            var billProduct = new ProductService().QueryByID(productId);

            if (billProduct == null || billProduct.Status!=2 || billProduct.InventoryNumber < 1)
            {
                this.RemoveCartProducts(billProduct.ID);

                LogUtils.Log(
                    string.Format("加入或者修改购物车时发现 商品不存在、库存小于1或已下架,商品编码:{0}", productId),
                    "Cart/Edit",
                    Category.Info,
                    this.UserSession.VisitorKey,
                    this.GetUserID(),
                    "Cart/Edit");

                return new AjaxResponse(-2,"对不起,此商品库存不足或已下架,不能购买。");
            }

            var cart = this.GetUserCart();

            if (cart == null) //用户购物车不存在
            {
                cart = new UserCartModel
                           {
                               UserId = this.UserSession.UserID,
                               VisitorKey = this.UserSession.VisitorKey,
                               ProductItems = new List<CartProduct>()
                           };
            }

            if (cart.ProductItems == null)
            {
                cart.ProductItems=new List<CartProduct>();
            }

            var cartProduct = cart.ProductItems.Find(p => p.ProductID == productId);

            if (cartProduct == null)
            {
                ajaxResponse = this.AddCartProducts(quantity, billProduct, ref cart);
            }
            else  //更新购物车中的商品
            {
                int updateQuantity = 0;
                if (isAdd)
                {
                    updateQuantity = quantity + cartProduct.Quantity;
                }
                else
                {
                    updateQuantity = quantity;
                }

                ajaxResponse = this.SetUpdateQuantity(billProduct, ref updateQuantity);

                cartProduct.Quantity = updateQuantity;
            }

            cart.BuyList=new List<CartProduct>(); //由于MongoDB不能存储为Null的List对象

            this.UpdateUserCart(cart);

            return ajaxResponse ?? new AjaxResponse(1, "执行成功");
        }
Exemplo n.º 10
0
        public string GetProductBrandSuggestTip(NameValueCollection nv)
        {
            string _condition = string.Empty;
            string _keyword = Utils.UnEscape(nv["w"]);
            string _brand = Utils.ToString(nv["brand"]);
            string _price = Utils.ToString(nv["price"]);

            _brand = string.IsNullOrEmpty(_brand) ? "" : "ProductSearchText Like '" + _brand + "%'";
            _price = GetProductPrice(_price);
            _condition += string.IsNullOrEmpty(_brand) ? " 1=1 " : _brand;
            _condition += string.IsNullOrEmpty(_price) ? "" : " and " + _price;

            List<ProductSearchSuggestTip> list = new ProductService().SearchSuggestTip(_keyword, _condition);
            if (list == null || list.Count == 0) return "";

            StringBuilder brand = new StringBuilder();
            StringBuilder category = new StringBuilder();
            StringBuilder price = new StringBuilder();
            StringBuilder parentbrand = new StringBuilder();

            string[] pricelist = new string[8];

            int brand_count = 0;
            int parent_brand_count = 0;

            _keyword = Utils.ToString(nv["w"]);
            _brand = Utils.ToString(nv["brand"]);
            _price = Utils.ToString(nv["price"]);

            string href = "/Home/Search?w=" + _keyword;
            string item = string.Empty;
            foreach (var p in list)
            {
                switch (p.Type)
                {
                    case "ProductCategory":
                        item = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + p.Search + "&price=" + _price) + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                        category.Append(item);
                        break;
                    case "ProductBrand":
                        item = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + p.Search + "&price=" + _price) + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                        brand_count++;
                        brand.Append(item);
                        break;
                    case "ParentBrand":
                        item = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + p.Search + "&price=" + _price) + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                        parent_brand_count++;
                        parentbrand.Append(item);
                        break;
                    case "GoujiuPrice":
                        switch (p.Name)
                        {
                            case "6000以上":
                                pricelist[7] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p7") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                            case "2000-5999":
                                pricelist[6] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p6") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                            case "1000-1999":
                                pricelist[5] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p5") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                            case "600-999":
                                pricelist[4] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p4") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                            case "200-599":
                                pricelist[3] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p3") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                            case "100-199":
                                pricelist[2] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p2") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                            case "0-99":
                                pricelist[1] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p1") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                            case "其他":
                                pricelist[0] = "<li><a title=\"" + p.Name + "\" href=\"" + (href + "&brand=" + _brand + "&price=p0") + "\">" + p.Name + "(" + Utils.ToString(p.Num) + ")</a></li>";
                                break;
                        }
                        break;
                }
            }

            for (int i = 0; i < pricelist.Length; i++)
            {
                price.Append(pricelist[i]);
            }

            StringBuilder sb = new StringBuilder();
            sb.Append(GetAttrValues("大类", category.ToString(), 0, href));
            sb.Append(GetAttrValues("品牌", parentbrand.ToString(), parent_brand_count, href + "&price=" + _price).Replace("propAttrs", "brandAttr").Replace("j_Prop", "j_Brand"));
            sb.Append(GetAttrValues("子品牌", brand.ToString(), brand_count, href + "&price=" + _price).Replace("propAttrs", "brandAttr").Replace("j_Prop", "j_Brand"));
            sb.Append(GetAttrValues("价格", price.ToString(), 0, href + "&brand=" + _brand));
            return sb.ToString();
        }
Exemplo n.º 11
0
        /// <summary>
        /// 查询选中的商品信息
        /// </summary>
        /// <param name="request">
        /// 请求
        /// </param>
        /// <param name="checkedProductIds">
        /// 选中的商品编码列表
        /// </param>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult QueryCartProduct([DataSourceRequest] DataSourceRequest request, string checkedProductIds)
        {
            if (string.IsNullOrWhiteSpace(checkedProductIds))
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }

            int rowCount = 0;
            int pageCount;
            var productService = new ProductService();
            var paging = new Paging("view_Product_Paging", null, "ID", string.Format("[Status] = 2 And [ID] in ({0})", checkedProductIds), request.Page, request.PageSize);
            var list = productService.Query(paging, out pageCount, out rowCount);

            if (list == null)
            {
                return Json(null, JsonRequestBehavior.AllowGet);
            }

            var modelList = new List<OrderProductModel>();

            foreach (var item in list)
            {
                var model = new OrderProductModel
                                {
                                    ProductID = item.ID,
                                    ProductName = item.Name,
                                    Path = item.Path,
                                    Quantity = 1
                                };

                modelList.Add(model);
            }

            var result = new DataSourceResult() { Data = modelList, Total = rowCount };

            return Json(result, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 12
0
        public string GetProductBrandSuggest(NameValueCollection nv)
        {
            string _keyword = Utils.UnEscape(nv["w"]);
            string _brand = Utils.ToString(nv["brand"]);

            List<ProductSearchSuggestTip> list = new ProductService().SearchSuggestTip(_keyword, _brand);
            if (list == null || list.Count == 0) return "";

            StringBuilder sb = new StringBuilder();

            string search = string.IsNullOrEmpty(_keyword) ? "" : "&w=" + Utils.Escape(_keyword);
            int count = 0;
            string item = string.Empty;
            foreach (var p in list)
            {
                item = "<a title=\"" + p.Name + "\" href=\"/Home/Search?brand=" + p.Search + search + "\">" + p.Name + "</a>";
                if (p.Type == "ProductBrand")
                {
                    count++;
                    if (count > 6) break;
                    sb.Append(item);
                }
            }

            return sb.ToString();
        }
Exemplo n.º 13
0
        public string GetGroupListHtml(int count, string condition, NameValueCollection nv)
        {
            List<Advertise_Config> list = GetAdvertiseResult(count, condition, AdvertiseSource.Product);
            if (list == null || list.Count == 0) return "";

            List<ProductSearchResult> products = new List<ProductSearchResult>();
            foreach (Advertise_Config adv in list)
            {
                if (adv.IndexID > 0)
                {
                    List<ProductSearchResult> product = new ProductService().Query(ProductType.Rand, count, "id =" + adv.IndexID.ToString());
                    if (product == null || product.Count == 0) continue;
                    product[0].ThumbnailPath = string.IsNullOrEmpty(adv.ImagePath) ? Utils.GetProductImage(product[0].Path, "3") : adv.ImagePath;
                    var cart = new OrderBillServices().QueryCartProduct(product[0].ID);
                    if (cart != null)
                    {
                        product[0].GoujiuPrice = cart.PromotePrice;
                    }
                    products.Add(product[0]);
                }
            }
            string sort = Utils.ToString(nv["sort"], "0");
            string desc = Utils.ToString(nv["desc"], "0");

            var query = new List<ProductSearchResult>();
            switch (sort)
            {
                case "0": //销量
                    if (desc == "1")
                    {
                        query = (from p in products orderby p.SoldOfReality + p.SoldOfVirtual descending select p).ToList<ProductSearchResult>();
                    }
                    else
                    {
                        query = (from p in products orderby p.SoldOfReality + p.SoldOfVirtual select p).ToList<ProductSearchResult>();
                    }
                    break;
                case "1": //价格
                    if (desc == "1")
                    {
                        query = (from p in products orderby p.GoujiuPrice descending select p).ToList<ProductSearchResult>();
                    }
                    else
                    {
                        query = (from p in products orderby p.GoujiuPrice select p).ToList<ProductSearchResult>();
                    }
                    break;
                case "2": //人气
                    if (desc == "1")
                    {
                        query = (from p in products orderby p.PageView descending select p).ToList<ProductSearchResult>();
                    }
                    else
                    {
                        query = (from p in products orderby p.PageView select p).ToList<ProductSearchResult>();
                    }
                    break;
            }

            int i = 1;
            StringBuilder sb = new StringBuilder();
            foreach (ProductSearchResult product in query)
            {
                if (i % 3 == 0)
                {
                    sb.Append(GetGroupItemHtml(product, true));
                }
                else
                {
                    sb.Append(GetGroupItemHtml(product, false));
                }
                i++;
            }
            return sb.ToString();
        }
Exemplo n.º 14
0
        public ActionResult TuanItem(int id)
        {
            Response.Cache.SetOmitVaryStar(true);
            ProductSearchResult result = new ProductService().QueryByID(id);

            if (result == null)
            {
                Response.StatusCode = 404;
                return this.Content(Utils.ReadFile("Error/404.htm"));
            }

            result.Introduce = Utils.AppendLazy(result.Introduce);
            result.Introduce = Utils.AppendLazy(result.Introduce, "input");
            ViewBag.ID = id;

            var cart = new OrderBillServices().QueryCartProduct(result.ID);
            if (cart != null)
            {
                result.GoujiuPrice = cart.PromotePrice;
            }

            result.ThumbnailPath = Utils.GetProductImage(result.Path, "2");

            return this.View(result);
        }
Exemplo n.º 15
0
 public ActionResult Index()
 {
     GetTopMenuID();
     var product = new ProductService().QueryByID(3);
     return View();
 }
Exemplo n.º 16
0
        public JsonResult QueryProductByProductID(string productID)
        {
            var productModel = new ProductModel();

            if (!string.IsNullOrEmpty(productID))
            {
                this.productService = new ProductService();
                var product = this.productService.QueryByID(productID);

                productModel = DataTransfer.Transfer<ProductModel>(product, typeof(Product));
            }

            return this.Json(productModel, JsonRequestBehavior.AllowGet);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 判断商品是否存在相同的名称或条形码.
        /// </summary>
        /// <param name="id">
        /// 商品编号.
        /// </param>
        /// <param name="name">
        /// 商品名称.
        /// </param>
        /// <param name="barcode">
        /// 商品条形码.
        /// </param>
        /// <returns>
        /// 有重复数据true,没有false.
        /// </returns>
        private bool VerifyBarcode(int id, string name, string barcode)
        {
            var count = new ProductService().VerifyProduct(id, name, barcode);

            return count > 0;
        }
Exemplo n.º 18
0
        public string GetTuanSilderItemHtml(string condition, int count, AdvertiseSource source)
        {
            List<Advertise_Config> list = GetAdvertiseResult(count, condition, source);
            if (list == null || list.Count == 0) return "";

            string result = string.Empty;
            string id = string.Empty;

            List<ProductSearchResult> products = new List<ProductSearchResult>();
            foreach (Advertise_Config adv in list)
            {
                if (adv.IndexID > 0)
                {
                    switch (source)
                    {
                        case AdvertiseSource.LP:
                            break;
                        case AdvertiseSource.Product:
                            List<ProductSearchResult> product = new ProductService().Query(ProductType.Rand, count, "id =" + adv.IndexID.ToString());
                            if (product == null || product.Count == 0) continue;
                            product[0].ThumbnailPath = string.IsNullOrEmpty(adv.ImagePath) ? product[0].ThumbnailPath : adv.ImagePath;
                            products.Add(product[0]);
                            break;
                    }

                }
            }
            switch (source)
            {
                case AdvertiseSource.LP:
                    result = GetTuanSilderItemHtml(list);
                    break;
                case AdvertiseSource.Product:
                    result = GetTuanSilderItemHtml(products);
                    break;
            }

            return result;
        }