Exemple #1
0
        private void Merge()
        {
            int n = Cells.Length;

            for (int i = UseExplicitHeader ? 1 : 0; i < n; i++)
            {
                Row           row    = Cells[i];
                object[]      keys   = row.GetDataArray(KeyIndexes);
                Db2Source.Row target = Controller.Rows.FindRowByOldKey(keys);
                if (target == null)
                {
                    target = Controller.Rows.FindRowByKey(keys);
                }
                if (target == null)
                {
                    target = new Db2Source.Row(Controller);
                    Controller.Rows.Add(target);
                }
                row.ApplyTo(target, Fields, IgnoreEmptyCell);
            }
        }
Exemple #2
0
        private void Overwrite()
        {
            DataGrid grid = Controller.Grid;
            object   obj  = grid.CurrentItem;
            int      n    = grid.Items.Count;
            int      i0   = (obj != null) ? grid.Items.IndexOf(obj) : n;

            for (int i = UseExplicitHeader ? 1 : 0; i < Cells.Length; i++)
            {
                Row           row    = Cells[i];
                Db2Source.Row target = null;
                if (i0 + i < n)
                {
                    target = grid.Items[i0 + i] as Db2Source.Row;
                }
                if (target == null)
                {
                    target = new Db2Source.Row(Controller);
                    Controller.Rows.Add(target);
                }
                row.ApplyTo(target, Fields, IgnoreEmptyCell);
            }
        }