private void ShowEditColumn() { try { if (this.SelectedColumn == null) { MessageBox.Show("Column not selected"); return; } ColumnsEdit columnEdit = new ColumnsEdit(this.SelectedColumn, this.Table.TableName); bool?result = columnEdit.ShowDialog(); if (result.IsFalse()) { return; } this.TableColumnChanged?.Invoke(this, this.SelectedColumn); } catch (Exception err) { MessageBox.Show(err.GetFullExceptionMessage()); } }
private void ShowAddColumn() { try { ColumnObjectModel column = new ColumnObjectModel { Column_Id = int.MaxValue }; ColumnsEdit columnEdit = new ColumnsEdit(column, this.Table.TableName); bool?result = columnEdit.ShowDialog(); if (result == null || !result.Value) { return; } column.HasModelChanged = false; // This is to clear the model changes values. Especialy for new column creation this.Table.Columns = this.Table.Columns.Add(columnEdit.Column); Integrity.MapColumn(column, this.Table.TableName); if (column.IsForeignkey) { this.ForeignKeyColumnAdded?.Invoke(this, column); } this.TableColumnChanged?.Invoke(this, column); } catch (Exception err) { MessageBox.Show(err.GetFullExceptionMessage()); } }