コード例 #1
0
        private void addFood(Object sender, EventArgs e, string foodId, int foodPrice)
        {
            billDTO dto = new billDTO();

            //create tempcartid

            dto.billId   = txt_NumberBill.Text;
            dto.tableId  = tableId;
            dto.username = userlogin.USERNAME;
            //update ordinal number
            ordinal           = ordinal + 1;
            dto.ordinalNumber = ordinal;
            dto.foodId        = foodId;
            dto.cost          = foodPrice;
            dto.quantity      = quantity;
            dto.date          = DateTime.Now;
            dto.status        = "USING";
            //set table status
            tableDTO table = new tableDTO();

            table.status  = "USING";
            table.tableID = tableId;
            tableBO tablebo = new tableBO();

            tablebo.setTableStatus(table);
            //

            billBO billbo = new billBO();
            int    result = billbo.addFood(dto);

            quantity = 1;
            if (result != -1)
            {
                loadingGridView();
            }

            else
            {
                MessageBox.Show("Đã có lỗi xảy ra, vui lòng kiểm tra lại", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }