Exemple #1
0
        private IEnumerable <IBedRecord> EnumUpgradeGridRows(GridTable srcgrid, GridTable dstgrid, ITableStructure ts)
        {
            var ensrc  = srcgrid.EnumRows(new TableDataSetProperties()).GetEnumerator();
            var endst  = dstgrid.EnumRows(new TableDataSetProperties()).GetEnumerator();
            var holder = new BedValueHolder();

            for (; ;)
            {
                if (!ensrc.MoveNext())
                {
                    break;
                }
                if (!endst.MoveNext())
                {
                    break;
                }
                var newrec = new ArrayDataRecord(ts);

                for (int i = 0; i < m_srcInfo.KeyCols.Length; i++)
                {
                    newrec.SeekValue(i);
                    ensrc.Current.ReadValue(i);
                    ensrc.Current.WriteTo(newrec);
                }

                for (int i = 0; i < m_srcInfo.DataCols.Length; i++)
                {
                    newrec.SeekValue(m_srcInfo.KeyCols.Length + i);
                    ensrc.Current.ReadValue(m_srcInfo.KeyCols.Length + i);
                    ensrc.Current.WriteTo(newrec);
                }

                for (int i = 0; i < m_dstInfo.DataCols.Length; i++)
                {
                    newrec.SeekValue(m_srcInfo.KeyCols.Length + m_srcInfo.DataCols.Length + i);
                    endst.Current.ReadValue(m_srcInfo.KeyCols.Length + i);
                    endst.Current.WriteTo(newrec);
                }

                yield return(newrec);
            }
        }