コード例 #1
0
        public IList <InvolvedRow> GetInvolvedRows(IList <int?> keys)
        {
            var iKey = 0;
            List <InvolvedRow> involvedRows = new InvolvedRows();

            foreach (ITable baseTable in _baseTablePerOidFieldIndex.Values)
            {
                int?key = keys[iKey];
                iKey++;

                if (key == null)
                {
                    continue;
                }

                involvedRows.Add(new InvolvedRow(((IDataset)baseTable).Name, key.Value));
            }

            return(involvedRows);
        }
コード例 #2
0
ファイル: RowParser.cs プロジェクト: esride-jts/ProSuite
        public static InvolvedRows Parse([NotNull] string involvedObjectsString)
        {
            Assert.ArgumentNotNull(involvedObjectsString, nameof(involvedObjectsString));

            // TODO: make more explicit, distribute test and involved objects
            //       in separate fields
            // General idea: if the first two entries is a <testIndex, TestName> tupel
            //               they have to be removed here (used in TestIndex)

            IList <string> values = involvedObjectsString.Split(_delimiter);

            var result = new InvolvedRows();

            var valueIndex = 0;
            int testIndex;

            if (valueIndex < values.Count && int.TryParse(values[valueIndex], out testIndex))
            {
                // values[valueIdx + 1] is TestName
                valueIndex += 2;
            }

            string activeTable   = null;
            var    tableRowCount = 0;

            while (valueIndex < values.Count)
            {
                string tableNameOrOid = values[valueIndex];
                int    oid;
                if (int.TryParse(tableNameOrOid, out oid))
                {
                    if (activeTable == null)
                    {
                        throw new InvalidOperationException("Invalid involvedObjectsString: " +
                                                            involvedObjectsString);
                    }

                    result.Add(new InvolvedRow(activeTable, oid));
                    tableRowCount++;
                }
                else if (tableNameOrOid == _overflow)
                {
                    if (valueIndex != values.Count)
                    {
                        _msg.DebugFormat("'{0}' not as last entry", _overflow);
                    }

                    result.HasAdditionalRows = true;
                    activeTable   = tableNameOrOid;
                    tableRowCount = 0;
                }
                else
                {
                    if (tableRowCount == 0 && activeTable != null)
                    {
                        _msg.DebugFormat("'{0}' (no OID) follows table '{1}'", tableNameOrOid,
                                         activeTable);
                    }

                    activeTable   = tableNameOrOid;
                    tableRowCount = 0;
                }

                valueIndex++;
            }

            return(result);
        }