private static IPayrollArticle[] CollectFromPending(IDictionary <uint, IPayrollArticle[]> relatedDict, IPayrollArticle article, SymbolName[] articlePath, IDictionary <uint, IPayrollArticle[]> pendingDict, IProcessConfigLogger logger) { uint articleCode = article.ArticleCode(); bool skipExecToRelated = relatedDict.ContainsKey(articleCode); if (skipExecToRelated) { return(null); } VerifyCircularDependency(article, articlePath, articleCode); var initialArticles = new IPayrollArticle[] { article }; var callingArticles = articlePath.Concat(new SymbolName[] { article.ArticleSymbol() }).ToArray(); var pendingArticles = FindArticlesInDictionary(pendingDict, article); var collectArticles = pendingArticles.Aggregate(initialArticles, (agr, articleSource) => agr.Concat(ResolveArticleDependency(relatedDict, articleSource, callingArticles, pendingDict, logger)).ToArray()); var relatedArticles = collectArticles.Distinct().OrderBy(x => x.ArticleSymbol()).ToArray(); return(relatedArticles); }
private static IDictionary <IBookIndex, IBookTarget> BuildArticleTarget( IDictionary <IBookIndex, IBookTarget> initialStream, IBookParty addParty, IPayrollArticle article, ITargetValues addValues, IProcessConfig configModule) { var results = TargetsTupleComposer.AddTargetBySymbol(initialStream, addParty, article.ArticleSymbol(), addValues, configModule); var targets = results.Item2; return(targets); }
private static void VerifyCircularDependency(IPayrollArticle article, SymbolName[] articlePath, uint articleCode) { bool articlesCircle = (articlePath.Count(x => x.Code == articleCode) > 0); if (articlesCircle) { throw new EngineProcessCircleException("Circular article reference", articlePath, article.ArticleSymbol()); } }