示例#1
0
        public ActionResult FetchProductWithCostPriceByPid(string pid, string activityId)
        {
            var product = new ProductModel();

            using (var client = new ProductClient())
            {
                var sku = client.FetchProduct(pid);
                sku.ThrowIfException(true);
                if (sku.Success && sku.Result != null)
                {
                    product.PID           = pid;
                    product.OnSale        = sku.Result.Onsale;
                    product.Stockout      = sku.Result.Stockout;
                    product.DisplayName   = sku.Result.DisplayName;
                    product.Image         = sku.Result.Image;
                    product.cy_list_price = sku.Result.Price;
                }
            };
            //var product = QiangGouManager.FetchProductByPID(pid);

            if (!string.IsNullOrEmpty(product.PID) && product.PID != pid)
            {
                product.CaseSensitive = true;
            }
            if (!string.IsNullOrEmpty(activityId))
            {
                var saleoutqty = QiangGouManager.SelectFlashSaleSaleOutQuantity(activityId, pid);
                product.TotalQuantity   = saleoutqty;
                product.SaleOutQuantity = saleoutqty ?? 0;
            }
            var costPriceModel = QiangGouManager.SelectcostPriceSql(pid).FirstOrDefault();

            if (costPriceModel != null)
            {
                product.CostPrice = costPriceModel.CostPrice;
            }
            product = QiangGouManager.AssemblyProductInstalService(product);
            return(Json(product, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult FetchProductByPID(string pid)
        {
            var activityid = TempData["aid"]?.ToString();
            var product    = QiangGouManager.FetchProductByPID(pid);

            if (product != null)
            {
                if (!string.IsNullOrEmpty(product.PID) && product.PID != pid)
                {
                    product.CaseSensitive = true;
                }
                if (!string.IsNullOrEmpty(activityid))
                {
                    var saleoutqty = QiangGouManager.SelectFlashSaleSaleOutQuantity(activityid, pid);
                    product.TotalQuantity   = saleoutqty;
                    product.SaleOutQuantity = saleoutqty ?? 0;
                }
            }

            TempData["aid"] = activityid;

            return(Json(product));
        }
示例#3
0
        public ActionResult FetchProductWithCostPriceByPid(string pid, string activityId)
        {
            var product = QiangGouManager.FetchProductByPID(pid);

            if (product != null)
            {
                if (!string.IsNullOrEmpty(product.PID) && product.PID != pid)
                {
                    product.CaseSensitive = true;
                }
                if (!string.IsNullOrEmpty(activityId))
                {
                    var saleoutqty = QiangGouManager.SelectFlashSaleSaleOutQuantity(activityId, pid);
                    product.TotalQuantity   = saleoutqty;
                    product.SaleOutQuantity = saleoutqty ?? 0;
                }
                var costPriceModel = QiangGouManager.SelectcostPriceSql(pid).FirstOrDefault();
                if (costPriceModel != null)
                {
                    product.CostPrice = costPriceModel.CostPrice;
                }
            }
            return(Json(product, JsonRequestBehavior.AllowGet));
        }