Пример #1
0
 public static void LogRelatedArticles(IProcessConfigLogger logger, IPayrollArticle article, IPayrollArticle[] articles, string testName)
 {
     if (logger != null)
     {
         logger.LogRelatedArticles(article, articles, testName);
     }
 }
Пример #2
0
 public static void LogArticlesNames(IProcessConfigLogger logger, IPayrollArticle[] articles, IDictionary <uint, IPayrollConcept> concepts, string testName)
 {
     if (logger != null)
     {
         logger.LogArticlesNames(articles, concepts, testName);
     }
 }
Пример #3
0
 public static void LogDependentCodeArticlesInfo(IProcessConfigLogger logger, uint articleCode, IPayrollArticle[] articles, string testName)
 {
     if (logger != null)
     {
         logger.LogDependentCodeArticlesInfo(articleCode, articles, testName);
     }
 }
Пример #4
0
 public static void LogPendingArticles(IProcessConfigLogger logger, IPayrollArticle article, SymbolName[] callings, IPayrollArticle[] articles, string testName)
 {
     if (logger != null)
     {
         logger.LogPendingArticles(article, callings, articles, testName);
     }
 }
Пример #5
0
 public static void LogRelatedArticlesInModels(IProcessConfigLogger logger, IDictionary <uint, IPayrollArticle> models, string testName)
 {
     if (logger != null)
     {
         logger.LogRelatedArticlesInModels(models, testName);
     }
 }
Пример #6
0
 public static void LogDependentArticlesCollection(IProcessConfigLogger logger, IDictionary <uint, IPayrollArticle[]> collection, string testName)
 {
     if (logger != null)
     {
         logger.LogDependentArticlesCollection(collection, testName);
     }
 }
Пример #7
0
 public static void LogListArticlesUnderArticle(IProcessConfigLogger logger, IPayrollArticle article, IPayrollArticle[] articles, string testName)
 {
     if (logger != null)
     {
         logger.LogListArticlesUnderArticle(article, articles, testName);
     }
 }
Пример #8
0
 public static void CloseLogStream(IProcessConfigLogger logger)
 {
     if (logger != null)
     {
         logger.CloseLogStream();
     }
 }
Пример #9
0
 public static void OpenLogStream(IProcessConfigLogger logger, string testName)
 {
     if (logger != null)
     {
         logger.OpenLogStream(testName);
     }
 }
Пример #10
0
 public static void LogAppendMessageInfo(IProcessConfigLogger logger, string message, string testName)
 {
     if (logger != null)
     {
         logger.LogAppendMessageInfo(message, testName);
     }
 }
Пример #11
0
        public void TestSetup()
        {
            logger = new TestConfigLogger("TestArticleCollection");

            testConfig = ProcessConfigSetCzModule.CreateModule(logger);

            testConfig.InitModule();

            logger.CloseLogStream();
        }
Пример #12
0
        private static IPayrollArticle[] CollectRelatedArticles(IDictionary <uint, IPayrollArticle[]> initialDict,
                                                                uint articleCode, IPayrollArticle[] pendingArticles, IDictionary <uint, IPayrollArticle[]> pendingDict,
                                                                IProcessConfigLogger logger)
        {
            var callingArticles = new SymbolName[0];

            var relatedList = pendingArticles.Aggregate(new IPayrollArticle[0],
                                                        (agr, article) => agr.Concat(ResolveArticleDependency(initialDict, article, callingArticles, pendingDict, logger)).ToArray());

            var articleList = relatedList.Distinct().OrderBy(x => x.ArticleSymbol()).ToArray();

            return(articleList);
        }
        public void InitRelatedArticles(IProcessConfigLogger logger)
        {
            var pendingArticles = ArticleCodeListBuilder <AIDX> .BuildPendingCodesDict(this);

            var initialArticles = ArticleCodeListBuilder <AIDX> .BuildRelatedCodesDict(this);

            var relatedArticles = ArticleDependencyBuilder.CollectArticles(pendingArticles, initialArticles, logger);

            var relatedInitList = ArticleObjectListBuilder <AIDX> .BuildRelatedArticleDict(relatedArticles, this);

            var relatedSortList = ArticleSortoutBuilder.BuildSortedArticleDict(relatedInitList);

            UpdateRelatedArticles(relatedSortList, logger);
        }
Пример #14
0
        private static IDictionary <uint, IPayrollArticle[]> CollectDependentArticles(
            IDictionary <uint, IPayrollArticle[]> initialDict,
            uint articleCode, IPayrollArticle[] pendingArticles,
            IDictionary <uint, IPayrollArticle[]> pendingDict, IProcessConfigLogger logger)
        {
            LoggerWrapper.LogAppendMessageInfo(logger, ">>>>>", "CollectRelated");

            var resultList = CollectRelatedArticles(initialDict, articleCode, pendingArticles, pendingDict, logger);

            LoggerWrapper.LogAppendMessageInfo(logger, "<<<<<", "CollectRelated");

            LoggerWrapper.LogDependentCodeArticlesInfo(logger, articleCode, resultList, "ConceptArticles");

            var relatedDict = SortAndMergeIntoDictionary(initialDict, articleCode, resultList);

            return(relatedDict);
        }
