示例#1
0
        private void DeleteStudentSubmit_Click(object sender, EventArgs e)
        {
            adminPW authentication = new adminPW();

            authentication.ShowDialog();

            if (!(authentication.DialogResult == DialogResult.OK))
            {
                MessageBox.Show("Password authentication failed.");
                return;
            }

            List <string> ids = new List <string>();

            if (DeleteStudentID.GetItemText(DeleteStudentID.SelectedItem).Equals("all"))
            {
                ids = (List <string>)DeleteStudentID.DataSource;
                ids.RemoveAt(0);
            }
            else
            {
                ids.Add(DeleteStudentID.GetItemText(DeleteStudentID.SelectedItem));
            }

            List <string> fnames = new List <string>();

            if (DeleteStudentFname.GetItemText(DeleteStudentFname.SelectedItem).Equals("all"))
            {
                fnames = (List <string>)DeleteStudentFname.DataSource;
                fnames.RemoveAt(0);
            }
            else
            {
                fnames.Add(DeleteStudentFname.GetItemText(DeleteStudentFname.SelectedItem));
            }

            List <string> lnames = new List <string>();

            if (DeleteStudentLname.GetItemText(DeleteStudentLname.SelectedItem).Equals("all"))
            {
                lnames = (List <string>)DeleteStudentLname.DataSource;
                lnames.RemoveAt(0);
            }
            else
            {
                lnames.Add(DeleteStudentLname.GetItemText(DeleteStudentLname.SelectedItem));
            }

            Model.deleteStudent(ids, fnames, lnames);
        }
示例#2
0
        private void DeleteCumSubmit_Click_1(object sender, EventArgs e)
        {
            adminPW authentication = new adminPW();

            authentication.ShowDialog();

            if (!(authentication.DialogResult == DialogResult.OK))
            {
                MessageBox.Show("Password authentication failed.");
                return;
            }

            List <string> ids = new List <string>();

            if (DeleteCumID.GetItemText(DeleteCumID.SelectedItem).Equals("all"))
            {
                ids = (List <string>)DeleteCumID.DataSource;
                ids.RemoveAt(0);
            }
            else
            {
                ids.Add(DeleteCumID.GetItemText(DeleteCumID.SelectedItem));
            }

            List <string> gpas = new List <string>();

            if (DeleteCumGPA.GetItemText(DeleteCumGPA.SelectedItem).Equals("all"))
            {
                gpas = (List <string>)DeleteCumGPA.DataSource;
                gpas.RemoveAt(0);
            }
            else
            {
                gpas.Add(DeleteCumGPA.GetItemText(DeleteCumGPA.SelectedItem));
            }

            List <string> dates = new List <string>();

            if (DeleteCumDate.GetItemText(DeleteCumDate.SelectedItem).Equals("all"))
            {
                dates = (List <string>)DeleteCumDate.DataSource;
                dates.RemoveAt(0);
            }
            else
            {
                dates.Add(DeleteCumDate.GetItemText(DeleteCumDate.SelectedItem));
            }

            Model.deleteCum(ids, gpas, dates);
        }