public ColumnPairEntity(ColumnEntity parentColumn, ColumnEntity childColumn) { this.parentColumn = parentColumn; this.childColumn = childColumn; //this.parentTableName = parentTable.GetName(); //this.childTableName = childTable.GetName(); }
public List <JoinControl> DeleteColumnAndAllDependencies(TableEntity te, ColumnEntity ce) { List <JoinControl> deleted = new List <JoinControl>(); // delete join pairs / controls List <JoinControl> joinsTemp = new List <JoinControl>(joins); foreach (JoinControl jc in joinsTemp) { List <ColumnPairEntity> joinPairsTemp = new List <ColumnPairEntity>(jc.GetJoinEntity().GetJoinPairs()); foreach (ColumnPairEntity cpe in joinPairsTemp) { if (cpe.GetParentColumn() == ce || cpe.GetChildColumn() == ce) { jc.GetJoinEntity().GetJoinPairs().Remove(cpe); } } if (jc.GetJoinEntity().GetJoinPairs().Count == 0) { joins.Remove(jc); deleted.Add(jc); } } // delete join entities List <JoinEntity> joinEntitiesTemp = new List <JoinEntity>(joinEntities); foreach (JoinEntity je in joinEntitiesTemp) { foreach (JoinControl jc in deleted) { if (je == jc.GetJoinEntity()) { joinEntities.Remove(je); } } } // delete columns List <ColumnEntity> columnEntitiesTemp = new List <ColumnEntity>(te.GetColumns()); foreach (ColumnEntity column in columnEntitiesTemp) { if (ce == column) { te.GetColumns().Remove(column); } } return(deleted); }
public void RemoveColumnEntity(ColumnEntity ce) { if (tableColumns != null) { List <ColumnEntity> tableColumnsTemp = new List <ColumnEntity>(tableColumns); foreach (ColumnEntity ColumnEntity in tableColumnsTemp) { tableColumns.Remove(ColumnEntity); } } }
public void RemoveColumn(String columnName) { if (tableColumns != null) { foreach (ColumnEntity ColumnEntity in tableColumns) { if (ColumnEntity.GetColumnName() == columnName.ToUpper().Trim()) { tableColumns.Remove(ColumnEntity); } } } }
public bool AddColumn(String columnName, String columnType, int columnLength, bool columnIsUnique) { ColumnEntity exists = null; foreach (ColumnEntity ce in tableColumns) { if (ce.GetColumnName() == columnName.ToUpper().Trim()) { exists = ce; } } if (exists == null) { ColumnEntity ce = new ColumnEntity(columnName.ToUpper().Trim(), columnType.ToUpper().Trim(), columnLength, columnIsUnique); tableColumns.Add(ce); return(true); // ColumnEntity was added } else { return(false); // ColumnEntity wasnt added because it already exists } }
public void SetChildColumn(ColumnEntity childColumn) { this.childColumn = childColumn; }
public void SetParentColumn(ColumnEntity parentColumn) { this.parentColumn = parentColumn; }