public MainForm() { InitializeComponent(); toolStripStatusLabel4.Text = "Klar"; baseDB = new inventoryBaseEntities(); _appCore = new AppCore(); _appServiceExcel = new AppService_ExcelImport(); _appCore.OnUpdateStatus += new AppCore.StatusUpdateHandler(ShowLoadDBUpdate); _appServiceExcel.OnUpdateStatus += new AppService_ExcelImport.StatusUpdateHandler(ShowLoadExcelUpdate); _appEventlog = new AppEventLogger(); tabControl1.SelectedIndex = 1; try { baseDB.Database.Connection.Open(); } catch (Exception ex) { _appEventlog.writeError(ex.Message, ex.StackTrace); MessageBox.Show("Fejl i forbindelse til databasen! Se eventuelt eventlog", "Fejl", MessageBoxButtons.OK); System.Threading.Thread.Sleep(2000); EndApplication(); } //Preloading suppliers and productCatalog to Dictonaries in _appCore _appCore.preloadSuppliers(); _appCore.preloadProducCatalog(); }
private void textBox4_keyPress(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { AppCore core = new AppCore(); string city = core.getCity(textBox4.Text); if (!city.Equals(string.Empty)) { textBox5.ReadOnly = true; textBox5.Text = city; textBox6.Select(); } } }