Exemple #1
0
        public BaseHelperData CheckDataArrays(List<BaseSentenceAlgorithm> algorithms)
        {
            var result = new GeneralHelperData();
            result.PrimaryKey = null;

            var index = 0;
            // добавляем колонки
            foreach (var pair in DataArraysForCheckColunmNames)
            {
                var algorithmResult = algorithms.FindByInternalName(pair.Value, false)?.AlgResult;
                if (algorithmResult != null)
                {
                    var column = algorithmResult.HelperData.Columns[pair.Key] as BaseHelperDataColumn;
                    result.Columns.Add(new HelperDataGeneralStringColumn(column.ColumnDocumentationType, column.ColumnDocumentationNr.Replace(".", "_")));
                }
                else
                {
                    result.Columns.Add(new HelperDataGeneralStringColumn("?", "????"));
                }
                index++;

            }

            if (index > 0)
            {
                result.Rows.Add(new object[] { Guid.NewGuid().ToString() });
            }
            index = 3;

            // результаты
            foreach (var pair in DataArraysForCheckColunmNames)
            {
                var algorithmResult = algorithms.FindByInternalName(pair.Value, false)?.AlgResult;
                if (algorithmResult != null)
                {
                    var column = algorithmResult.HelperData.Columns[pair.Key] as BaseHelperDataColumn;

                    var values = algorithmResult.HelperData.ColumnValues<object>(pair.Key);
                    if (string.Join(" ", values.Select(x => x.ToString())) == string.Join(" ", GetAllIds(column).Select(x => x)))
                        result.Rows[0][index] = "ОК";
                    else
                        result.Rows[0][index] = "!!!!!!!";
                }
                else
                {
                    result.Rows[0][index] = "----";
                }
                index++;

            }

            CheckResult = result;

            return CheckResult;
        }
        protected override BaseSentenceAlgorithmData InitSourceData(List<BaseSentenceAlgorithm> algorithms)
        {
            // источник данных алгоритм 1.1 и 1.2
            var prevResultHlpData = new GeneralHelperData();

            prevResultHlpData.Merge(algorithms.FindHelperDataTableByAlgInternalName(AlgorithmNames.Subject.SimpleSubject.InternalName));
            prevResultHlpData.Merge(algorithms.FindHelperDataTableByAlgInternalName(AlgorithmNames.Subject.WhichSubject.InternalName));

            var subjAlgResult = algorithms.FindByInternalName(AlgorithmNames.Subject.SimpleSubject.InternalName).AlgResult;
            subjAlgResult.HelperData = prevResultHlpData;
            return subjAlgResult;
        }