private void ExecDistantLocal(Model.Prestashop.PsCategory Category, Model.Local.Catalog Catalog, Model.Local.CatalogRepository CatalogRepository) { try { // Recovery Data From CatalogLang Model.Prestashop.PsCategoryLangRepository CategoryLangRepository = new Model.Prestashop.PsCategoryLangRepository(); Model.Prestashop.PsCategoryLang CategoryLang = new Model.Prestashop.PsCategoryLang(); if (CategoryLangRepository.ExistCategoryLang((Int32)Category.IDCategory, Core.Global.Lang, Global.CurrentShop.IDShop)) { CategoryLang = CategoryLangRepository.ReadCategoryLang((Int32)Category.IDCategory, Core.Global.Lang, Global.CurrentShop.IDShop); Catalog.Cat_Name = CategoryLang.Name; Catalog.Cat_Description = CategoryLang.Description; Catalog.Cat_MetaTitle = CategoryLang.MetaTitle; Catalog.Cat_MetaKeyword = CategoryLang.MetaKeywords; Catalog.Cat_MetaDescription = CategoryLang.MetaDescription; Catalog.Cat_LinkRewrite = CategoryLang.LinkRewrite; } bool find_parent = false; if (Category.IDParent != Core.Global.CurrentShop.IDCategory) { if (!CatalogRepository.ExistPre_Id((int)Category.IDParent)) { // todo import catalogue depuis prestashop Core.ImportPrestashop.ImportCatalogue ImportCatalogue = new ImportPrestashop.ImportCatalogue(); ImportCatalogue.Exec((int)Category.IDParent); find_parent = CatalogRepository.ExistPre_Id((int)Category.IDParent); } else { find_parent = true; } if (find_parent) { Catalog.Cat_Level = Category.LevelDepth; } } else { Catalog.Cat_Level = Category.LevelDepth; } //Catalog.Cat_Position = (Int32)Category.Position; Catalog.Cat_Active = Convert.ToBoolean(Category.Active); Catalog.Cat_Date = (Category.DateUpd != null && Category.DateUpd > new DateTime(1753, 1, 2)) ? Category.DateUpd : DateTime.Now.Date; CatalogRepository.Save(); int parent = (Category.IDParent != Core.Global.CurrentShop.IDCategory) ? CatalogRepository.ReadPre_Id((int)Category.IDParent).Cat_Id : 0; CatalogRepository.WriteParent(Catalog.Cat_Id, parent); } catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); } }