private void loadList() { SuspectCollection ToLoad = new SuspectCollection(); foreach (Suspect suspected in wholeCollection) { if (suspected.SearchedIn.Equals(country)) { ToLoad.Add(suspected); } } suspects = ToLoad; }
private void loadInterpoleForm(string Country) { SuspectCollection ToLoad = new SuspectCollection(); foreach (Suspect suspected in suspects) { if (suspected.SearchedIn.Equals(Country)) { ToLoad.Add(suspected); } } Interpole SuspectForm = new Interpole(ToLoad, suspects, Country); this.Visible = false; if (SuspectForm.ShowDialog() != DialogResult.None) { this.Visible = true; } }
private void Interpole_FormClosing(object sender, FormClosingEventArgs e) { bool exit = false; foreach (Suspect suspected in suspects) { foreach (Suspect allsuspcets in wholeCollection) { if (allsuspcets.PicLoc == suspected.PicLoc && allsuspcets.LastSeen == suspected.LastSeen && allsuspcets.LastCrime.ToString() == allsuspcets.LastCrime.ToString()) { exit = true; break; } } if (!exit) { wholeCollection.Add(suspected); } exit = false; } }
private void button4_Click(object sender, EventArgs e) { for (int i = this.Controls.Count - 1; i >= 0; i--) { if (this.Controls[i].GetType().Name.ToLower().Equals("textbox")) { if (this.Controls[i].GetType().Name.ToLower().Equals("textbox") && Methods.ifCheck((TextBox)this.Controls[i])) { this.Controls[i].BackColor = Color.FromArgb(255, 128, 128); return; } if (this.Controls[i].Text.Length == 0) { if (!this.Controls[i].Name.Equals("textBox3") && !this.Controls[i].Name.Equals("textBox6")) { this.Controls[i].BackColor = Color.FromArgb(255, 128, 128); return; } } } } if (crimes.Count == 0 && story.Count == 0) { MessageBox.Show("Suspect must have at least one crime and one fact"); return; } if (checkYears()) { return; } string[] pointers = { "name", "surname", "patro", "birth", "placeofb", "build", "hair", "eyes", "height", this.crimes.Count.ToString(), findLastCrime(), "wife", "children", findLastPos(), crimesToString(), "searchedin", "status", this.photo, storyToString() }; for (int i = 0; i < pointers.Length; i++) { for (int j = 0; j < this.Controls.Count; j++) { if (this.Controls[j].Name.Equals(pointers[i]) && this.Controls[j].GetType().Name.ToLower().Equals("textbox")) { pointers[i] = this.Controls[j].Text; } if (this.Controls[j].Name.Equals(pointers[i]) && this.Controls[j].GetType().Name.ToLower().Equals("combobox")) { pointers[i] = this.Controls[j].Text.Trim(); } if (this.Controls[j].Name.Equals(pointers[i]) && this.Controls[j].GetType().Name.ToLower().Equals("checkbox")) { pointers[i] = ((CheckBox)this.Controls[j]).Checked.ToString(); } if (this.Controls[j].Name.Equals(pointers[i]) && this.Controls[j].GetType().Name.ToLower().Equals("monthcalendar")) { pointers[i] = ((MonthCalendar)this.Controls[j]).SelectionRange.Start.ToString("dd/MM/yyyy"); } if (this.Controls[j].Name.Equals(pointers[i]) && this.Controls[j].GetType().Name.ToLower().Equals("numericupdown")) { pointers[i] = ((NumericUpDown)this.Controls[j]).Value.ToString(); } } } suspect.Add(new Suspect(String.Join("~", pointers))); Methods.PutActiveIntoTable(table, suspect); this.Close(); }