private void sQLServerToolStripMenuItem1_Click(object sender, EventArgs e) { var wizard = new FirstRunScreen(); wizard.ShowDialog(); try { SqlConnection connection = Connections.OwnDb(); _allRouters = Data.GetDataFromMicrosoftSql(connection, OwnServerServerQuery); if (_allRouters != null) { foreach (var router in _allRouters) { MainDataGridView.Rows.Add(false, router.RouterAlias, router.RouterAddress, "", router.RouterMainDb); // false is for checkbox is not checked } Log.Info("Loaded all routers to the application"); CommandoGB.Enabled = true; } else { Log.Info("Database details are wrong"); Log.Info("Please try entering the correct details using the sql wizard from the menubar"); MessageBox.Show("Er is geen sql database gevonden - herstart de applicatie of controleer de sql gegevens"); CommandoGB.Enabled = false; } } catch (Exception ex) { Log.Error("Database details are wrong - could not load routers from routerlist"); Log.Error("error message - " + ex.Message); Log.Error("Please try entering the correct details using the sql wizard from the menubar"); MessageBox.Show("Er is geen sql database gevonden - herstart de applicatie of controleer de sql gegevens"); CommandoGB.Enabled = false; } }
private void MainForm_Load(object sender, EventArgs e) { string version = Assembly.GetExecutingAssembly() .GetName() .Version .ToString(); Log.Info("Current version: " + version); if (_sqlip == "" && _sqlDatabase == "" && _sqlUsername == "" && _sqlPassword == "") { Log.Info("No database details available - asking user to enter database details"); var firstRunDialog = new FirstRunScreen(); firstRunDialog.ShowDialog(); } mainMenu.TabPages.Remove(RouterTab); try { SqlConnection connection = Connections.OwnDb(); _allRouters = Data.GetDataFromMicrosoftSql(connection, OwnServerServerQuery); if (_allRouters != null) { foreach (var router in _allRouters) { MainDataGridView.Rows.Add(false, router.RouterAlias, router.RouterAddress, "", router.RouterMainDb); // false is for checkbox is not checked } Log.Info("Loaded all routers to the application"); CommandoGB.Enabled = true; //select all box in header column Rectangle rectangle = this.MainDataGridView.GetCellDisplayRectangle(0, -1, true); selectAllCheckbox = new CheckBox() { Size = new Size(18, 18), Location = new Point(rectangle.Location.X + 9, rectangle.Location.Y + 3), }; selectAllCheckbox.CheckedChanged += new EventHandler(selectAllCheckbox_checkedChanged); this.MainDataGridView.Controls.Add(selectAllCheckbox); //End of select all code } else { Log.Info("Database details are wrong"); Log.Info("Please try entering the correct details using the sql wizard from the menubar"); MessageBox.Show("Er is geen sql database gevonden - herstart de applicatie of controleer de sql gegevens"); CommandoGB.Enabled = false; } } catch (Exception ex) { Log.Error("Database details are wrong - could not load routers from routerlist"); Log.Error("error message - " + ex.Message); Log.Error("Please try entering the correct details using the sql wizard from the menubar"); MessageBox.Show("Er is geen sql database gevonden - herstart de applicatie of controleer de sql gegevens"); CommandoGB.Enabled = false; } }