当前位置: 首页>>代码示例>>C#>>正文


C# Category.ValidateSeName方法代码示例

本文整理汇总了C#中Nop.Core.Domain.Catalog.Category.ValidateSeName方法的典型用法代码示例。如果您正苦于以下问题:C# Category.ValidateSeName方法的具体用法?C# Category.ValidateSeName怎么用?C# Category.ValidateSeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Nop.Core.Domain.Catalog.Category的用法示例。


在下文中一共展示了Category.ValidateSeName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateLocales

        protected virtual List<LocalizedProperty> UpdateLocales(Category category, CategoryModel model)
        {
            List<LocalizedProperty> localized = new List<LocalizedProperty>();

            foreach (var local in model.Locales)
            {
                var seName = category.ValidateSeName(local.SeName, local.Name, false);
                _urlRecordService.SaveSlug(category, seName, local.LanguageId);

                if (!(String.IsNullOrEmpty(seName)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "SeName",
                        LocaleValue = seName,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.Description)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "Description",
                        LocaleValue = local.Description,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.MetaDescription)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaDescription",
                        LocaleValue = local.MetaDescription,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.MetaKeywords)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaKeywords",
                        LocaleValue = local.MetaKeywords,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.MetaTitle)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "MetaTitle",
                        LocaleValue = local.MetaTitle,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

                if (!(String.IsNullOrEmpty(local.Name)))
                    localized.Add(new LocalizedProperty()
                    {
                        LanguageId = local.LanguageId,
                        LocaleKey = "Name",
                        LocaleValue = local.Name,
                        _id = ObjectId.GenerateNewId().ToString(),
                        Id = localized.Count > 0 ? localized.Max(x => x.Id) + 1 : 1,
                    });

            }
            return localized;
        }
开发者ID:freemsly,项目名称:grandnode,代码行数:72,代码来源:CategoryController.cs

示例2: UpdateLocales

        protected void UpdateLocales(Category category, CategoryModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(category,
                                                               x => x.Name,
                                                               localized.Name,
                                                               localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(category,
                                                           x => x.Description,
                                                           localized.Description,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(category,
                                                           x => x.MetaKeywords,
                                                           localized.MetaKeywords,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(category,
                                                           x => x.MetaDescription,
                                                           localized.MetaDescription,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(category,
                                                           x => x.MetaTitle,
                                                           localized.MetaTitle,
                                                           localized.LanguageId);

                //search engine name
                var seName = category.ValidateSeName(localized.SeName, localized.Name, false);
                _urlRecordService.SaveSlug(category, seName, localized.LanguageId);
            }
        }
开发者ID:nkasar,项目名称:nopCommerce,代码行数:34,代码来源:CategoryController.cs

示例3: ResolveCategory

        private Category ResolveCategory(string categoryName, Category parentCategory)
        {
            Category currentCategory = _categoryService.GetAllCategories(categoryName).FirstOrDefault();
            if (currentCategory != null) return currentCategory;
            currentCategory = new Category
            {
                Name = categoryName,
                MetaTitle = categoryName,
                MetaDescription = categoryName,
                MetaKeywords = categoryName,
                AllowCustomersToSelectPageSize = true,
                HasDiscountsApplied = false,
                CategoryTemplateId = 1,
                //Description = categoryName,
                DisplayOrder = 1,
                IncludeInTopMenu = false,
                PageSize = 8,
                PageSizeOptions = "12,8,4",
                ParentCategoryId = parentCategory != null ? parentCategory.Id : 0,
                ShowOnHomePage = false,
                SubjectToAcl = false,
                LimitedToStores = false,
                Published = true,
                CreatedOnUtc = DateTime.UtcNow,
                UpdatedOnUtc = DateTime.UtcNow
            };
            _categoryService.InsertCategory(currentCategory);
            _urlRecordService.SaveSlug(currentCategory, currentCategory.ValidateSeName(categoryName, categoryName, true),
                0);

            return _categoryService.GetAllCategories(categoryName).First();
        }
开发者ID:aleks279,项目名称:atrend-test,代码行数:32,代码来源:ProductResolver.cs


注:本文中的Nop.Core.Domain.Catalog.Category.ValidateSeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。