Esempio n. 1
0
 public virtual ProductInfo GetProductInfoByID(string productID)
 {
     if (!String.IsNullOrEmpty(productID))
     {
         return(_productProcessor.GetProductInfoByID(productID));
     }
     throw new ArgumentException("GetProductInfoByID Args Empty");
 }
Esempio n. 2
0
        /// <summary>
        /// 根据ProductIDo获取商家商品信息
        /// </summary>
        /// <param name="productID"></param>
        /// <returns></returns>
        public virtual SellerProductRequestInfo GetSellerProductInfoByProductID(string productID)
        {
            //CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfoSysNo(sysNo);
            if (string.IsNullOrEmpty(productID))
            {
                throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID"));
            }

            ProductProcessor productBp   = new ProductProcessor();
            ProductInfo      productInfo = productBp.GetProductInfoByID(productID);

            if (productInfo == null)
            {
                throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID"));
            }

            var entity = new SellerProductRequestInfo();

            entity.ProductID      = productInfo.ProductID;
            entity.BriefName      = productInfo.ProductBasicInfo.ProductBriefName;
            entity.ProductName    = productInfo.ProductBasicInfo.ProductTitle.Content;
            entity.ProductLink    = productInfo.ProductBasicInfo.ProductLink;
            entity.PackageList    = productInfo.ProductBasicInfo.PackageList.Content;
            entity.Keywords       = productInfo.ProductBasicInfo.Keywords.Content;
            entity.UPCCode        = productInfo.ProductBasicInfo.UPCCode;
            entity.BriefName      = productInfo.ProductBasicInfo.ProductBriefName;
            entity.IsTakePictures = (SellerProductRequestTakePictures)productInfo.ProductBasicInfo.IsTakePicture;
            entity.Attention      = productInfo.ProductBasicInfo.Attention.Content;
            entity.Note           = productInfo.ProductBasicInfo.Note;
            entity.PromotionTitle = productInfo.PromotionTitle.Content;
            //entity.HostWarrantyDay = productInfo.ProductWarrantyInfo.HostWarrantyDay;
            //entity.PartWarrantyDay = productInfo.ProductWarrantyInfo.PartWarrantyDay;
            //entity.Warranty = productInfo.ProductWarrantyInfo.Warranty.Content;
            entity.ServicePhone = productInfo.ProductWarrantyInfo.ServicePhone;
            entity.ServiceInfo  = productInfo.ProductWarrantyInfo.ServiceInfo;
            // entity.IsOfferInvoice = productInfo.ProductWarrantyInfo.OfferVATInvoice== OfferVATInvoice.Yes? SellerProductRequestOfferInvoice.Yes: SellerProductRequestOfferInvoice.No;
            entity.Height          = productInfo.ProductBasicInfo.ProductDimensionInfo.Height;
            entity.Weight          = productInfo.ProductBasicInfo.ProductDimensionInfo.Weight;
            entity.Length          = productInfo.ProductBasicInfo.ProductDimensionInfo.Length;
            entity.Width           = productInfo.ProductBasicInfo.ProductDimensionInfo.Width;
            entity.MinPackNumber   = productInfo.ProductPOInfo.MinPackNumber;
            entity.ProductDescLong = productInfo.ProductBasicInfo.LongDescription.Content;

            entity.SellerProductRequestPropertyList = _SellerProductRequestDA.GetSellerProductPropertyListByProductID(productID);


            return(entity);
        }
        /// <summary>
        ///  更新商品请求
        /// </summary>
        /// <param name="productID"> </param>
        /// <param name="categoryInfo"> </param>
        /// <returns></returns>
        public void ProductChangeCategory(string productID, CategoryInfo categoryInfo, UserInfo operateUser)
        {
            ProductProcessor productBp = new ProductProcessor();

            ProductInfo product = productBp.GetProductInfoByID(productID);

            if (product == null)
            {
                //商品不存在
                throw new BizException(ResouceManager.GetMessageString("IM.Product", "ProductIDNotExist"));
            }



            #region 类别处理

            var group = _productGroupDA.GetProductGroup(product.SysNo);
            group.OperateUser   = operateUser;
            product.OperateUser = operateUser;

            if (product.ProductBasicInfo.ProductCategoryInfo.SysNo != categoryInfo.SysNo)
            {
                if (product.ProductBasicInfo.ProductCategoryInfo.SysNo.HasValue)
                {
                    if (_categoryPropertyDA.GetCategoryPropertyByCategorySysNo(
                            product.ProductBasicInfo.ProductCategoryInfo.SysNo.Value).Any(sourceCategoryProperty => !_categoryPropertyDA.GetCategoryPropertyByCategorySysNo(
                                                                                              product.ProductBasicInfo.ProductCategoryInfo.SysNo.Value).Any(p => p.Property.SysNo == sourceCategoryProperty.Property.SysNo)))
                    {
                        throw new BizException(ResouceManager.GetMessageString("IM.Category", "ProductChangeCategoryResult"));
                    }

                    product.ProductBasicInfo.ProductCategoryInfo = categoryInfo;

                    productBp.UpdateGroupProductCategoryInfo(group, product);
                }
            }

            #endregion
        }
