private void btnSaveXML_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); if (metadataReader == null) { MessageBox.Show("Connect to db first!"); } else { var _tables = metadataReader.GetTables(ownersComboBox.SelectedItem.ToString()); if (_tables.Count < 1) { MessageBox.Show("Connect to table first!"); return; } if (sfd.ShowDialog() == DialogResult.OK) { foreach (var item in _tables) { var gridData = metadataReader.GetTableDetails(item, ownersComboBox.SelectedItem.ToString()) ?? new List <Column>(); item.Columns = gridData; } AllTables at = new AllTables(); at.DataBaseName = _currentConnection.Name; at.Tables = _tables; at.Save(sfd.FileName); } } }
private void PopulateTableDetails(Table selectedTable) { errorLabel.Text = string.Empty; try { dbTableDetailsGridView.AutoGenerateColumns = true; gridData = metadataReader.GetTableDetails(selectedTable, ownersComboBox.SelectedItem.ToString()); dbTableDetailsGridView.DataSource = gridData; } catch (Exception ex) { errorLabel.Text = ex.Message; } }
private void TablesListSelectedIndexChanged(object sender, EventArgs e) { toolStripStatusLabel.Text = string.Empty; try { Cursor.Current = Cursors.WaitCursor; if (tablesListBox.SelectedIndex == -1) { dbTableDetailsGridView.DataSource = new List <Column>(); return; } var lastTableSelectedIndex = LastTableSelected(); if (lastTableSelectedIndex != null) { var table = tablesListBox.Items[lastTableSelectedIndex.Value] as Table; if (table != null) { // CaptureApplicationSettings(); PopulateTableDetails(table); // ToggleColumnsBasedOnAppSettings(applicationSettings); // GenerateAndDisplayCode(table); //// Display entity name based on formatted table name //var appPreferences = GetApplicationPreferences(table, false, applicationSettings); //var formatter = TextFormatterFactory.GetTextFormatter(appPreferences); //// entityNameTextBox.Text = formatter.FormatText(table.Name); metadataReader.GetTableDetails(table, ownersComboBox.SelectedItem.ToString()); CaptureMySetting(); Generate(table); } } } catch (Exception ex) { toolStripStatusLabel.Text = ex.Message; } finally { Cursor.Current = Cursors.Default; } }
private async Task PopulateTableDetails(Table selectedTable) { toolStripStatusLabel.Text = string.Empty; try { //dbTableDetailsGridView.AutoGenerateColumns = true; _currentTable = selectedTable; gridData = await metadataReader.GetTableDetails(selectedTable, ownersComboBox.SelectedItem.ToString()) ?? new List <Column>(); // Show table details, and toggle columns based on app settings dbTableDetailsGridView.SuspendLayout(); dbTableDetailsGridView.DataSource = gridData; dbTableDetailsGridView.ResumeLayout(); } catch (Exception ex) { toolStripStatusLabel.Text = ex.Message; } }
private void generateMapclass() { var Mapclasssettings = new Connection(); string mapTempPath = Path.GetTempPath(); if (mapTempPath.EndsWith(@"\") == false) { mapTempPath += @"\"; } mapTempPath += @"Mapping\"; if (Directory.Exists(mapTempPath) == false) { Directory.CreateDirectory(mapTempPath); } Mapclasssettings.Domainfolderpath = mapTempPath; Mapclasssettings.EntityName = "Entity"; if ((RecoEngine_BI.Common.iDBType) == (int)Enums.DBType.Oracle) { Mapclasssettings.ConnectionString = ConfigurationManager.AppSettings["ConnectionString"]; Mapclasssettings.Type = ServerType.Oracle; } else if ((RecoEngine_BI.Common.iDBType) == (int)Enums.DBType.Mysql) { Mapclasssettings.ConnectionString = ConfigurationManager.AppSettings["MysqlConnectionString"]; Mapclasssettings.Type = ServerType.Mysql; } // metadataReader = MetadataFactory.GetReader(Mapclasssettings.Type, Mapclasssettings.ConnectionString); var owners = metadataReader.GetOwners(); IList <Table> tblList = metadataReader.GetTables("RECOUSR"); int tableindex = 0; for (int i = 0; i < tblList.Count; i++) { if (tblList[i].Name == "OPPORTUNITY") { tableindex = i; break; } } Table table = tblList[tableindex]; table.PrimaryKey = metadataReader.DeterminePrimaryKeys(table); metadataReader.GetTableDetails(table, "RECOUSR"); var applicationPreferences = GetApplicationPreferences(table, false, Mapclasssettings); new ApplicationController(applicationPreferences, table).Generate(); }