public void CreateCompositionArticle()
        {
            if (SelectedResultSearchCompositionArticle != null)
            {
                Model.Sage.F_ARTICLE F_ARTICLE = new Model.Sage.F_ARTICLERepository().ReadArticle(SelectedResultSearchCompositionArticle.cbMarq);
                if (F_ARTICLE != null)
                {
                    Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository();

                    string dft = Core.Global.RemovePurge(SelectedResultSearchCompositionArticle.AR_Design, 255);

                    Model.Local.Article Article = new Model.Local.Article()
                    {
                        Art_Name              = dft,
                        Art_Type              = (short)Model.Local.Article.enum_TypeArticle.ArticleComposition,
                        Art_Description       = SelectedResultSearchCompositionArticle.AR_Design,
                        Art_Description_Short = SelectedResultSearchCompositionArticle.AR_Design,
                        Art_MetaTitle         = dft,
                        Art_MetaDescription   = dft,
                        Art_MetaKeyword       = Core.Global.RemovePurgeMeta(dft, 255),
                        Art_LinkRewrite       = Core.Global.ReadLinkRewrite(dft),
                        Art_Active            = Core.Global.GetConfig().ImportArticleStatutActif,
                        Art_Date              = DateTime.Now,
                        Art_Solde             = false,
                        Art_Sync              = false,
                        Sag_Id              = 0,
                        Cat_Id              = 0,
                        Art_RedirectType    = new Model.Internal.RedirectType(Core.Parametres.RedirectType.NoRedirect404).Page,
                        Art_RedirectProduct = 0,
                        // champs non renseignés pour les compositions
                        Art_Pack  = false,
                        Art_Ref   = string.Empty,
                        Art_Ean13 = string.Empty,
                    };

                    Core.ImportSage.ImportArticle ImportArticle = new Core.ImportSage.ImportArticle();
                    Article.Cat_Id = ImportArticle.ReadCatalog(F_ARTICLE);

                    if (Article.Cat_Id == 0 && Core.Temp.selectedcatalog_composition != 0)
                    {
                        Article.Cat_Id = Core.Temp.selectedcatalog_composition;
                    }

                    if (Article.Cat_Id != 0)
                    {
                        ArticleRepository.Add(Article);

                        ImportArticle.AssignCatalog(0, Article.Cat_Id, Article, Core.Global.GetConfig().ImportArticleRattachementParents);

                        Core.ImportSage.ImportStatInfoLibreArticle ImportStatInfoLibreArticle = new Core.ImportSage.ImportStatInfoLibreArticle();
                        ImportStatInfoLibreArticle.ImportValues(Article, F_ARTICLE.AR_Ref);

                        PRESTACONNECT.Loading Loading = new PRESTACONNECT.Loading();
                        Loading.Show();

                        Core.Temp.selected_taxe_composition  = SelectedF_TAXE;
                        Core.Temp.reference_sage_composition = F_ARTICLE.AR_Ref;
                        Core.Temp.designation_composition    = F_ARTICLE.AR_Design;

                        PRESTACONNECT.Article Form = new Article(Article);
                        Loading.Close();
                        Form.ShowDialog();

                        if (FilterComposition)
                        {
                            SearchArticleComposition();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Aucune correspondance catalogue n'a été trouvée !", "Lien catalogue absent", MessageBoxButton.OK, MessageBoxImage.Stop);
                    }
                }
            }
        }
        public void Exec(Int32 ProductSend)
        {
            try
            {
                Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository();
                if (ArticleRepository.ExistPre_Id(ProductSend) == false)
                {
                    Model.Prestashop.PsProductLangRepository PsProductLangRepository = new Model.Prestashop.PsProductLangRepository();
                    if (PsProductLangRepository.ExistProductLang(ProductSend, Global.Lang, Global.CurrentShop.IDShop))
                    {
                        Model.Prestashop.PsProductRepository PsProductRepository = new Model.Prestashop.PsProductRepository();
                        Model.Prestashop.PsProduct           PsProduct           = PsProductRepository.ReadId(Convert.ToUInt32(ProductSend));
                        Model.Prestashop.PsProductLang       PsProductLang       = PsProductLangRepository.ReadProductLang(ProductSend, Global.Lang, Global.CurrentShop.IDShop);

                        Model.Sage.F_ARTICLERepository F_ARTICLERepository = new Model.Sage.F_ARTICLERepository();
                        string product_reference = PsProduct.Reference;
                        product_reference = product_reference.Replace(" ", "_");
                        if (F_ARTICLERepository.ExistReference(product_reference))
                        {
                            Model.Sage.F_ARTICLE F_ARTICLE = F_ARTICLERepository.ReadReference(product_reference);
                            Model.Local.Article  Article   = new Model.Local.Article()
                            {
                                Art_Name              = PsProductLang.Name,
                                Art_Description       = PsProductLang.Description,
                                Art_Description_Short = PsProductLang.DescriptionShort,
                                Art_LinkRewrite       = PsProductLang.LinkRewrite,
                                Art_MetaTitle         = PsProductLang.MetaTitle,
                                Art_MetaKeyword       = PsProductLang.MetaKeywords,
                                Art_MetaDescription   = PsProductLang.MetaDescription,
                                Art_Ref             = PsProduct.Reference,
                                Art_Ean13           = PsProduct.EAn13,
                                Art_Pack            = PsProduct.CacheIsPack == 1,
                                Art_Solde           = Convert.ToBoolean(PsProduct.OnSale),
                                Art_Active          = Convert.ToBoolean(PsProduct.Active),
                                Art_Sync            = true,
                                Art_SyncPrice       = true,
                                Art_Date            = (PsProduct.DateUpd != null && PsProduct.DateUpd > new DateTime(1753, 1, 2)) ? PsProduct.DateUpd : DateTime.Now.Date,
                                Sag_Id              = F_ARTICLE.cbMarq,
                                Pre_Id              = Convert.ToInt32(PsProduct.IDProduct),
                                Cat_Id              = this.ReadCatalog(PsProduct.IDCategoryDefault),
                                Art_RedirectType    = new Model.Internal.RedirectType(Core.Parametres.RedirectType.NoRedirect404).Page,
                                Art_RedirectProduct = 0,
                                Art_Manufacturer    = (PsProduct.IDManufacturer != null) ? (int)PsProduct.IDManufacturer : 0,
                                Art_Supplier        = (PsProduct.IDSupplier != null) ? (int)PsProduct.IDSupplier : 0,
                            };

                            if (Article.Cat_Id == 0)
                            {
                                foreach (Model.Prestashop.PsCategoryProduct PsCategoryProduct in new Model.Prestashop.PsCategoryProductRepository().ListProduct(PsProduct.IDProduct))
                                {
                                    Article.Cat_Id = this.ReadCatalog(PsCategoryProduct.IDCategory);
                                    if (Article.Cat_Id != 0)
                                    {
                                        break;
                                    }
                                }
                            }

                            if (PsProduct.CacheIsPack == 1)
                            {
                                Article.Art_Pack = true;
                            }
                            if (Article.Cat_Id != 0)
                            {
                                ArticleRepository.Add(Article);
                                RecoveryChildData(Article, PsProduct, ArticleRepository, false);
                            }
                        }
                    }
                }
                else
                {
                    Model.Local.Article Article = ArticleRepository.ReadPre_Id(ProductSend);
                    Model.Prestashop.PsProductRepository PsProductRepository = new Model.Prestashop.PsProductRepository();
                    Model.Prestashop.PsProduct           PsProduct           = PsProductRepository.ReadId(Convert.ToUInt32(ProductSend));
                    RecoveryChildData(Article, PsProduct, ArticleRepository, true);
                }
            }
            catch (Exception ex)
            {
                Core.Error.SendMailError(ex.ToString());
            }
        }