Esempio n. 4
0
        /// <summary>
        ///  更新商品请求
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public SellerProductRequestInfo UpdateProductRequest(SellerProductRequestInfo entity)
        {
            CheckSellerProductRequestInfoProcessor.CheckSellerProductRequestInfo(entity);

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    ProductProcessor productBp = new ProductProcessor();

                    ProductInfo productInfo = productBp.GetProductInfoByID(entity.ProductID);

                    if (productInfo == null)
                    {
                        //商品不存在
                        throw new BizException(ResouceManager.GetMessageString("IM.SellerProductRequest", "SellerProductRequestProductID"));
                    }

                    productInfo.CompanyCode  = entity.CompanyCode;
                    productInfo.LanguageCode = entity.LanguageCode;

                    productInfo.ProductBasicInfo.ProductTitle.Content = entity.ProductName;
                    productInfo.ProductBasicInfo.ProductLink          = entity.ProductLink;
                    productInfo.ProductBasicInfo.PackageList.Content  = entity.PackageList;
                    productInfo.ProductBasicInfo.Keywords.Content     = entity.Keywords;
                    productInfo.ProductBasicInfo.UPCCode = entity.UPCCode;
                    productInfo.ProductBasicInfo.ProductBriefTitle.Content = entity.BriefName;
                    productInfo.ProductBasicInfo.IsTakePicture             = (ProductIsTakePicture)entity.IsTakePictures;
                    productInfo.ProductBasicInfo.Attention.Content         = entity.Attention;
                    productInfo.ProductBasicInfo.Note  = entity.Note;
                    productInfo.PromotionTitle.Content = entity.PromotionTitle;
                    //productInfo.ProductWarrantyInfo.HostWarrantyDay = entity.HostWarrantyDay;
                    //productInfo.ProductWarrantyInfo.PartWarrantyDay = entity.PartWarrantyDay;
                    //productInfo.ProductWarrantyInfo.Warranty.Content = entity.Warranty;
                    productInfo.ProductWarrantyInfo.ServicePhone = entity.ServicePhone;
                    productInfo.ProductWarrantyInfo.ServiceInfo  = entity.ServiceInfo;
                    // productInfo.ProductWarrantyInfo.OfferVATInvoice = entity.IsOfferInvoice== SellerProductRequestOfferInvoice.Yes? OfferVATInvoice.Yes: OfferVATInvoice.No;
                    productInfo.ProductBasicInfo.ProductDimensionInfo.Height = entity.Height;
                    productInfo.ProductBasicInfo.ProductDimensionInfo.Weight = entity.Weight;
                    productInfo.ProductBasicInfo.ProductDimensionInfo.Length = entity.Length;
                    productInfo.ProductBasicInfo.ProductDimensionInfo.Width  = entity.Width;
                    productInfo.ProductPOInfo.MinPackNumber = entity.MinPackNumber;

                    //更新ProductCommonInfo
                    _ProductCommonInfoDA.UpdateProductCommonInfoBasicInfo(productInfo, entity.EditUser);
                    _ProductCommonInfoDA.UpdateProductCommonInfoDimensionInfo(productInfo, entity.EditUser);
                    _ProductCommonInfoDA.UpdateProductCommonInfoWarrantyInfo(productInfo, entity.EditUser);
                    _ProductCommonInfoDA.UpdateProductCommonInfoNote(productInfo, entity.EditUser);
                    productInfo.OperateUser = entity.EditUser;
                    _ProductDA.UpdateProductPurchaseInfo(productInfo);
                    _ProductDA.UpdateProductBasicInfo(productInfo);

                    if (entity.SellerProductRequestPropertyList.Count > 0)
                    {
                        foreach (SellerProductRequestPropertyInfo requestProperty in entity.SellerProductRequestPropertyList)
                        {
                            if (productInfo.ProductBasicInfo.ProductProperties != null && productInfo.ProductBasicInfo.ProductProperties.Count > 0)
                            {
                                var property = productInfo.ProductBasicInfo.ProductProperties.Where(p => p.Property.PropertyInfo.SysNo == requestProperty.PropertySysno && p.PropertyGroup.SysNo == requestProperty.GroupSysno).ToList();
                                if (property.Count > 0)
                                {
                                    property.ForEach(p => productInfo.ProductBasicInfo.ProductProperties.Remove(p));
                                }
                            }

                            ProductProperty newProperty = new ProductProperty();
                            newProperty.Property                           = new PropertyValueInfo();
                            newProperty.PropertyGroup                      = new PropertyGroupInfo();
                            newProperty.Property.PropertyInfo              = new PropertyInfo();
                            newProperty.PropertyGroup.SysNo                = requestProperty.GroupSysno;
                            newProperty.PropertyGroup.PropertyGroupName    = new LanguageContent(requestProperty.GroupDescription);
                            newProperty.Property.PropertyInfo.SysNo        = requestProperty.PropertySysno;
                            newProperty.Property.PropertyInfo.PropertyName = new LanguageContent(requestProperty.PropertyDescription);
                            newProperty.Property.SysNo                     = requestProperty.ValueSysno;
                            newProperty.Property.ValueDescription          = new LanguageContent(requestProperty.ValueDescription);
                            newProperty.PersonalizedValue                  = new LanguageContent(requestProperty.ManualInput);
                            productInfo.ProductBasicInfo.ProductProperties.Add(newProperty);

                            //更新请求属性信息
                            _SellerProductRequestDA.UpdateSellerProductRequestProperty(requestProperty, entity.EditUser.UserDisplayName);
                        }
                    }

                    foreach (var p in productInfo.ProductBasicInfo.ProductProperties)
                    {
                        p.CompanyCode    = entity.CompanyCode;
                        p.LanguageCode   = entity.LanguageCode;
                        p.Property.SysNo = p.Property.SysNo ?? 0;
                    }

                    string result = productBp.UpdateProductPropertyInfo(productInfo);

                    entity.Status = SellerProductRequestStatus.Finish;
                    entity        = _SellerProductRequestDA.SetSellerProductRequestStatus(entity);
                }
                catch (Exception ex)
                {
                    throw new BizException(ex.Message);
                }

                scope.Complete();
            }

            return(entity);
        }