private void buttonRefresh_Click(object sender, EventArgs e) { if (x == 1) { dataGridView.DataSource = DishesDbController.GetDishes(); dataGridView.Refresh(); } if (x == 2) { dataGridView.DataSource = RecipeDbController.GetRecipes(); dataGridView.Refresh(); } if (x == 3) { dataGridView.DataSource = PurchaseDbController.GetPurchases(); dataGridView.Refresh(); } if (x == 4) { dataGridView.DataSource = SaleDbController.GetSales(); dataGridView.Refresh(); } if (x == 5) { dataGridView.DataSource = ProductDbController.GetProducts(); dataGridView.Refresh(); } if (x == 6) { dataGridView.DataSource = LayoutDbController.GetLayouts(); dataGridView.Refresh(); } }
private void DeleteButton_Click(object sender, EventArgs e) { if (textBoxId.Text != "") { if (number == 1) { ProductDbController.DeleteProduct(int.Parse(textBoxId.Text)); } if (number == 2) { DishesDbController.DeleteDish(int.Parse(textBoxId.Text)); } if (number == 3) { LayoutDbController.DeleteLayout(int.Parse(textBoxId.Text)); } if (number == 4) { RecipeDbController.DeleteRecipe(int.Parse(textBoxId.Text)); } if (number == 5) { PurchaseDbController.DeletePurchase(int.Parse(textBoxId.Text)); } if (number == 6) { SaleDbController.DeleteSale(int.Parse(textBoxId.Text)); } } else { MessageBox.Show("All fields must be filled! Please try again)"); } }
public void DeleteProductTestMethod() { bool resAdd = ProductDbController.AddProduct("Potato", "gr"); Assert.IsTrue(resAdd); List <Product> list = ProductDbController.GetProducts(); int count = list.Count; bool resDel = ProductDbController.DeleteProduct(list[count - 1].Id); Assert.IsTrue(resDel); Assert.AreEqual(ProductDbController.GetProducts().Count, --count); }
private void AddButton_Click(object sender, EventArgs e) { if (textBoxName.Text != "" && textBoxUnit.Text != "") { ProductDbController.AddProduct(textBoxName.Text, textBoxUnit.Text); MessageBox.Show("Success"); } else { MessageBox.Show("All fields must be filled! Please try again)"); } }
public void AddProductTestMethod() { List <Product> list = ProductDbController.GetProducts(); int count = list.Count; bool res = ProductDbController.AddProduct("Potato", "gr"); Assert.AreEqual(res, true); List <Product> resList = ProductDbController.GetProducts(); Assert.AreEqual(resList.Count, ++count); Assert.AreEqual(resList[count - 1].Name, "Potato"); Assert.AreEqual(resList[count - 1].Unit, "gr"); }
private void productsToolStripMenuItem_Click(object sender, EventArgs e) { labelTittle.Text = "Table Products"; dataGridView.DataSource = ProductDbController.GetProducts(); x = 5; }
public void SelectProductsTestMethod() { List <Product> list = ProductDbController.GetProducts(); Assert.IsTrue(list != null); }