Example #1
0
        private void btnAddFood_Click(object sender, EventArgs e)
        {
            Table table = lsvBill.Tag as Table;

            if (table == null)
            {
                MessageBox.Show("Vui lòng chọn bàn");
                return;
            }

            int idBill = billBUS.GetUncheckBillIDByTableID(table.IdTable);
            int foodID = (int)dataGridViewListFood.CurrentRow.Cells["idFood"].Value;
            int count  = (int)nmFoodCount.Value;

            if (idBill == -1)
            {
                billBUS.InsertBill(table.IdTable);
                BillInforBUS.InsertBillInfo(billBUS.GetMaxIDBill(), foodID, count);
            }
            else
            {
                BillInforBUS.InsertBillInfo(idBill, foodID, count);
            }

            ShowBill(table.IdTable);
            LoadTable();
        }