internal void ShowColumnsMDforSelectedTable(SMO1.MainForm myForm) { DataRowView[] columnsRows = myForm._ColumnsView.FindRows(new object[] { myForm._SelectedTableIdTable }); myForm._SelectedTableColumns = columnsRows; if (columnsRows.Length == 0) { Console.WriteLine("No match found."); } else { myForm.listBox2.Items.Clear(); foreach (DataRowView myDRV in columnsRows) { // populate the column list box myForm.listBox2.Items.Add(myDRV["FieldName"].ToString()); } // refresh columns property grid myForm._atv.RefreshColumnMD(myForm, myForm._SelectedColumnColumnName); myForm.prGridColumnsMD.SelectedObject = myForm._myColumnMD; // refresh labels on the form myForm.labelSelectedColumnName.Text = '(' + myForm._myColumnMD.ColumnName + ')'; myForm.labelNoOfColumns.Text = '(' + columnsRows.Length.ToString() + ')'; } }
internal void ShowMDforSelectedTable(SMO1.MainForm myForm) { int rowIndex = myForm._TablesView.Find(myForm._SelectedTableTableName); if (rowIndex == -1) { Console.WriteLine("No match found."); } else { myForm._myTableMD.id = myForm._TablesView[rowIndex]["idTableMD"].ToString(); myForm._myTableMD.TableName = myForm._TablesView[rowIndex]["TableName"].ToString(); myForm._myTableMD.TableCaption = myForm._TablesView[rowIndex]["Caption"].ToString(); myForm._myTableMD.TableDescription = myForm._TablesView[rowIndex]["TableDesc"].ToString(); myForm._myTableMD.IsVisible = GetBoolean(myForm._TablesView[rowIndex]["IsVisible"].ToString()); // Update fields on the form myForm.labelPanelTitle.Text = myForm._myTableMD.TableName.ToString(); myForm.textName.Text = myForm._myTableMD.TableName.ToString(); myForm.textCaption.Text = myForm._myTableMD.TableCaption.ToString(); myForm.textType.Text = "data"; myForm.textDescription.Text = myForm._myTableMD.TableDescription.ToString(); myForm.prGridTableMD.SelectedObject = myForm._myTableMD; // Refresh columns ShowColumnsMDforSelectedTable(myForm); } }
// internal void RefreshColumnMD(SMO1.MainForm myForm, string mySelected) { foreach (DataRowView myDRV in myForm._SelectedTableColumns) { if (myDRV.Row.ItemArray[2].ToString() == mySelected) { myForm._myColumnMD.id = myDRV.Row.ItemArray[0].ToString(); myForm._myColumnMD.ColumnName = myDRV.Row.ItemArray[2].ToString(); myForm._myColumnMD.ColumnCaption = myDRV.Row.ItemArray[4].ToString(); myForm._myColumnMD.ColumnDescription = myDRV.Row.ItemArray[3].ToString(); myForm._myColumnMD.IsVisible = myForm._atv.GetBoolean(myDRV.Row.ItemArray[2].ToString()); myForm._myColumnMD.ColumnType = myDRV.Row.ItemArray[6].ToString(); myForm._myColumnMD.ColumnPosition = myDRV.Row.ItemArray[5].ToString(); return; } } }