//============================================================================* // PopulateSourceCombo() //============================================================================* private void PopulateSourceCombo() { m_fPopulating = true; //----------------------------------------------------------------------------* // Clear the SourceCombo items //----------------------------------------------------------------------------* SourceCombo.Items.Clear(); //----------------------------------------------------------------------------* // Get the source list info & populate the Source Combo //----------------------------------------------------------------------------* List <string> SourceList = m_DataFiles.GetTransactionSourceList(m_Transaction.TransactionType); string strLastSource = m_DataFiles.GetLastTransactionSource(m_Transaction.TransactionType); int nSelectIndex = -1; foreach (string strSource in SourceList) { int nIndex = SourceCombo.Items.Add(strSource); if (m_Transaction.Source == strLastSource) { nSelectIndex = nIndex; } } //----------------------------------------------------------------------------* // Set the selected item //----------------------------------------------------------------------------* if (String.IsNullOrEmpty(m_Transaction.Source)) { SourceCombo.Text = ""; } else { if (nSelectIndex == -1 && SourceCombo.FindString(m_Transaction.Source) == -1) { nSelectIndex = SourceCombo.Items.Add(m_Transaction.Source); } if (nSelectIndex >= 0) { SourceCombo.SelectedIndex = nSelectIndex; } } m_fPopulating = false; }
//============================================================================* // PopulateLocationCombo() //============================================================================* private void PopulateLocationCombo() { PurchaseLocationCombo.Items.Clear(); PurchaseLocationCombo.Items.Add("All Purchase Locations"); List <string> LocationList = m_DataFiles.GetTransactionSourceList(cTransaction.eTransactionType.Purchase); foreach (string strString in LocationList) { PurchaseLocationCombo.Items.Add(strString); } PurchaseLocationCombo.SelectedIndex = 0; }