Exemplo n.º 1
0
 internal void ApplyTo(Db2Source.Row target, ColumnInfo[] columns, bool ignoreNull)
 {
     for (int i = 0; i < columns.Length; i++)
     {
         ColumnInfo col = columns[i];
         object     obj = Cells[i].Data;
         if (ignoreNull && (obj == null || (obj is string) && string.IsNullOrEmpty((string)obj)))
         {
             continue;
         }
         target[col.Index] = obj;
     }
 }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
            }
        }