コード例 #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
        public StallOwner(StaffAccount account, ReportDatabase reportDatabase, StallDatabase stallDatabase)
        {
            InitializeComponent();
            lblName.Text        = account.getName();
            this.stallDatabase  = stallDatabase;
            this.reportDatabase = reportDatabase;
            this.account        = account;
            this.myStall        = stallDatabase.getOwnerStall(account.getID());

            //Add food
            lbl1.Hide();
            lbl2.Hide();
            lbl3.Hide();
            txtFoodID.Hide();
            txtFoodName.Hide();
            txtCost.Hide();
            btnAdd.Hide();
            lblAddFoodNotification.Hide();
            lblAddFoodNotification.Text = "";

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

            //View report
            vbReport.Hide();
        }
コード例 #3
0
        public void order(Food food, Stall stall, int count)
        {
            string[] arr = new string[3];
            arr[0] = food.id.ToString();
            arr[1] = food.name;
            arr[2] = count.ToString();
            ListViewItem l1 = new ListViewItem(arr);

            vbCheckOrder.Items.Add(l1);
            myOrder.orderFood(food.id, stall.getID(), count, stallDatabase);
        }
コード例 #4
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);
 }
コード例 #5
0
 public Stall searchStall(int id)
 {
     for (int i = 0; i < stalls.Count(); i++)
     {
         Stall checkingStall = stalls.ElementAt <Stall>(i);
         if (checkingStall.getID() == id)
         {
             return(checkingStall);
         }
     }
     return(null);
 }
コード例 #6
0
 public bool removeStall(int id)
 {
     for (int i = 0; i < stalls.Count(); i++)
     {
         Stall checkingStall = stalls.ElementAt <Stall>(i);
         if (checkingStall.getID() == id)
         {
             stalls.Remove(checkingStall);
             count--;
             return(true);
         }
     }
     return(false);
 }
コード例 #7
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);
        }