예제 #1
0
        private DataTypeEnum GenerateColourDataTypeEnum(string colour, DataType parentDataType)
        {
            var dataTypeEnum = DataTypeEnum.SingleOrDefault(x => x.Value == colour && x.DataType.DataTypeId == parentDataType.DataTypeId) ?? new DataTypeEnumFactory().NewWithDefaults(colour);

            dataTypeEnum.Deleted  = false;
            dataTypeEnum.DataType = DataType.Get(parentDataType.DataTypeId);
            dataTypeEnum.Save();

            GenericHelpers.DoForEachCulture(language =>
            {
                if (dataTypeEnum.GetDescription(language) == null)
                {
                    dataTypeEnum.AddDescription(new DataTypeEnumDescription {
                        CultureCode = language, DisplayName = colour, Description = colour
                    });
                }
            });

            return(dataTypeEnum);
        }
예제 #2
0
        private static Category CreateCategory(ProductCatalog catalog, string name)
        {
            var definition = Definition.SingleOrDefault(d => d.Name == "Default Category Definition");
            var category   = Category.SingleOrDefault(c => c.Name == name) ?? new CategoryFactory().NewWithDefaults(catalog, definition, name);

            category.DisplayOnSite = true;

            GenericHelpers.DoForEachCulture(language =>
            {
                if (category.GetDescription(language) == null)
                {
                    category.AddCategoryDescription(new CategoryDescription()
                    {
                        CultureCode = language, DisplayName = name
                    });
                }
            });

            category.Save();
            return(category);
        }