Exemple #1
0
 public virtual string UpdateProductPropertyInfo(ProductInfo productInfo)
 {
     using (var tran = new TransactionScope())
     {
         var result = _productProcessor.UpdateProductPropertyInfo(productInfo);
         tran.Complete();
         return(result);
     }
 }
Exemple #2
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);
        }