Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            StudentsInformation journalModal = new StudentsInformation((Student)StudentsList.SelectedItem);

            journalModal.ShowDialog();
            if (journalModal.ok)
            {
                MessageBox.Show("Saved");
            }
            else
            {
                MessageBox.Show("Changes was not saved");
            }
        }
Example #2
0
        private void create_button_Click(object sender, EventArgs e)
        {
            Student             newJournal   = new Student();
            StudentsInformation journalModal = new StudentsInformation(newJournal);

            if (journalModal.ShowDialog() == DialogResult.OK)
            {
                StudentsList.Items.Add(newJournal.ToShortString());
                students.Add(newJournal);
            }
            else
            {
                MessageBox.Show("Changes was not saved");
            }
        }
Example #3
0
        private void edit_button_Click(object sender, EventArgs e)
        {
            int selectedIndex = StudentsList.SelectedIndex;

            if (selectedIndex < 0 || selectedIndex >= students.Count)
            {
                MessageBox.Show("You need to choose journal!");
                return;
            }
            StudentsInformation journalModal = new StudentsInformation(students[StudentsList.SelectedIndex]);

            if (journalModal.ShowDialog() == DialogResult.OK)
            {
                StudentsList.Items[selectedIndex] = students[StudentsList.SelectedIndex].ToShortString();
            }
            else
            {
                MessageBox.Show("Changes was not saved");
            }
        }