Ejemplo n.º 1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            // FUNCTION: Add studet
            // PRE-CONDITIONS:
            // POST-CONDITIONS:
            AdminAddStudentPage adminAddStudentPage;

            adminButtonsDisable();
            while (true)
            {
                try {
                    adminAddStudentPage = new AdminAddStudentPage();
                    adminAddStudentPage.ShowDialog();
                    if (!adminAddStudentPage.checkSaved)
                    {
                        return;
                    }
                    adminManager.AddStudentParticulars(adminAddStudentPage.matric, adminAddStudentPage.gender,
                                                       adminAddStudentPage.name, adminAddStudentPage.password, adminAddStudentPage.school);
                    ListViewItem lvi = new ListViewItem(new[] { adminAddStudentPage.name, adminAddStudentPage.gender.ToString(), adminAddStudentPage.matric, adminAddStudentPage.password, adminAddStudentPage.school });
                    adminListView.Items.Add(lvi);
                    toolStripStatusLabel1.Text = "Student <" + adminAddStudentPage.name + "> has been added to the list.";
                    return;
                } catch (ArgumentException) {
                    MessageBox.Show("Students Exists!", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Ejemplo n.º 2
0
 private void addButton_Click(object sender, EventArgs e)
 {
     // FUNCTION: Add studet
     // PRE-CONDITIONS:
     // POST-CONDITIONS:
     AdminAddStudentPage adminAddStudentPage;
     adminButtonsDisable();
     while (true) {
         try {
             adminAddStudentPage = new AdminAddStudentPage();
             adminAddStudentPage.ShowDialog();
             if (!adminAddStudentPage.checkSaved) return;
             adminManager.AddStudentParticulars(adminAddStudentPage.matric, adminAddStudentPage.gender,
                 adminAddStudentPage.name, adminAddStudentPage.password, adminAddStudentPage.school);
             ListViewItem lvi = new ListViewItem(new[] { adminAddStudentPage.name, adminAddStudentPage.gender.ToString(), adminAddStudentPage.matric, adminAddStudentPage.password, adminAddStudentPage.school });
             adminListView.Items.Add(lvi);
             toolStripStatusLabel1.Text = "Student <" + adminAddStudentPage.name + "> has been added to the list.";
             return;
         } catch (ArgumentException) {
             MessageBox.Show("Students Exists!", "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
Ejemplo n.º 3
0
        private void editButton_Click(object sender, EventArgs e)
        {
            // FUNCTION: Edit an student in the list
            // PRE-CONDITIONS: Only one student from the list is selected.
            // POST-CONDITIONS: The item is selected with the new details.

            ListViewItem        lvi = adminListView.SelectedItems[0];
            AdminAddStudentPage adminEditStudentPage = new AdminAddStudentPage(lvi.SubItems[0].Text,
                                                                               (Gender)Enum.Parse(typeof(Gender), lvi.SubItems[1].Text), lvi.SubItems[2].Text, lvi.SubItems[3].Text, lvi.SubItems[4].Text);

            adminEditStudentPage.ShowDialog();
            adminButtonsDisable();
            if (!adminEditStudentPage.checkSaved)
            {
                return;
            }
            adminManager.ChangeStudentParticulars(adminEditStudentPage.matric, adminEditStudentPage.name,
                                                  adminEditStudentPage.password, adminEditStudentPage.school, adminEditStudentPage.gender);
            lvi.SubItems[0].Text       = adminEditStudentPage.name;
            lvi.SubItems[1].Text       = adminEditStudentPage.gender.ToString();
            lvi.SubItems[3].Text       = adminEditStudentPage.password;
            lvi.SubItems[4].Text       = adminEditStudentPage.school;
            toolStripStatusLabel1.Text = "Particulars of <" + adminEditStudentPage.name + "> have been editted.";
        }
Ejemplo n.º 4
0
        private void editButton_Click(object sender, EventArgs e)
        {
            // FUNCTION: Edit an student in the list
            // PRE-CONDITIONS: Only one student from the list is selected.
            // POST-CONDITIONS: The item is selected with the new details.

            ListViewItem lvi = adminListView.SelectedItems[0];
            AdminAddStudentPage adminEditStudentPage = new AdminAddStudentPage(lvi.SubItems[0].Text,
                (Gender) Enum.Parse(typeof(Gender), lvi.SubItems[1].Text), lvi.SubItems[2].Text, lvi.SubItems[3].Text, lvi.SubItems[4].Text);
            adminEditStudentPage.ShowDialog();
            adminButtonsDisable();
            if (!adminEditStudentPage.checkSaved) return;
            adminManager.ChangeStudentParticulars(adminEditStudentPage.matric, adminEditStudentPage.name,
                adminEditStudentPage.password, adminEditStudentPage.school, adminEditStudentPage.gender);
            lvi.SubItems[0].Text = adminEditStudentPage.name;
            lvi.SubItems[1].Text = adminEditStudentPage.gender.ToString();
            lvi.SubItems[3].Text = adminEditStudentPage.password;
            lvi.SubItems[4].Text = adminEditStudentPage.school;
            toolStripStatusLabel1.Text = "Particulars of <" + adminEditStudentPage.name + "> have been editted.";
        }