コード例 #1
0
ファイル: Product.cs プロジェクト: fathurxzz/aleqx
 private void SetLang(ProductLang entityLang)
 {
     Title = entityLang.Title;
     SeoDescription = entityLang.SeoDescription;
     SeoKeywords = entityLang.SeoKeywords;
     SeoText = entityLang.SeoText;
     Description = entityLang.Description;
 }
コード例 #2
0
ファイル: Product.cs プロジェクト: fathurxzz/aleqx
        private void CreateOrChangeEntityLanguage(Product cache)
        {
            try
            {
                //Log.DebugFormat("private void CreateOrChangeEntityLanguage started");

                //Log.DebugFormat("product {0}", cache);
                //Log.DebugFormat("LangId {0}", LangId);

                //Log.DebugFormat("var categoryLang = _store.ProductLangs.FirstOrDefault(r => r.ProductId == cache.Id && r.LanguageId == LangId);");

                var categoryLang = _store.ProductLangs.FirstOrDefault(r => r.ProductId == cache.Id && r.LanguageId == LangId);
                //Log.DebugFormat("product lang {0}", categoryLang);
                if (categoryLang == null)
                {
                    //Log.DebugFormat("product lang not found. creating new ProductLang");

                    var entityLang = new ProductLang
                    {
                        ProductId = cache.Id,
                        LanguageId = LangId,

                        Title = cache.Title,
                        Description = cache.Description,
                        SeoDescription = cache.SeoDescription,
                        SeoKeywords = cache.SeoKeywords,
                        SeoText = cache.SeoText,
                    };
                    //Log.DebugFormat("new ProductLang created");
                    //Log.DebugFormat(" _store.ProductLangs.Add(entityLang) started");
                    _store.ProductLangs.Add(entityLang);
                    //Log.DebugFormat(" _store.ProductLangs.Add(entityLang) finished");

                }
                else
                {
                    //Log.DebugFormat("product langfound. updating lang");
                    categoryLang.Title = cache.Title;
                    categoryLang.Description = cache.Description;
                    categoryLang.SeoDescription = cache.SeoDescription;
                    categoryLang.SeoKeywords = cache.SeoKeywords;
                    categoryLang.SeoText = cache.SeoText;
                }

                //Log.DebugFormat("private void CreateOrChangeEntityLanguage finished");
            }
            catch (Exception ex)
            {

                Log.ErrorFormat("exception {0}", ex);
            }
        }