private void btnAddFood_Click(object sender, EventArgs e) { if (cbFood.Text != "") { Food selectFood = stallDatabase.searchStall(cbStall.Text).getFood(cbFood.Text); order(selectFood, stallDatabase.searchStall(cbStall.Text), (int)cbAmount.Value); cbFood.Text = ""; cbAmount.Value = 1; } }
public void orderFood(int id, int stallID, int count, StallDatabase database) { Food food = database.searchStall(stallID).getFood(id); food.amount = count; foods.AddLast(food); this.cost += food.price * count; }
private void btnRemoveCheck_Click(object sender, EventArgs e) { if (txtStallID.Text == "") { lblRemoveNotification.ForeColor = Color.Red; lblRemoveNotification.Text = "Vui lòng nhập ID!"; } else { if (stallDatabase.searchStall((int)Double.Parse(txtStallID.Text)) == null) { lblRemoveNotification.ForeColor = Color.Red; lblRemoveNotification.Text = "Cửa hàng không tồn tại!"; } else { lblRemoveNotification.ForeColor = Color.Black; lblRemoveNotification.Text = "Bạn sắp xóa cửa hàng " + stallDatabase.searchStall((int)Double.Parse(txtStallID.Text)).getName() + ".\nBạn có thực sự muốn xóa cửa hàng này?"; } } }