Exemple #1
0
        void BtAddFoodClick(object sender, EventArgs e)

        {
            int    monInt  = 0;
            string loaiStr = cbFoodCategory.Text;
            int    loaiInt = (int)cbFoodCategory.SelectedValue;
            string monStr  = cbFood.Text;

            if (cbFood.Items.Count > 0)
            {
                monInt = (int)cbFood.SelectedValue;
            }
            int quantity = Decimal.ToInt32(nbFood.Value);

            if (monInt != 0 && loaiInt != 0 && !String.IsNullOrEmpty(tbIdBill.Text))
            {
                // inssert into billinfo
                int idBillNew = new BillInfoBUS().insert(Convert.ToInt32(tbIdBill.Text.ToString()), monInt, quantity, Convert.ToInt32(tbTableId.Text));
                if (tbIdBill.Text == "-1")
                {
                    addItemListFood(idBillNew);
                    tbIdBill.Text = idBillNew.ToString();
                }
                else
                {
                    addItemListFood(Convert.ToInt32(tbIdBill.Text));
                }
                nbFood.Value = 1;
                //set staus table
                if (tbTableStatus.Text == "0")
                {
                    //id bàn
                    int idtable = Convert.ToInt32(tbTableId.Text);
                    new TableBUS().update(idtable, tbtableName.Text, "1");
                    load();
                }
            }
            else
            {
                MessageBox.Show("Chưa chọn loại, chọn bàn hoặc món");
            }
        }
Exemple #2
0
        private void addItemListFood(int idTable)
        {
            listView1.Items.Clear();
            int i = 1;
            //decimal tongtien=0;
            List <BillInfo> lBI = new BillInfoBUS().getBillInfo(idTable);

            foreach (BillInfo item in lBI)
            {
                ListViewItem lvItem = new ListViewItem(i.ToString());
                i++;
                lvItem.SubItems.Add(new FoodBUS().getFood(item.IdFood).Name.ToString());
                lvItem.SubItems.Add(item.Count1.ToString());
                decimal price = new FoodBUS().getFood(item.IdFood).Price *item.Count1;

                lvItem.SubItems.Add(String.Format("{0:0,0}", price));
                listView1.Items.Add(lvItem);
            }
            //tbSumPrice.Text = String.Format("{0:0,0}", tongtien);
        }