public void SageArticleChange(Model.Sage.F_ARTICLE_Light article) { if (article != null) { if (SelectedOrderCartRule.Sag_id == null) { SelectedOrderCartRule.Sag_id = article.cbMarq; OrderCartRuleRepository.Add(SelectedOrderCartRule); } else { SelectedOrderCartRule.Sag_id = article.cbMarq; OrderCartRuleRepository.Save(); } ListOrderCartRule = new List <Model.Local.OrderCartRule>(); List <Model.Local.OrderCartRule> listOrderCartRuleTemp = new List <Model.Local.OrderCartRule>(); OrderCartRuleRepository = new Model.Local.OrderCartRuleRepository(); foreach (Model.Prestashop.PsCartRule cart in listReductionPs) { if (OrderCartRuleRepository.Exist((int)cart.IDCartRule)) { listOrderCartRuleTemp.Add(OrderCartRuleRepository.Read((int)cart.IDCartRule)); } else { Model.Local.OrderCartRule cartRule = new Model.Local.OrderCartRule(); cartRule.Pre_id = (int)cart.IDCartRule; listOrderCartRuleTemp.Add(cartRule); } } ListOrderCartRule = listOrderCartRuleTemp; } }
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()); } }