Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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}";
        }
Пример #4
0
        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);
            }
        }
Пример #5
0
        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}";
        }
Пример #6
0
 public Form1()
 {
     InitializeComponent();
     univercity = new Univercity();
 }