private void button1_Click(object sender, EventArgs e) { Regex r1 = new Regex(textBox1.Text); Univercity univercity = null; XmlSerializer serializer = new XmlSerializer(typeof(Univercity)); using (FileStream stream = new FileStream("University.xml", FileMode.Open)) { univercity = serializer.Deserialize(stream) as Univercity; } listBox1.Items.Clear(); List <Student> searchResult = new List <Student>(); foreach (Student student in univercity.Students) { if (r1.IsMatch(student.Fio)) { if (checkBox1.Checked) { if (comboBox1.Text.Length > 0 && comboBox1.Text != student.Specialization) { continue; } if (numericUpDown1.Value != student.Cource) { continue; } if (Decimal.ToDouble(numericUpDown2.Value) > student.Average) { continue; } } //listBox1.Items.Add(student.Fio); searchResult.Add(student); } } IEnumerable <Student> ordered = null; if (domainUpDown1.Text == "По курсу") { ordered = searchResult.OrderBy(p => p.Cource); } else { ordered = searchResult.OrderBy(p => p.Fio); } foreach (Student item in ordered) { listBox1.Items.Add(item.Fio); } }
private void button3_Click(object sender, EventArgs e) { XmlSerializer serializer = new XmlSerializer(typeof(Univercity)); using (FileStream stream = new FileStream("University.xml", FileMode.Open)) { univercity = serializer.Deserialize(stream) as Univercity; } foreach (Student student in univercity.Students) { listBox1.Items.Add(student.Fio); } }
private void button3_Click(object sender, EventArgs e) { listBox1.Items.Clear(); XmlSerializer serializer = new XmlSerializer(typeof(Univercity)); using (FileStream stream = new FileStream("University.xml", FileMode.Open)) { univercity = serializer.Deserialize(stream) as Univercity; } foreach (Student student in univercity.Students) { listBox1.Items.Add(student.Fio); } toolStripStatusLabel1.Text = $"Элементов {listBox1.Items.Count}"; }
private void фамилияToolStripMenuItem_Click(object sender, EventArgs e) { listBox1.Items.Clear(); XmlSerializer serializer = new XmlSerializer(typeof(Univercity)); using (FileStream stream = new FileStream("University.xml", FileMode.Open)) univercity = serializer.Deserialize(stream) as Univercity; IEnumerable <Student> ordered = univercity.Students.OrderBy(p => p.Fio); foreach (Student student in ordered) { listBox1.Items.Add(student.Fio); } }
private void специальностьToolStripMenuItem_Click(object sender, EventArgs e) { listBox1.Items.Clear(); XmlSerializer serializer = new XmlSerializer(typeof(Univercity)); using (FileStream stream = new FileStream("University.xml", FileMode.Open)) univercity = serializer.Deserialize(stream) as Univercity; IEnumerable <Student> ordered = univercity.Students.OrderBy(p => p.Specialization); foreach (Student student in ordered) { listBox1.Items.Add(student.Fio); } toolStripStatusLabel1.Text = $"Элементов {listBox1.Items.Count}"; }
public Form1() { InitializeComponent(); univercity = new Univercity(); }