private void Connection() { try { Connecting = true; pepButton1.Enabled = false; MySqlConnection myDataBase = DBUtils.GetDBConnection(pepTextbox1.Text, pepTextbox2.Text); myDataBase.Open(); myDataBase.Close(); if (pepTextbox1.Text == "storekeep") { StoreKeeperWindow obj = new StoreKeeperWindow(myDataBase, this, pepTextbox1.Text, pepTextbox2.Text); obj.Show(); this.Visible = false; this.Close(); } } catch (Exception ex) { CustomPopup obj = new CustomPopup("Unable to connect to the database : " + ex.Message); obj.Show(this); } pepTextbox1.Text = ""; pepTextbox2.Text = ""; pepButton1.Enabled = true; Connecting = false; }
private void button2_Click(object sender, EventArgs e) { if (MainTreeview.CheckIfAllCupboardAreVerified()) { CustomerView = new CreateCustomer(DataBase, this); CustomerView.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(CustomerView); CustomerView.BringToFront(); } else { CustomPopup obj = new CustomPopup("Please check each cupboard before confirming your order"); obj.Show(this); } }