コード例 #1
0
        public GoodsDetails GetDetailsById(int commodityId)
        {
            var    GoodsDetailsResult = new GoodsDetails();
            string sql             = "select * from fz_Commoditys where commodityId=@commodityId";
            var    CommodityResult = new QueryObject <Commodity>(_databaseInstance, sql, new { commodityId = commodityId }).FirstOrDefault();

            //string sql = "select * from fz_Commoditys where commodityId=@commodityId";
            if (CommodityResult != null)
            {
                GoodsDetailsResult.commodityDetails   = CommodityResult.commodityDetails;
                GoodsDetailsResult.commodityId        = CommodityResult.commodityId;
                GoodsDetailsResult.commodityFreight   = CommodityResult.commodityFreight;
                GoodsDetailsResult.commodityInventory = CommodityResult.commodityInventory;
                GoodsDetailsResult.commodityName      = CommodityResult.commodityName;
                GoodsDetailsResult.commodityPrice     = CommodityResult.commodityPrice;
                GoodsDetailsResult.commodityPrice1    = CommodityResult.commodityPrice1;
                GoodsDetailsResult.IsPinkage          = CommodityResult.IsPinkage;
                GoodsDetailsResult.images             = CommodityResult.images;
                if (CommodityResult.IsPinkage == false)
                {
                    GoodsDetailsResult.totalPrice = CommodityResult.commodityPrice + CommodityResult.commodityFreight;
                }
                else
                {
                    GoodsDetailsResult.totalPrice = CommodityResult.commodityPrice;
                }
            }


            return(GoodsDetailsResult);
        }
コード例 #2
0
        private async Task GetStockInfoAsync(WebSocket webSocket, List <StockInfo> results, CountryArea provinceCountryArea, CountryArea cityCountryArea, IGoodsService goodsService, GoodsDetails details, GoodsPutRequest @params)
        {
            cityCountryArea.Parent = provinceCountryArea;
            IEnumerable <StockInfo> stockInfo = await _goodsProcessing.GetDistrictStock(cityCountryArea, goodsService, details, @params.BuyNum);

            results.AddRange(stockInfo);

            if ([email protected])
            {
                stockInfo = stockInfo.Where(s => s.State == 1);
            }

            if (stockInfo?.Count() > 0)
            {
                await SendAsync(webSocket, "stock", stockInfo);
            }
        }
コード例 #3
0
        public async Task <List <StockInfo> > GetDistrictStock(CountryArea cityCountryArea, IGoodsService goodsService, GoodsDetails details, int buyNum)
        {
            List <StockInfo>   results = new List <StockInfo>();
            List <CountryArea> searchCountryAreaList = _dbContext.CountryAreas.Where(ca => ca.ParentId == cityCountryArea.Id).ToList();

            foreach (CountryArea item in searchCountryAreaList)
            {
                item.Parent = cityCountryArea;
                bool searchStockFlag = await goodsService.CheckStock(details, buyNum, item);

                results.Add(new StockInfo
                {
                    Address = item.ToString(),
                    State   = searchStockFlag ? 1 : 0
                });
            }

            return(results);
        }