예제 #1
0
        /// <summary>
        /// 删除或添加产品页面关键字
        /// </summary>
        /// <param name="productList"></param>
        /// <param name="batchAdd"></param>
        /// <param name="key0"></param>
        /// <param name="key1"></param>
        /// <param name="languageCode"></param>
        /// <param name="companyCode"></param>
        public virtual void BatchUpdateProductPageKeywords(List <string> productList, bool batchAdd, string key0, string key1, string languageCode, string companyCode)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                foreach (string productSysNo in productList)
                {
                    string[] strList = new string[3];
                    //先拆分
                    strList[0] = productSysNo.Split(',')[0].Trim();
                    strList[1] = productSysNo.Split(',')[1].Trim();
                    strList[2] = productSysNo.Split(',')[2].Trim();

                    //判断是更新k1还是k0
                    if (key1 != null)
                    {
                        strList[1] = SetKeywordsvValue(strList[1], batchAdd, key1.Trim());
                        if (String.IsNullOrEmpty(strList[0]) || strList[1].Length > 400)
                        {
                            continue;
                        }
                    }

                    if (key0 != null)
                    {
                        strList[2] = SetKeywordsvValue(strList[2], batchAdd, key0.Trim());


                        if (String.IsNullOrEmpty(strList[0]) || strList[2].Length > 200)
                        {
                            continue;
                        }
                    }
                    ProductPageKeywords keywords = new ProductPageKeywords();
                    keywords.Keywords     = new LanguageContent(languageCode, strList[1].ToString());
                    keywords.Keywords0    = new LanguageContent(languageCode, strList[2].ToString());
                    keywords.ProductSysNo = int.Parse(strList[0].ToString());
                    keywords.CompanyCode  = companyCode;
                    keywordDA.UpdateProductPageKeywords(keywords);
                    ExternalDomainBroker.UpdateProductExKeyKeywords(int.Parse(keywords.ProductSysNo.ToString()), keywords.Keywords.ToString()
                                                                    , keywords.Keywords0.ToString(), ServiceContext.Current.UserSysNo, keywords.CompanyCode);
                }
                scope.Complete();
            }
        }
예제 #2
0
        /// <summary>
        /// 更新产品Keywords0
        /// </summary>
        /// <param name="item"></param>
        public virtual void UpdateProductPageKeywords(ProductPageKeywords item)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                keywordDA.UpdateProductPageKeywords(item);

                /*2012-12-31 update bug95058  jack.g.tang
                 * 修改目的:ProductSysNo可能为null
                 * 解决办法:为null时 根据productId取得ProducuSysNo
                 */
                int?productSysNo = item.ProductSysNo;
                if (item.ProductSysNo == null || item.ProductSysNo == 0)
                {
                    productSysNo = ExternalDomainBroker.GetProductInfo(item.ProductId).SysNo;
                }
                ExternalDomainBroker.UpdateProductExKeyKeywords(
                    (int)productSysNo, item.Keywords.ToString()
                    , item.Keywords0.ToString(), ServiceContext.Current.UserSysNo, item.CompanyCode);
                scope.Complete();
            }
        }