void init(DataTable pTableSource, DataTable pTableDest, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, UpdateTypeFlags pFlags, IRowValidator pValidator, string[] pTriggerCols) { validator = (pValidator == null) ? new RowValidatorTrue() : pValidator; tableSource = pTableSource; tableDest = pTableDest; flags.flagEnable(pFlags); source = pSource; triggerCols = pTriggerCols; bindChildCol = pBindChildCol; bindParentCol = pBindParentCol; childCol = pChildCol; parentCol = pParentCol; allChildCol = childCol; allParentCol = parentCol; // for (int i = 0; i < bindChildCol.Length; ++i) { addColForMapBind(bindChildCol[i], bindParentCol[i]); } for (int i = 0; i < childCol.Length; ++i) { addColForMapData(childCol[i], parentCol[i]); } // if (flags.isFlagEnabled(UpdateTypeFlags.activeOnRelColumn)) { columns = bindChildCol; } else { int len = allChildCol.Length; if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols)) { len -= 1; } else if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols)) { len -= 2; } else if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols)) { len -= 3; } columns = new string[len]; Array.Copy(allChildCol, columns, len); } columns = ToolArray.merge <string>(columns, triggerCols); // // if (flags.isFlagEnabled(UpdateTypeFlags.updateIgnoreRelColumn)) updateChildCol = childCol; // else // updateChildCol = allChildCol; //!!!!!!!!!!!!!!!!!!!!!!!!!!! }
void init(DataTable pTable, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, UpdateTypeFlags pFlags, IRowValidator pValidator, string[] pTriggerCols) { flags.flagEnable(pFlags); source = pSource; for (int i = pChildCol.Length; i < pParentCol.Length; ++i) { pChildCol = ToolArray.resize <string>(pChildCol, pChildCol.Length + 1); pChildCol[pChildCol.Length - 1] = string.Empty; } for (int i = 0; i < pParentCol.Length; ++i) { if ((pChildCol[i] == string.Empty) || (pChildCol[i] == null)) { pChildCol[i] = ToolColumn.getColumnFullName(source.getBuilder().getName(), pParentCol[i]); } } triggerCols = pTriggerCols; bindChildCol = pBindChildCol; bindParentCol = pBindParentCol; childCol = pChildCol; parentCol = pParentCol; allChildCol = new string[bindChildCol.Length + childCol.Length]; bindChildCol.CopyTo(allChildCol, 0); childCol.CopyTo(allChildCol, bindChildCol.Length); allParentCol = new string[bindParentCol.Length + parentCol.Length]; bindParentCol.CopyTo(allParentCol, 0); parentCol.CopyTo(allParentCol, bindParentCol.Length); // for (int i = 0; i < bindChildCol.Length; ++i) { addColForMap(bindChildCol[i], bindParentCol[i]); } for (int i = 0; i < childCol.Length; ++i) { addColForMap(childCol[i], parentCol[i]); } // if (flags.isFlagEnabled(UpdateTypeFlags.activeOnRelColumn)) { columns = bindChildCol; } else { int len = allChildCol.Length; if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast1DrivedChilCols)) { len -= 1; } else if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast2DrivedChilCols)) { len -= 2; } else if (flags.isFlagEnabled(UpdateTypeFlags.activateIgnorLast3DrivedChilCols)) { len -= 3; } columns = new string[len]; Array.Copy(allChildCol, columns, len); } columns = ToolArray.merge <string>(columns, triggerCols); // if (flags.isFlagEnabled(UpdateTypeFlags.updateIgnoreRelColumn)) { updateChildCol = childCol; } else { updateChildCol = allChildCol; } //!!!!!!!!!!!!!!!!!!!!!!!!!!! // for (int i = 0; i < allChildCol.Length; ++i) { if (!tableSource.Columns.Contains(allChildCol[i])) { tableSource.Columns.Add(allChildCol[i], ToolTypeSet.helper.tObject);//check// source.getBuilder().getColumnType(allParentCol[i])); } } // try { flags.flagEnable(UpdateTypeFlags.__spe__updateIfDrived); for (int i = 0; i < tableSource.Rows.Count; ++i) { refresh(tableSource.Rows[i]); } } finally { flags.flagDisable(UpdateTypeFlags.__spe__updateIfDrived); } // tableSource.ColumnChanged += new DataColumnChangeEventHandler(table_ColumnChanged); }
public CellAutomationSpaceDB(DataTable pTableSource, DataTable pTableDest, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, UpdateTypeFlags pFlags, IRowValidator pValidator) { init(pTableSource, pTableDest, pSource, pBindChildCol, pBindParentCol, pChildCol, pParentCol, pFlags, pValidator, new string[0]); }
public RowColumnsBindingDBRelations(DataTable pTable, IPagedSource pSource, string[] pBindChildCol, string[] pBindParentCol, string[] pChildCol, string[] pParentCol, string[] pTriggerCols, UpdateTypeFlags pFlags, IRowValidator pValidator) : base(pTable, null, pValidator) { init(pTable, pSource, pBindChildCol, pBindParentCol, pChildCol, pParentCol, pFlags, pValidator, pTriggerCols); }