예제 #1
0
 public Stall searchStall(String name)
 {
     for (int i = 0; i < stalls.Count(); i++)
     {
         Stall checkingStall = stalls.ElementAt <Stall>(i);
         if (checkingStall.getName() == name)
         {
             return(checkingStall);
         }
     }
     return(null);
 }
예제 #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);
            }
        }
예제 #3
0
        public bool addStall(int id, String name, LinkedList <Food> foods)
        {
            for (int i = 0; i < stalls.Count(); i++)
            {
                Stall checkingStall = stalls.ElementAt <Stall>(i);
                if (checkingStall.getName() == name)
                {
                    return(false);
                }
            }
            Stall newStall = new Stall(id, name, foods);

            stalls.AddLast(newStall);
            count++;
            return(true);
        }