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 = ""; } }
private void updateoBtn_Click(object sender, EventArgs e) { ProductOrderOperations po = new ProductOrderOperations(); Order ord = new Order(); ord = retrieveOrder(); po.updateOrder(ord); }
private void deleteBtn_Click(object sender, EventArgs e) { ProductOrderOperations po = new ProductOrderOperations(); Product prod = new Product(); prod = retrieve(); po.deleteProduct(prod); }
private void viewBtn_Click(object sender, EventArgs e) { ProductOrderOperations po = new ProductOrderOperations(); dataGridView1.DataSource = po.view(); }
private Order getOrder(int id) { ProductOrderOperations po = new ProductOrderOperations(); return(po.getOrder(id)); }