コード例 #1
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);
        }
コード例 #2
0
        void CbFoodCategorySelectedIndexChanged(object sender, EventArgs e)

        {
            int       id = cbFoodCategory.SelectedIndex;
            DataTable dt = new FoodBUS().getFoodByCate(id);

            if (dt.Rows.Count > 0)
            {
                cbFood.DataSource    = dt;
                cbFood.DisplayMember = "name";
                cbFood.ValueMember   = "id";
            }
            else
            {
                cbFood.DataSource = null;
            }


            //MessageBox.Show(cbFoodCategory.SelectedIndex.ToString());
        }