示例#1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (cbStall.Text != "")
     {
         vbOrderView.Items.Clear();
         cbFood.Items.Clear();
         Stall selectStall = stallDatabase.searchStall(cbStall.Text);
         if (selectStall.getFoodList().Count == 0)
         {
             lblNoFood.Show();
         }
         else
         {
             lblNoFood.Hide();
         }
         for (int i = 0; i < selectStall.getFoodList().Count; i++)
         {
             string[] arr = new string[3];
             arr[0] = selectStall.getFoodList().ElementAt <Food>(i).id.ToString();
             arr[1] = selectStall.getFoodList().ElementAt <Food>(i).name;
             arr[2] = selectStall.getFoodList().ElementAt <Food>(i).price.ToString();
             ListViewItem l1 = new ListViewItem(arr);
             vbOrderView.Items.Add(l1);
             cbFood.Items.Add(selectStall.getFoodList().ElementAt <Food>(i).name);
         }
     }
 }
示例#2
0
        private void btnStallInfo_Click(object sender, EventArgs e)
        {
            //Add food
            lbl1.Hide();
            lbl2.Hide();
            lbl3.Hide();
            txtFoodID.Hide();
            txtFoodName.Hide();
            txtCost.Hide();
            btnAdd.Hide();
            lblAddFoodNotification.Hide();
            lblAddFoodNotification.Text = "";

            //View food
            lbl4.Show();
            lbl5.Show();
            lbl6.Show();
            lblStallID.Show();
            lblStallName.Show();
            vbFoodList.Show();

            //View report
            vbReport.Hide();

            vbFoodList.Items.Clear();
            lblStallID.Text   = myStall.getID().ToString();
            lblStallName.Text = myStall.getName();
            for (int i = 0; i < myStall.getFoodList().Count; i++)
            {
                Food     food = myStall.getFoodList().ElementAt <Food>(i);
                string[] arr  = new string[3];
                arr[0] = food.id.ToString();
                arr[1] = food.name;;
                arr[2] = food.price.ToString();
                ListViewItem l1 = new ListViewItem(arr);
                vbFoodList.Items.Add(l1);
            }
        }