public void Exec(Int32 ArticleSend) { try { Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository(); if (ArticleRepository.ExistArticle(ArticleSend)) { Model.Local.Article Article = ArticleRepository.ReadArticle(ArticleSend); Model.Sage.F_ARTICLERepository F_ARTICLERepository = new Model.Sage.F_ARTICLERepository(); string AR_Ref = Article.Art_Ref; // ajout gestion lecture des informations pour une composition if (!F_ARTICLERepository.ExistReference(Article.Art_Ref) && Article.TypeArticle == Model.Local.Article.enum_TypeArticle.ArticleComposition && Article.CompositionArticle != null && Article.CompositionArticle.Count > 0) { int sag_id = (from Table in Article.CompositionArticle orderby Table.ComArt_Default descending select Table.ComArt_F_ARTICLE_SagId).FirstOrDefault(); Model.Sage.F_ARTICLE_Light light = F_ARTICLERepository.ReadLight(sag_id); if (light != null && !string.IsNullOrWhiteSpace(light.AR_Ref)) { AR_Ref = light.AR_Ref; } } if (F_ARTICLERepository.ExistReference(AR_Ref)) { if (ImportValues(Article, AR_Ref)) { if (Core.Temp.UpdateDateActive) { Article.Art_Date = DateTime.Now; } ArticleRepository.Save(); } } } } catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); } }
/// <summary> /// ExecArticle - Supprime toutes les images d'un article /// </summary> /// <param name="ArticleSend"></param> public void ExecArticle(Int32 ArticleSend, Boolean OnlyIfNotSourceExist, out List <string> log_out) { log_out = new List <string>(); try { Model.Local.ArticleRepository ArticleRepository = new Model.Local.ArticleRepository(); if (ArticleRepository.ExistArticle(ArticleSend)) { Model.Local.ArticleImageRepository ArticleImageRepository = new Model.Local.ArticleImageRepository(); List <Model.Local.ArticleImage> List = ArticleImageRepository.ListArticle(ArticleSend); if (List != null) { Model.Local.Article Article = ArticleRepository.ReadArticle(ArticleSend); foreach (Model.Local.ArticleImage ArticleImage in List) { List <string> log = null; if (OnlyIfNotSourceExist) { if (!System.IO.File.Exists(System.IO.Path.Combine(Core.Global.GetConfig().AutomaticImportFolderPicture, ArticleImage.ImaArt_SourceFile))) { Exec(ArticleImage, Article, out log); } } else { Exec(ArticleImage, Article, out log); } if (log != null && log.Count > 0) { log_out.AddRange(log); } } } } } catch (Exception ex) { Core.Error.SendMailError(ex.ToString()); } }