Beispiel #1
0
        /// <summary>
        /// Update on sale product stock
        /// </summary>
        /// <param name="mall_item_id"></param>
        /// <param name="sku_id"></param>
        /// <param name="outer_id"></param>
        /// <param name="quantity"></param>
        /// <returns></returns>
        public bool UpdateProductQuantity(string mall_item_id, string sku_id, string outer_id, long quantity)
        {
            bool ret = false;

            ItemQuantityUpdateRequest req = new ItemQuantityUpdateRequest();

            req.NumIid = long.Parse(mall_item_id);
            if (!string.IsNullOrEmpty(sku_id))
            {
                req.SkuId = long.Parse(sku_id);
            }

            if (!string.IsNullOrEmpty(outer_id))
            {
                req.OuterId = outer_id;
            }
            req.Quantity = quantity;
            req.Type     = 1L;
            ItemQuantityUpdateResponse response = client.Execute(req, this.Access_Token.Access_Token1);

            if (!response.IsError)
            {
                ret = true;
            }
            return(ret);
        }
Beispiel #2
0
        public ApiResult SetItemQty(ItemQuantityUpdateRequest req)
        {
            if (!NotifyIfLicensExpired(Context.User.Identity.Name, SoftwareId))
            {
                var user = UserManager.FindByName(Context.User.Identity.Name);

                return(TopManager.TopOperation.UpdateItemQty(req.NumIid.Value, req.Quantity.Value, user.TaoOAuth));
            }
            return(new ApiResult(false, "操作无法继续,请检查软件授权情况"));
        }
Beispiel #3
0
        /// <summary>
        /// 修改库存
        /// </summary>
        /// <param name="itemId"></param>
        /// <param name="qty"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public ApiResult ItemQuantityUpdate(long itemId, int qty, int type = 1)
        {
            var client = GetTopClient();
            ItemQuantityUpdateRequest request = new ItemQuantityUpdateRequest
            {
                NumIid   = itemId,
                Quantity = qty,
                Type     = type
            };
            ItemQuantityUpdateResponse rsp = client.Execute(request, AccessToken);

            return(rsp.AsApiResult());
        }
Beispiel #4
0
 /// <summary>
 /// 设置库存
 /// </summary>
 /// <param name="ItemID"></param>
 /// <param name="Quantity"></param>
 public ApiResult UpdateItemQty(long ItemID, long Quantity, Models.UserTaoOAuth taoUserOAuth)
 {
     try
     {
         ITopClient client = new DefaultTopClient(url_api, this.AppKey, this.AppSecret);
         ItemQuantityUpdateRequest request = new ItemQuantityUpdateRequest
         {
             NumIid   = ItemID,
             Quantity = Quantity
         };
         ItemQuantityUpdateResponse rsp = client.Execute <ItemQuantityUpdateResponse>(request, taoUserOAuth.access_token);
         return(new ApiResult(!rsp.IsError, rsp.ErrMsg + " " + rsp.SubErrMsg));
     }
     catch (Exception e)
     {
         throw new Exception("ItemQuantityUpdateRequest Failure.", e);
     }
 }
Beispiel #5
0
        /// <summary>
        /// 更新库存
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="goods"></param>
        /// <param name="ErrorMsg"></param>
        /// <returns></returns>
        internal bool UpdateGoodsStoke(string sessionKey, ItemQuantityUpdate goods, out string ErrorMsg)
        {
            ErrorMsg = null;
            ITopClient client             = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
            ItemQuantityUpdateRequest req = new ItemQuantityUpdateRequest();

            if (goods.NumIid != null)
            {
                req.NumIid = goods.NumIid;
            }
            if (goods.SkuId != null)
            {
                req.SkuId = goods.SkuId;
            }
            if (goods.OuterId != null)
            {
                req.OuterId = goods.OuterId;
            }
            if (goods.Quantity != null)
            {
                req.Quantity = goods.Quantity;
            }
            if (goods.Type != null)
            {
                req.Type = goods.Type;
            }
            ItemQuantityUpdateResponse response = client.Execute(req, sessionKey);

            if (!response.IsError)
            {
                return(true);
            }
            else
            {
                ErrorMsg = response.SubErrMsg;
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Update on sale product stock
        /// </summary>
        /// <param name="mall_item_id"></param>
        /// <param name="sku_id"></param>
        /// <param name="outer_id"></param>
        /// <param name="quantity"></param>
        /// <returns></returns>
        public bool UpdateProductQuantity(string mall_item_id, string sku_id,string outer_id,long quantity)
        {
            bool ret = false;

            ItemQuantityUpdateRequest req = new ItemQuantityUpdateRequest();
            req.NumIid = long.Parse(mall_item_id);
            if (!string.IsNullOrEmpty(sku_id))
            {
                req.SkuId = long.Parse(sku_id);
            }

            if (!string.IsNullOrEmpty(outer_id))
            {
                req.OuterId = outer_id;
            }
            req.Quantity = quantity;
            req.Type = 1L;
            ItemQuantityUpdateResponse response = client.Execute(req, this.Access_Token.Access_Token1);
            if (!response.IsError)
            {
                ret = true;
            }
            return ret;
        }