Ejemplo n.º 1
0
        /// <summary>
        /// 批量更改商品三级类别
        /// </summary>
        /// <param name="productList"></param>
        /// <param name="c3SysNo"></param>
        /// <param name="callback"></param>
        public void BatchChangeCategory(List <string> productList, int c3SysNo, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            ProductBatchChangeCategoryInfo data = new ProductBatchChangeCategoryInfo();

            data.ProductIDs   = productList;
            data.CategoryInfo = new CategoryInfo {
                SysNo = c3SysNo
            };
            data.EditUser = new UserInfo {
                SysNo = CPApplication.Current.LoginUser.UserSysNo, UserName = CPApplication.Current.LoginUser.LoginName, UserDisplayName = CPApplication.Current.LoginUser.DisplayName
            };

            _restClient.Update(RelativeUrl, data, callback);
        }
        /// <summary>
        /// 批量更改商品类别
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public void BatchChangeCategory(ProductBatchChangeCategoryInfo entity)
        {
            StringBuilder result = new StringBuilder();

            int successCount = 0;
            int errorCount   = 0;

            foreach (string productID in entity.ProductIDs)
            {
                try
                {
                    if (productID.Trim().Equals(string.Empty))
                    {
                        continue;
                    }
                    ObjectFactory <ProductBatchChangeCategoryProcessor> .Instance.ProductChangeCategory(productID, entity.CategoryInfo, entity.EditUser);

                    successCount++;
                }
                catch (BizException ex)
                {
                    string message = ResouceManager.GetMessageString("IM.Category", "ProductID");
                    message += ":{0},";
                    message += ResouceManager.GetMessageString("IM.Category", "FailReason");
                    message += ":{1}";
                    result.AppendLine(string.Format(message, productID, ex.Message));
                    errorCount++;
                }
            }

            string resMessage = ResouceManager.GetMessageString("IM.Category", "MoveCategorySuccess");

            resMessage += ":{0},";
            resMessage += ResouceManager.GetMessageString("IM.Category", "NumberUnit");
            resMessage += ResouceManager.GetMessageString("IM.Category", "MoveCategoryFail");
            resMessage += ":{1}";
            resMessage += ResouceManager.GetMessageString("IM.Category", "NumberUnit");
            resMessage += "。\r\n";
            result.Insert(0, string.Format(resMessage, successCount, errorCount));

            throw new BizException(result.ToString());
        }
Ejemplo n.º 3
0
 public void BatchChangeCategory(ProductBatchChangeCategoryInfo request)
 {
     ObjectFactory <ProductBatchChangeCategoryAppService> .Instance.BatchChangeCategory(request);
 }