private void btnAddProduct_Click(object sender, EventArgs e) { DatabaseUtilities.DBConnection db = new DatabaseUtilities.DBConnection(); if (tbxProductName.Text != "" || tbxPrice.Text != "") { Product p = new Product(tbxProductName.Text, Double.Parse(tbxPrice.Text), tbxDescription.Text); if (db.AddProductToDataBase(p)) { MessageBox.Show("Product added successfully."); parent.updateProductLists(); this.Close(); } else { MessageBox.Show("Addition failed."); } } else { MessageBox.Show("Cannot add, be sure name and price are filled."); } }
private void UserListGUI_Load(object sender, EventArgs e) { DatabaseUtilities.DBConnection db = new DatabaseUtilities.DBConnection(); lbxUsers.DataSource = db.SelectSpecificFromTable("email", "customer"); }