コード例 #1
0
ファイル: NewStudentForm.cs プロジェクト: KripaK/CSYE-6202
 private void loadData()
 {
     firstName = firstText.Text;
     lastName = lastText.Text;
     nuid = studentText.Text;
     if(string.IsNullOrEmpty(firstName) || string.IsNullOrWhiteSpace(firstName) || string.IsNullOrEmpty(lastName) || string.IsNullOrWhiteSpace(lastName) || string.IsNullOrEmpty(nuid) || string.IsNullOrWhiteSpace(nuid))
     {
         StudentRegistrationWarning popup = new StudentRegistrationWarning();
         DialogResult dialogresult = popup.ShowDialog();
         if (dialogresult == DialogResult.OK)
         {
             popup.Close();
         }
         popup.Dispose();
     }
     dept = comboBoxDepartment.SelectedItem.ToString();
     if (radioButtonFullTime.Checked == true)
     {
         enrollType = "Full Time";
     }
     else
     {
         enrollType = "Part Time";
     }
     Student student = new Student(nuid, firstName, lastName, dept, enrollType);
     mockStudentList.Add(student);
 }
コード例 #2
0
ファイル: RemoveStudentForm.cs プロジェクト: KripaK/CSYE-6202
        private void button1_Click_1(object sender, EventArgs e)
        {
            firstName = firstText.Text;
            lastName = lastText.Text;
            nuid = studentText.Text;
            dept = comboBoxDepartment.SelectedItem.ToString();
            if (string.IsNullOrEmpty(firstName) || string.IsNullOrWhiteSpace(firstName) || string.IsNullOrEmpty(lastName) || string.IsNullOrWhiteSpace(lastName) || string.IsNullOrEmpty(nuid) || string.IsNullOrWhiteSpace(nuid))
            {
                StudentRegistrationWarning popup = new StudentRegistrationWarning();
                DialogResult dialogresult = popup.ShowDialog();
                if (dialogresult == DialogResult.OK)
                {
                    popup.Close();
                }
                popup.Dispose();
            }
            else
            {
                StudentRegistrationWarning popup = new StudentRegistrationWarning();
                DialogResult dialogresult = popup.ShowDialog();
                if (dialogresult == DialogResult.Yes)
                {

                    int index = mockStudentList.FindIndex(s => s.StudentID == nuid);
                    mockStudentList.RemoveAt(index);
                    popup.Dispose();
                }
                else
                {
                    popup.Dispose();
                    this.Close();
                }
            }
        }