Пример #1
0
        public void ShouldAddProductClass()
        {
            string name = "Неклассифицированный";
            ProductClassRepository repo = new ProductClassRepository();

            repo.CreateProductClass(name, null, null);
        }
Пример #2
0
        public static void getProductClassesFromTemp()
        {
            List <string> pClasses = getProductClassesStrings();

            foreach (var item in pClasses)
            {
                // TODO не создавать одинаковые тэги
                //Console.WriteLine("Input: ");
                //string str = Console.ReadLine();
                //Console.WriteLine("ParentId: ");
                //int? parent = Convert.ToInt32(Console.ReadLine());
                string[]               parts = item.Split(':');
                string                 name  = parts[0].Split('"')[1];
                List <string>          tags  = parts[1].Split('"').Where((it, index) => index % 2 != 0).ToList();
                ProductClassRepository productClassRepository = new ProductClassRepository();
                ProductClass           productClass           = productClassRepository.CreateProductClass(name, null, null);
                TagRepository          tagRepository          = new TagRepository();
                ClassTagRepository     classTagRepository     = new ClassTagRepository();
                if (tags.Any())
                {
                    foreach (var tagName in tags)
                    {
                        Tag      tag      = tagRepository.CreateTag(tagName);
                        ClassTag classTag = classTagRepository.CreateClassTag(productClass.Id, tag.Id);
                    }
                }
            }
        }