예제 #1
0
 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();
     }
 }
예제 #2
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)");
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
 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)");
     }
 }
예제 #5
0
        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");
        }
예제 #6
0
 private void productsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     labelTittle.Text        = "Table Products";
     dataGridView.DataSource = ProductDbController.GetProducts();
     x = 5;
 }
예제 #7
0
        public void SelectProductsTestMethod()
        {
            List <Product> list = ProductDbController.GetProducts();

            Assert.IsTrue(list != null);
        }