private void btnSelect_Click(object sender, EventArgs e) { try { DataRowView drv = lstPollutant.SelectedItem as DataRowView; if (drv == null) { return; } BenMAPPollutant pollutant = null; string type = string.Empty; if (lstSPollutant.Items.Count == 0) { lstSPollutant.Items.Add(lstPollutant.GetItemText(lstPollutant.SelectedItem)); pollutant = GridCommon.getPollutantFromID(int.Parse(drv["PollutantID"].ToString())); CommonClass.LstPollutant.Add(pollutant); } else if (lstSPollutant.Items.Count != 0) { if (!lstSPollutant.Items.Contains(lstPollutant.GetItemText(lstPollutant.SelectedItem))) { lstSPollutant.Items.Add(lstPollutant.GetItemText(lstPollutant.SelectedItem)); pollutant = GridCommon.getPollutantFromID(int.Parse(drv["PollutantID"].ToString())); CommonClass.LstPollutant.Add(pollutant); } else { MessageBox.Show(string.Format("{0} has already been selected.", lstPollutant.GetItemText(lstPollutant.SelectedItem))); } } } catch (Exception ex) { Logger.LogError(ex.Message); } }
public ToStandardControl(BenMAPPollutant BenMAPPollutant) { InitializeComponent(); _BenMAPPollutant = BenMAPPollutant; }