Exemplo n.º 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();
     }
 }
Exemplo n.º 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)");
     }
 }
Exemplo n.º 3
0
        public void DeleteLayoutTestMetod()
        {
            bool resAdd = LayoutDbController.AddLayout(1, 1, 100.5);

            Assert.IsTrue(resAdd);
            List <Layout> list   = LayoutDbController.GetLayouts();
            int           count  = list.Count;
            bool          resDel = LayoutDbController.DeleteLayout(list[count - 1].Id);

            Assert.IsTrue(resDel);
            Assert.AreEqual(LayoutDbController.GetLayouts().Count, --count);
        }
Exemplo n.º 4
0
        public void AddLayoutTestMethod()
        {
            List <Layout> list  = LayoutDbController.GetLayouts();
            int           count = list.Count;
            bool          res   = LayoutDbController.AddLayout(1, 1, 100.5);

            Assert.IsTrue(res);
            List <Layout> newList = LayoutDbController.GetLayouts();

            Assert.AreEqual(newList.Count, ++count);
            Assert.AreEqual(newList[count - 1].IdDish, 1);
            Assert.AreEqual(newList[count - 1].IdProduct, 1);
            Assert.AreEqual(newList[count - 1].Quantity, 100.5);
        }
Exemplo n.º 5
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     if (textBoxDishId.Text != "" && textBoxProductId.Text != "" && textBoxQuantity.Text != "")
     {
         if (double.Parse(textBoxQuantity.Text) > 0)
         {
             LayoutDbController.AddLayout(int.Parse(textBoxDishId.Text), int.Parse(textBoxProductId.Text), double.Parse(textBoxQuantity.Text));
             MessageBox.Show("Success");
         }
         else
         {
             MessageBox.Show("Quantity can not be negative! Please try again)");
             textBoxQuantity.Text = "";
         }
     }
     else
     {
         MessageBox.Show("All fields must be filled! Please try again)");
     }
 }
Exemplo n.º 6
0
 private void layoutsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     labelTittle.Text        = "Table Layouts";
     dataGridView.DataSource = LayoutDbController.GetLayouts();
     x = 6;
 }
Exemplo n.º 7
0
        public void SelectLayoutTestMethod()
        {
            List <Layout> list = LayoutDbController.GetLayouts();

            Assert.IsTrue(list != null);
        }