コード例 #1
0
 private void cmbtype_SelectedIndexChanged(object sender, EventArgs e)
 {
     rpnl4.Visible = false;
     rpnl3.Visible = false;
     if (cmbtype.SelectedItem.ToString() == "ALL")
     {
         rpnl2.Visible = true;
         rpnl5.Visible = false;
         type          = "all";
     }
     else if (cmbtype.SelectedItem.ToString() == "TAKE-AWAY")
     {
         rpnl2.Visible = true;
         rpnl5.Visible = false;
         type          = "takeaway";
     }
     else if (cmbtype.SelectedItem.ToString() == "DINE")
     {
         rpnl2.Visible = true;
         rpnl5.Visible = false;
         type          = "dine";
     }
     else if (cmbtype.SelectedItem.ToString() == "DELIVERY")
     {
         rpnl2.Visible = true;
         rpnl5.Visible = false;
         type          = "delivery";
     }
     else if (cmbtype.SelectedItem.ToString() == "CATEGORY")
     {
         rpnl2.Visible = false;
         rpnl5.Visible = true;
         type          = "category";
         DatabaseManager dbmanager = new DatabaseManager();
         string[]        cate      = dbmanager.getCategory();
         rcmb1.Items.Clear();
         rcmb1.Text = "Select a Category";
         try
         {
             for (int i = 0; i <= cate.Length; i++)
             {
                 rcmb1.Items.Add(cate[i]);
             }
         }
         catch
         {
         }
     }
     else if (cmbtype.SelectedItem.ToString() == "ITEM")
     {
         rpnl2.Visible = false;
         rpnl5.Visible = true;
         type          = "item";
         rcmb1.Items.Clear();
         rcmb1.Text = "Select an Item";
         DatabaseManager dbmanager = new DatabaseManager();
         string[]        items     = dbmanager.rgetitems();
         try
         {
             for (int j = 0; j < items.Length; j++)
             {
                 rcmb1.Items.Add(items[j]);
                 rcmb1.Refresh();
             }
         }
         catch { }
     }
 }