コード例 #1
0
        /// <summary>
        /// 添加商品
        /// </summary>
        /// <param name="itemEntity"></param>
        /// <param name="ItemCategoryCode"></param>
        public void AddItem(T_ItemEntity itemEntity, out T_SkuEntity skuEntity, string ItemCategoryName, string ItemCategoryCode, string SkuOriginPrice, string SkuSalesPrice)
        {
            var skuBll          = new T_SkuBLL(CurrentUserInfo);
            var skuPriceBll     = new T_Sku_PriceBLL(CurrentUserInfo);
            var skuProperty     = new T_Sku_PropertyBLL(CurrentUserInfo);
            var itemCategoryBll = new T_Item_CategoryBLL(CurrentUserInfo);

            string ItemCategoryId = itemCategoryBll.CreateOrUpdateItemCategory(ItemCategoryName, ItemCategoryCode, CurrentUserInfo.ClientID, "0000", "1");

            T_ItemEntity NewEntity = new T_ItemEntity();

            NewEntity.item_id          = Guid.NewGuid().ToString("N");
            NewEntity.item_category_id = ItemCategoryId;
            NewEntity.item_code        = itemEntity.item_code;
            NewEntity.item_name        = itemEntity.item_name;
            NewEntity.status           = "-1";
            NewEntity.status_desc      = "下架";
            NewEntity.create_user_id   = "open";
            NewEntity.create_time      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            NewEntity.modify_time      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            NewEntity.if_flag          = "0";
            NewEntity.ifservice        = 0;    //  LM,2016/03/30
            NewEntity.IsGB             = 0;    //  LM,2016,03,30
            NewEntity.ifgifts          = 0;
            NewEntity.data_from        = "18"; //线下商品来源
            NewEntity.ifoften          = 0;
            NewEntity.display_index    = 1;
            NewEntity.CustomerId       = CurrentUserInfo.ClientID;
            Create(NewEntity);

            //新增规格|读取规格信息
            skuEntity = skuBll.CreateNewSku(NewEntity.item_id);

            if (!String.IsNullOrEmpty(skuEntity.sku_id))
            {
                //商品规格价格   原价|零售价|库存|销量
                string SaleCount  = "0"; //销量
                string StoreCount = "0"; //库存
                skuPriceBll.CreateNewSkuPrice(skuEntity.sku_id, SkuOriginPrice, SkuSalesPrice, StoreCount, SaleCount, CurrentUserInfo.ClientID);
            }
        }