Ejemplo n.º 1
0
 public static object[] getVallueArrayForTable(DataTable table)
 {
     object[] arr = new object[table.Columns.Count];
     for (int i = 0; i < table.Columns.Count; ++i)
     {
         arr[i] = ToolCell.getCellTypeDefaulValue(table.Columns[i].DataType);
     }
     return(arr);
 }
Ejemplo n.º 2
0
        public static DataRow initTableNewRow(DataRow row, string[] cols)
        {
            DataTable table = row.Table;

            for (int i = 0; i < cols.Length; ++i)
            {
                ToolCell.set(row, cols[i], ToolCell.getCellTypeDefaulValue(table.Columns[cols[i]].DataType));
            }
            return(row);
        }
Ejemplo n.º 3
0
 public static DataRow initTableNewRow(DataRow row)
 {
     if (row != null)
     {
         DataTable table = row.Table;
         for (int i = 0; i < table.Columns.Count; ++i)
         {
             ToolCell.set(row, i, ToolCell.getCellTypeDefaulValue(table.Columns[i].DataType));
         }
     }
     return(row);
 }
Ejemplo n.º 4
0
 public static void fillNull(DataTable table)
 {
     for (int c = 0; c < table.Columns.Count; ++c)
     {
         object defVal = ToolCell.getCellTypeDefaulValue(table.Columns[c].DataType);
         for (int r = 0; r < table.Rows.Count; ++r)
         {
             if (table.Rows[r].IsNull(c))
             {
                 table.Rows[r][c] = defVal;
             }
         }
     }
 }
 void tableD__ColumnChanged(object sender, DataRowChangeEventArgs e)
 {
     if (e.Action == DataRowAction.Add)
     {
         for (int d = 0; d < columnD_.Length; ++d)
         {
             ToolCell.set(e.Row, columnD_[d], ToolColumn.getColumnLastValue(tableS_, columnS_[d], ToolCell.getCellTypeDefaulValue(tableS_.Columns[columnS_[d]].DataType)));
         }
     }
 }
        public TablesColumnsBinding(DataTable tableS, DataTable tableD, string[] columnS, string[] columnD, bool inherit)
        {
            tableS_  = tableS;
            columnS_ = columnS;
            tableD_  = tableD;
            columnD_ = columnD;
            tableS_.ColumnChanged += new DataColumnChangeEventHandler(tableS__ColumnChanged);

            if (inherit)
            {
                tableD_.RowChanged += new DataRowChangeEventHandler(tableD__ColumnChanged);
            }

            for (int d = 0; d < columnD_.Length; ++d)
            {
                if (ToolColumn.isColumnFullName(columnD_[d]))
                {
                    ToolColumn.setColumnValue(tableD_, columnD_[d], ToolColumn.getColumnLastValue(tableS_, columnS_[d], ToolCell.getCellTypeDefaulValue(tableS_.Columns[columnS_[d]].DataType)));
                }
            }
        }