Esempio n. 1
0
        private void addproducttoorderBtn_Click(object sender, EventArgs e)
        {
            int idorder   = Convert.ToInt32(idoTxt.Text);
            int idproduct = Convert.ToInt32(idproductTxt.Text);
            int iduser    = Convert.ToInt32(iduserTxt.Text);
            int quantity  = Convert.ToInt32(quantityTxt.Text);


            Product      prod = getProduct(idproduct);
            Order        ord  = getOrder(idorder);
            OrderDetails ordd = new OrderDetails();

            ordd.idorder   = ord.idOrder;
            ordd.idproduct = prod.idproduct;
            ordd.iduser    = iduser;
            ordd.quantity  = quantity;
            ordd.price     = ordd.quantity * prod.price;

            ProductOrderOperations po = new ProductOrderOperations();
            bool t = po.addProdOrder(ord, prod, ordd);

            if (t == false)
            {
                lbl.Text = "Quantity too big!";
            }
            else
            {
                lbl.Text = "";
            }
        }
Esempio n. 2
0
        private void updateoBtn_Click(object sender, EventArgs e)
        {
            ProductOrderOperations po = new ProductOrderOperations();
            Order ord = new Order();

            ord = retrieveOrder();
            po.updateOrder(ord);
        }
Esempio n. 3
0
        private void deleteBtn_Click(object sender, EventArgs e)
        {
            ProductOrderOperations po = new ProductOrderOperations();
            Product prod = new Product();

            prod = retrieve();
            po.deleteProduct(prod);
        }
Esempio n. 4
0
        private void viewBtn_Click(object sender, EventArgs e)
        {
            ProductOrderOperations po = new ProductOrderOperations();

            dataGridView1.DataSource = po.view();
        }
Esempio n. 5
0
        private Order getOrder(int id)
        {
            ProductOrderOperations po = new ProductOrderOperations();

            return(po.getOrder(id));
        }