//// public void PopulateUpdateData() { ReloadOBForm(); lblReturnOBnumber.Text = OBEntry.Rob.ToString(); txtOBNumber.Text = OBEntry.Ob.ToString(); txtTime.Text = OBEntry.DateAndTime.Split('#')[1]; txtDate.Text = OBEntry.DateAndTime.Split('#')[0]; cmbOccurence.SelectedIndex = cmbOccurence.FindStringExact(OBEntry.Occurence); cmbShift.SelectedIndex = cmbShift.FindString(OBEntry.Shifts); cmbSite.DataSource = siteCmbTemp.GetActiveSites(); cmbOfficer.DataSource = officerCmbTemp.getActiveOfficers(); int finalIndex = -1; int index = 0; foreach (SiteClass item in cmbSite.Items) { if (item.Callsighn == OBEntry.Site) { finalIndex = index; } index++; } cmbSite.SelectedIndex = finalIndex; index = 0; foreach (OfficerClass item in cmbOfficer.Items) { if (item.PSiRA == OBEntry.Officer.ToString()) { finalIndex = index; } index++; } cmbOfficer.SelectedIndex = finalIndex; txtOccurenceNote.Text = OBEntry.Notes.Replace("&", Environment.NewLine).Replace("@", ","); btnLogEntry.Text = "Update Occurrence"; if (personClassAdminForm.Rank != 2) { btnLogEntry.Enabled = false; txtOBNumber.Enabled = false; txtOccurenceNote.Enabled = false; cmbShift.Enabled = false; cmbSite.Enabled = false; cmbOfficer.Enabled = false; cmbOccurence.Enabled = false; } }
private void cmbSite_SelectedIndexChanged(object sender, EventArgs e) { try { SiteClass siteClasstemp = (SiteClass)cmbSite.SelectedItem; List <OfficerClass> notTheList = new List <OfficerClass>(); foreach (OfficerClass item in theOfficerClass.getActiveOfficers()) { if (item.Site == siteClasstemp.Callsighn) { notTheList.Add(item); } } cmbOfficer.DataSource = notTheList; } catch (Exception) { } }