private void btn_Calculate_Click(object sender, EventArgs e) { double res = 0; // res = (productPrice * quantity) * (salePercent/100) string ID = listOrder.SelectedRows[0].Cells[1].Value.ToString(); Drink_Model DRINK_MODEL = new Drink_Model(); int getMoney = DRINK_MODEL.GetPrice_FromID(ID); int quantity = (int)listOrder.SelectedRows[0].Cells[3].Value; int sale = (int)listOrder.SelectedRows[0].Cells[4].Value; double hihi = sale * 1.0 / 100; int temp = getMoney * quantity; res = temp - (temp * hihi); MessageBox.Show(res.ToString() + " VND", "Giá trị đơn hàng là", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btn_AddOrder_Click(object sender, EventArgs e) { Bill_Model BILL_MODEL = new Bill_Model(); Order_Model ORDER_MODEL = new Order_Model(); Drink_Model DRINK_MODEL = new Drink_Model(); string orderID = txt_OrderID.Text; string productID = DRINK_MODEL.GetID_FromName(cbx_Drinks.Text); int quantity = (int)num_Quantity.Value; int sale = (int)num_Sale.Value; BILL_MODEL.AddBill(orderID); ORDER_MODEL.AddOrder(orderID, productID, quantity, sale); MessageBox.Show("ADD ORDER SUCCESSFULLY!"); //obj.loadData_Order(); -> Use it when we want callback MainForm :D this.Close(); this.parentForm.Visible = true; }