private async void btnGenerate_Click(object sender, EventArgs e) { try { DisableControls(pnMain); DisableControls(pnLeft); DisableControls(pnBar); spGenerating.Enabled = true; lbGenerating.Enabled = true; spGenerating.Visible = true; lbGenerating.Visible = true; if (rbtnGenerateAll.Checked) { await new BLAsphyo.BLGenerator().FormatedBEUClass(this.Path, cboDatabases.Text, getSelectedTables(), chUseAsphyo.Checked, rbtnGenerateOnlyModels.Checked); await new BLAsphyo.BLGenerator().FormatedDAOClass(this.Path, cboDatabases.Text, getSelectedTables(), chUseAsphyo.Checked); } else { await new BLAsphyo.BLGenerator().FormatedBEUClass(this.Path, cboDatabases.Text, getSelectedTables(), chUseAsphyo.Checked, rbtnGenerateOnlyModels.Checked); } Excecuted(); MessageBoxOK.Show("All the tables has been generated success"); } catch (BEUExceptionBL ex) { Excecuted(); MessageBoxError.Show(ex.Message); } catch (Exception ex) { Excecuted(); MessageBoxError.Show(ex.Message); } }
private async void btnConnect_Click(object sender, EventArgs e) { try { SpinnerConnect.Visible = true; this.Enabled = false; switch ((BLDatabaseEngine.DataSource)cboEngine.SelectedItem) { case BLDatabaseEngine.DataSource.SqlServer: switch ((ConnectionTypes)cboAuthentication.SelectedItem) { case ConnectionTypes.WindowsAuthentication: BLDatabaseEngine.ChangeCredentials(new BEUAsphyo.Engines.BEUMicrosoftSQLServer() { IntegratedSecurity = true, DataSource = txtServerInstance.Text.Trim() }); break; case ConnectionTypes.SQL: BLDatabaseEngine.ChangeCredentials(new BEUAsphyo.Engines.BEUMicrosoftSQLServer() { IntegratedSecurity = false, DataSource = txtServerInstance.Text.Trim(), Password = txtPassword.Text.Trim(), Username = txtLogin.Text.Trim() }); break; } BLDatabaseEngine.EngineInUse = BLDatabaseEngine.DataSource.SqlServer; break; case BLDatabaseEngine.DataSource.MySQL: BLDatabaseEngine.ChangeCredentials(new BEUAsphyo.Engines.BEUMySQL() { ServerName = txtServerInstance.Text.Trim(), Username = txtLogin.Text.Trim(), Password = txtPassword.Text.Trim(), Port = Convert.ToUInt32((txtPort.Text == "") ? "3306" : txtPort.Text) }); BLDatabaseEngine.EngineInUse = BLDatabaseEngine.DataSource.MySQL; break; } if (await new BLServer().testConnection()) { this.DialogResult = DialogResult.OK; } } catch (BEUExceptionDAO ex) { MessageBoxError.Show(ex.Message); } catch (BEUExceptionBL ex) { MessageBoxError.Show(ex.Message); } catch (Exception ex) { MessageBoxError.Show(ex.Message); } SpinnerConnect.Visible = false; this.Enabled = true; }
private void createDemoDataButton_Click(object sender, EventArgs e) { if (MessageBoxQuestion.PromptDefaultNo("Delete all data and insert demo data?")) { try { ServerCommand.DeleteAllAndInsertDemoData(); MessageBoxInfo.Show("Done."); } catch (Exception ex) { MessageBoxError.Show(ex.ToString()); } } }
private void btnSavePath_Click(object sender, EventArgs e) { FolderBrowserDialog oForm = new FolderBrowserDialog(); oForm.RootFolder = Environment.SpecialFolder.MyComputer; oForm.Description = "Please, select the forder where you wanna save the Models"; oForm.ShowNewFolderButton = true; if ((oForm.ShowDialog() == DialogResult.OK)) { this.Path = oForm.SelectedPath; ToolTip yourToolTip = new ToolTip(); yourToolTip.SetToolTip(lbRoute, oForm.SelectedPath); lbRoute.Text = oForm.SelectedPath; } else { if (this.Path == "") { MessageBoxError.Show("Please, select a route"); } } }
private async void cboDatabases_SelectionChangeCommitted(object sender, EventArgs e) { try { this.RootDatabaseNode = new TreeNode(); this.TableSelect = new TreeView(); this.TableSelect.ForeColor = MetroColors.White; this.TableSelect.BackColor = this.BackColor; this.TableSelect.BorderStyle = System.Windows.Forms.BorderStyle.None; TableSelect.AfterCheck += (l, p) => { TreeNode parent = p.Node.Parent; if (p.Action == TreeViewAction.ByKeyboard || p.Action == TreeViewAction.ByMouse) { if (parent != null) { if (parent.Nodes.Cast <TreeNode>().Any(x => x.Checked == false)) { parent.Checked = false; } else { parent.Checked = true; } return; } if (parent is null) { foreach (TreeNode child in p.Node.Nodes) { child.Checked = p.Node.Checked; } return; } } }; List <String> ListTables = await new BLAsphyo.BLServer().getListTables(cboDatabases.Text); RootDatabaseNode.Text = cboDatabases.Text; foreach (String Table in ListTables) { RootDatabaseNode.Nodes.Add(new TreeNode(Table)); } TableSelect.Nodes.Add(RootDatabaseNode); TableSelect.CheckBoxes = true; TableSelect.ExpandAll(); TableSelect.Dock = DockStyle.Fill; pnTree.Controls.Clear(); pnTree.Controls.Add(TableSelect); EnableControls(pnMain); } catch (BEUExceptionDAO ex) { Excecuted(); MessageBoxError.Show(ex.Message); } catch (BEUExceptionBL ex) { Excecuted(); MessageBoxError.Show(ex.Message); } this.RootDatabaseNode.Nodes.Cast <TreeNode>().All(x => x.Checked = true); this.RootDatabaseNode.Checked = true; }