Пример #1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex == 2)
     {
         lbxRoad.Items.Clear();
         string   No    = (lbxArea.SelectedItem as SomeData).Value;
         RoadInfo vRoad = new RoadInfo(APConfig.Conn);
         vRoad.Conditions  = " 1=1 ";
         vRoad.Conditions += " AND " + vRoad.getCondition(RoadInfo.ncConditions.AreaNo.ToString(), No);
         if (!string.IsNullOrEmpty(txtRoad.Text))
         {
             vRoad.Conditions += " AND " + vRoad.getCondition(RoadInfo.ncConditions.Name.ToString(), txtRoad.Text);
         }
         vRoad.load();
         List <SomeData> data = new List <SomeData>();
         while (!vRoad.IsEof)
         {
             lbxRoad.Items.Add(vRoad.ROD_NAME);
             vRoad.next();
         }
     }
     else if (tabControl1.SelectedIndex == 3)
     {
         RoadSearch();
     }
 }
Пример #2
0
 private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControl1.SelectedIndex == 1 && lbxCity.Items.Count > 0)
     {
         lbxArea.DataSource = null;
         string   No    = (lbxCity.SelectedItem as SomeData).Value;
         AreaInfo vArea = new AreaInfo(APConfig.Conn);
         vArea.Conditions = vArea.getCondition(AreaInfo.ncConditions.CityNo.ToString(), No);
         vArea.load();
         List <SomeData> data = new List <SomeData>();
         while (!vArea.IsEof)
         {
             data.Add(new SomeData()
             {
                 Value = vArea.ARA_NO, Text = vArea.ARA_NAME
             });
             vArea.next();
         }
         lbxArea.DisplayMember = "Text";
         lbxArea.DataSource    = data;
     }
     else if (tabControl1.SelectedIndex == 2 && lbxArea.Items.Count > 0)
     {
         lbxRoad.Items.Clear();
         string   No    = (lbxArea.SelectedItem as SomeData).Value;
         RoadInfo vRoad = new RoadInfo(APConfig.Conn);
         vRoad.Conditions  = " 1=1 ";
         vRoad.Conditions += " AND " + vRoad.getCondition(RoadInfo.ncConditions.AreaNo.ToString(), No);
         if (!string.IsNullOrEmpty(txtRoad.Text))
         {
             vRoad.Conditions += " AND " + vRoad.getCondition(RoadInfo.ncConditions.Name.ToString(), txtRoad.Text);
         }
         vRoad.load();
         List <SomeData> data = new List <SomeData>();
         while (!vRoad.IsEof)
         {
             lbxRoad.Items.Add(vRoad.ROD_NAME);
             vRoad.next();
         }
     }
     else if (tabControl1.SelectedIndex == 3)
     {
         RoadSearch();
     }
 }