private void order_btn_Click(object sender, EventArgs e) { if (order && room.getByID(Convert.ToInt32(id_tb.Text)).status == "Full") { Consume consume = new Consume() { roomID = Convert.ToInt32(id_tb.Text), roomName = name_tb.Text, productID = Convert.ToInt32(show_dgv.CurrentRow.Cells[0].Value), productName = show_dgv.CurrentRow.Cells[1].Value.ToString().Trim(), date = DateTime.Now.Date }; int _consume = Convert.ToInt32(quantity_tb.Text); if ((_consume > 0) && (_consume <= product.getByID(Convert.ToInt32(show_dgv.CurrentRow.Cells[0].Value)).quantity)) { consume.consume = _consume; } else { MessageBox.Show("Invalid Quantity", "", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (consume.addConsume(consume)) { product.editProductByConsume(Convert.ToInt32(show_dgv.CurrentRow.Cells[0].Value), _consume); this.showDGV(product.getAllProduct(), 5); MessageBox.Show("Add Successfully", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Add Failed", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }