private void ExecuteLogic()
        {
            lock (locker)
            {
                bool   flagErr      = false;
                string pathToChange = "";
                var    xmlModel     = Load1CDataFromXml.GetXmlModel(out flagErr, ref pathToChange);
                if (xmlModel.Categories.Count() == 0 && xmlModel.Products.Count() == 0)
                {
                    return;
                }
                try
                {
                    var efCats = xmlModel.Categories.Select(s => new DBFirstDAL.Categories()
                    {
                        Title  = s.Title,
                        OneCId = s.Id,
                    });
                    foreach (var item in efCats)
                    {
                        _categoryRepository.AddOrUpdateFromOneC(item);
                    }


                    _categoryRepository.HideCategoryIfNotExistInCurrentUpdateFrom1C(xmlModel.Categories.Select(s => s.Id));
                    var efCatWithParent = xmlModel.Categories.Select(s => new Category1CIdWithParent1CId()
                    {
                        Id = s.Id, ParentId = s.ParentId
                    }).ToList();

                    // var rootCategories = xmlModel.Categories.Where(w => w.ParentId == null);


                    _categoryRepository.UpdateParentCategory(efCatWithParent);


                    var xmlProducts = xmlModel.Products.Select(s => new DBFirstDAL.Products()
                    {
                        Title        = s.Title,
                        Price        = s.Price,
                        DateChange   = DateTime.Now,
                        DateCreation = DateTime.Now,
                        OneCId       = s.Id,
                        TypePrice    = (int)s.TypePrice,
                        IsPriority   = s.Priority,
                        //IsFilled = false,
                        EnumValues = new List <DBFirstDAL.EnumValues>(new DBFirstDAL.EnumValues[] { new DBFirstDAL.EnumValues()
                                                                                                    {
                                                                                                        Key       = s.Brand,
                                                                                                        TypeValue = (int)Common.TypeFromEnumValue.Brand
                                                                                                    } }),

                        TypeStatusProduct = (int)s.TypeStatusProduct,
                        Categories        = s.CategoryTextIds.Select(i => new DBFirstDAL.Categories()
                        {
                            OneCId = i
                        }).ToList()
                    }).ToList();

                    _categoryRepository.DeleteAllFilterBrands();
                    foreach (var item in xmlProducts)
                    {
                        _productRepository.AddOrUpdateFromOneC(item);
                    }


                    _categoryRepository.AddOrUpdateFilterBrand();

                    if (pathToChange != "")
                    {
                        Load1CDataFromXml.ChangePathFile(pathToChange);
                    }

                    _productRepository.SetIsNotUnloading(xmlProducts);
                }
                catch (Exception ex)
                {
                    Logger.Log(LogLevel.Error, ex, $"Ошибка при выгрузке информации на публичный сайт: {ex}");

                    flagErr = true;;
                }
            }
        }
        private bool Execute()
        {
            bool flagErr  = false;
            var  xmlModel = Load1CDataFromXml.GetXmlModel(out flagErr);

            try
            {
                var efCats = xmlModel.Categories.Select(s => new DBFirstDAL.Categories()
                {
                    Title  = s.Title,
                    OneCId = s.Id,
                });
                foreach (var item in efCats)
                {
                    _categoryRepository.AddOrUpdateFromOneC(item);
                }


                var efCatWithParent = xmlModel.Categories.Select(s => new Category1CIdWithParent1CId()
                {
                    Id = s.Id, ParentId = s.ParentId
                }).ToList();


                _categoryRepository.UpdateParentCategory(efCatWithParent);
            }
            catch (Exception)
            {
                flagErr = true;;
            }
            var efProducts = xmlModel.Products.Select(s => new DBFirstDAL.Products()
            {
                Title        = s.Title,
                Price        = s.Price,
                DateChange   = DateTime.Now,
                DateCreation = DateTime.Now,
                OneCId       = s.Id,
                TypePrice    = (int)s.TypePrice,
                IsPriority   = s.Priority,
                IsFilled     = false,
                EnumValues   = new List <DBFirstDAL.EnumValues>(new DBFirstDAL.EnumValues[] { new DBFirstDAL.EnumValues()
                                                                                              {
                                                                                                  Key       = s.Brand,
                                                                                                  TypeValue = (int)Common.TypeFromEnumValue.Brand
                                                                                              } }),

                Categories = s.CategoryTextIds.Select(i => new DBFirstDAL.Categories()
                {
                    OneCId = i
                }).ToList()
            });

            //var efProductsWithCategories = xmlModel.Products.Select(s => new Product1cIdWith1cCategoryIds()
            //{
            //    OneCId = s.Id,
            //    CategoryIds = s.CategoryTextIds
            //});
            foreach (var item in efProducts)
            {
                _productRepository.AddOrUpdateFromOneC(item);
            }

            _categoryRepository.AddOrUpdateFilterBrand();
            //_productRepository.InsertsOrNot(efProducts);
            //_productRepository.UpdateReletedCategoriesFromProducts(efProductsWithCategories);
            return(flagErr);
        }