Beispiel #1
0
 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 DeletePurchaseTestMethod()
        {
            bool resAdd = PurchaseDbController.AddPurchase(11, 15.5, 5, "kg");

            Assert.IsTrue(resAdd);
            List <Purchase> list   = PurchaseDbController.GetPurchases();
            int             count  = list.Count;
            bool            resDel = PurchaseDbController.DeletePurchase(list[count - 1].Id);

            Assert.IsTrue(resDel);
            Assert.AreEqual(PurchaseDbController.GetPurchases().Count, --count);
        }