Пример #15
0
        private static IDictionary <uint, uint[]> CollectRelatedArticles(
            IDictionary <uint, uint[]> relatedInit, uint articleCode,
            uint[] callingList, uint pendingCode, uint[] pendingList,
            IDictionary <uint, uint[]> dependencyDict, IProcessConfigLogger logger)
        {
            if (articleCode == 0)
            {
                uint[] initialList = (uint[])pendingList.Clone();

                var composeList = pendingList.Aggregate(initialList,
                                                        (agrList, article) => ComposeRelatedArticles(agrList, article, relatedInit)).ToArray();

                return(MergeIntoDictionary(relatedInit, pendingCode, composeList));
            }

            bool relatedExists = relatedInit.ContainsKey(articleCode);

            if (relatedExists == true)
            {
                return(relatedInit);
            }

            uint[] articleList = dependencyDict.FirstOrDefault(x => x.Key == articleCode).Value;

            if (articleList == null || articleList.Length == 0)
            {
                return(MergeIntoDictionary(relatedInit, articleCode, EMPTY_ARTICLE_CODE_LIST));
            }

            VerifyCircularDependency(articleCode, callingList);

            uint[] callingPath = callingList.Concat(new uint[] { articleCode }).ToArray();

            uint[] articleCodes = articleList.Select(x => x).Concat(new uint[] { 0 }).ToArray();

            var collectedDict = articleCodes.Aggregate(relatedInit,
                                                       (agr, code) => CollectRelatedArticles(agr, code,
                                                                                             callingPath, articleCode, articleList, dependencyDict, logger).
                                                       ToDictionary(key => key.Key, val => val.Value));

            return(collectedDict);
        }
Пример #16
0
 protected ProcessConfigModule(IProcessConfigLogger logger)
 {
     Logger = logger;
 }
        private ProcessConfigSetCzModule(IProcessConfigLogger logger) : base(logger)
        {
            ArticlesCollection = new ConfigSetCzArticleCollection();

            ConceptsCollection = new ConfigSetCzConceptCollection();
        }
Пример #18
0
        public static IDictionary <uint, uint[]> CollectArticles(
            IDictionary <uint, uint[]> dependencyDict, IDictionary <uint, uint[]> initialDict, IProcessConfigLogger logger)
        {
            var relatedDict = initialDict.ToDictionary(key => key.Key, val => val.Value);

            var articleCodes = dependencyDict.Keys;

            uint pendingCode = 0;

            uint[] pendingList = EMPTY_ARTICLE_CODE_LIST;

            uint[] callingList = EMPTY_ARTICLE_CODE_LIST;

            var collectedDict = articleCodes.Aggregate(relatedDict,
                                                       (agr, code) => CollectRelatedArticles(agr, code,
                                                                                             callingList, pendingCode, pendingList, dependencyDict, logger).
                                                       ToDictionary(key => key.Key, val => val.Value));

            return(collectedDict);
        }
        public static IProcessConfig CreateModule(IProcessConfigLogger logger)
        {
            IProcessConfig module = new ProcessConfigSetCzModule(logger);

            return(module);
        }
Пример #20
0
        private static IPayrollArticle[] ResolveArticleDependency(IDictionary <uint, IPayrollArticle[]> initialDict,
                                                                  IPayrollArticle article, SymbolName[] callingArticles, IDictionary <uint, IPayrollArticle[]> pendingDict, IProcessConfigLogger logger)
        {
            var relatedArticles = CollectFromRelated(initialDict, article, pendingDict);

            bool foundInRelated = relatedArticles != null;

            if (foundInRelated)
            {
                LoggerWrapper.LogRelatedArticles(logger, article, relatedArticles, "CollectRelated");

                return(relatedArticles);
            }
            else
            {
                relatedArticles = CollectFromPending(initialDict, article, callingArticles, pendingDict, logger);

                LoggerWrapper.LogPendingArticles(logger, article, callingArticles, relatedArticles, "CollectRelated");

                return(relatedArticles);
            }
        }
        private void UpdateRelatedArticles(IDictionary <uint, IPayrollArticle[]> relatedDict, IProcessConfigLogger logger)
        {
            foreach (var article in Models)
            {
                var articleCode = article.Key;

                var articleItem = article.Value;

                IPayrollArticle[] relatedArticles = null;

                bool existInDictionary = relatedDict.TryGetValue(articleCode, out relatedArticles);

                if (existInDictionary)
                {
                    articleItem.UpdateRelatedArticles(relatedArticles);
                }
                else
                {
                    articleItem.UpdateRelatedArticles(EMPTY_ARTICLE_LIST);
                }

                LoggerWrapper.LogListArticlesUnderArticle(logger, articleItem, relatedArticles, "UpdateRelatedArticles");
            }
        }
Пример #22
0
        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);
        }
Пример #23
0
        public static IDictionary <uint, IPayrollArticle[]> CollectArticles(
            IDictionary <uint, IPayrollArticle[]> pendingDict, IDictionary <uint, IPayrollArticle[]> initialDict, IProcessConfigLogger logger)
        {
            var relatedDict = pendingDict.Aggregate(initialDict,
                                                    (agr, pair) => CollectDependentArticles(agr, pair.Key, pair.Value, pendingDict, logger).
                                                    ToDictionary(key => key.Key, val => val.Value));

            LoggerWrapper.LogDependentArticlesCollection(logger, relatedDict, "CollectRelatedCollection");

            return(relatedDict);
        }