示例#1
0
 private void comboPartName_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (comboPartName.Items.Count > 0)
         {
             if (comboPartName.SelectedItem == null)
             {
                 return;
             }
             SelectedPartName = comboPartName.SelectedItem.ToString();
             PopulateBoardList();
             listLifetimeInfo1.Clear();
             LifetimePartLimits    = GCIDB.GetLifetimeLimits(SelectedPartName);
             LoadedLifetimeLimitID = LifetimePartLimits.LifetimeLimitID;
             if (LifetimePartLimits.LifetimeLimitID > 0)
             {
                 LoadedPartID          = GCIDB.GetPartID(SelectedPartName);
                 ExistingSerialNumbers = GCIDB.GetSerialNumberList(SelectedPartName);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("comboPartName_SelectedIndexChanged(): " + ex.ToString());
     }
 }
        private void batchName_listbox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (batchName_listbox.SelectedIndex == -1 || partName_listbox.SelectedIndex == -1)
            {
                MessageBox.Show("Select a Batch Name & Part Name!");
            }
            else
            {
                //pull batch names from the DB, then render the view for filtering
                SelectedPartName  = partName_listbox.SelectedItem.ToString();
                SelectedBatchName = batchName_listbox.SelectedItem.ToString();
                GCIDB.Initialize();
                GCIDB.OpenConnection();
                SerialNumbers = GCIDB.GetSerialNumberList(SelectedPartName, SelectedBatchName);
                serialNumbers_listBox.ItemsSource = SerialNumbers;

                System.ComponentModel.ICollectionView serial_view = CollectionViewSource.GetDefaultView(serialNumbers_listBox.ItemsSource);
                serial_view.Filter = serialNumber_CustomFilter;
            }
        }