Ejemplo n.º 1
0
        public ApiMessage CreateLeaveStockForMallTrade()
        {
            ApiMessage message = new ApiMessage()
            {
                Status = "ok", Message = "更新成功"
            };
            HttpContextBase context        = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request        = context.Request;
            string          user_id        = User.Identity.Name;
            UserManager     userMgr        = new UserManager(int.Parse(user_id), null);
            BUser           user           = userMgr.CurrentUser;
            StockManager    stockManager   = new StockManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            string          mall_product   = request["mall_item_id"];
            string          mall_sku       = request["mall_sku_id"];
            int             product        = 0;
            int             parent_product = 0;
            string          trade_id       = request["trade_id"];
            string          order_id       = request["order_id"];

            int.TryParse(request["product"], out parent_product);
            int.TryParse(request["product_prop"], out product);
            bool map = false;

            try
            {
                if (!string.IsNullOrEmpty(request["connect"]) && request["connect"].Trim() == "1")
                {
                    map = true;
                }
                else
                {
                    map = false;
                }
                stockManager.CreateLeaveStockForMallTrade(trade_id, order_id, mall_product, mall_sku, parent_product, product, map);
            }
            catch (KMJXCException kex)
            {
                message.Status  = "failed";
                message.Message = kex.Message;
            }
            catch
            {
            }
            return(message);
        }