Пример #1
0
        private void ActualRegButton_Click(object sender, EventArgs e)
        {
            if (state == adminstate.student)
            {
                if (studstate == studentstate.salcourses)
                {
                    thisCourse = Courses[dataGridView2.SelectedRows[0].Index];
                    benutil.AddStudenttoCourse(asthisstudent, thisCourse, admin);
                }

                if (studstate == studentstate.sadvisor)
                {
                    asthisstudent.Advisor = FacultyList[dataGridView2.SelectedRows[0].Index].UserName;
                    ActualRegButton.Hide();
                    dataGridView2.Hide();
                    IVS();
                }
            }
            if (state == adminstate.crs)
            {
                newNames.Add(FacultyList[dataGridView2.SelectedRows[0].Index].UserName);
                cadst = courseadminstate.credits;
                this.Text = "Changing a course.";
                DetailBox.Text = thisCourse.CourseName + "is worth " + thisCourse.credits + " credits.";
                showDetail();
                TrueNo.Show();
                dataGridView2.Hide();
                ActualRegButton.Hide();
                FastRegButton.Hide();
            }
        }
Пример #2
0
        private void YesButton2_Click(object sender, EventArgs e)
        {
            switch (cadst)
            {
                case courseadminstate.name:
                    {
                        newNames.Add(DetailBox2.Text);
                        cadst = courseadminstate.title;
                        DetailBox.Text = "The Course is titled " + thisCourse.CourseTitle + ".";
                        showDetail();
                        TrueNo.Show();
                        YesButton2.Hide();
                        NoButton2.Hide();
                        DetailBox2.Hide();
                    }
                    break;

                case courseadminstate.title:
                    {
                        newNames.Add(DetailBox2.Text);
                        cadst = courseadminstate.instructor;
                        DetailBox.Text = thisCourse.CourseName + "'s instructor is " + thisCourse.Instructor + ".";
                        showDetail();
                        TrueNo.Show();
                        YesButton2.Hide();
                        NoButton2.Hide();
                        DetailBox2.Hide();
                    }
                    break;

                case courseadminstate.credits:
                    {
                        newNames.Add(DetailBox2.Text);
                        cadst = courseadminstate.time;
                        DetailBox.Text = thisCourse.CourseName + "meets " + thisCourse.Time;
                        showDetail();
                        TrueNo.Show();
                        YesButton2.Hide();
                        NoButton2.Hide();
                        DetailBox2.Hide();
                    } break;
                case courseadminstate.time: { } break;
            }
        }
Пример #3
0
 private void coursebase()
 {
     cadst = courseadminstate.viewall;
     dataGridView1.DataSource = Courses;
     dataGridView1.Show();
     this.Text = "Viewing Course List";
     StudentButton.Enabled = false;
     button3.Enabled = false;
     killButton.Show();
     killButton.Enabled = true;
     button1.Enabled = true;
     button1.Text = "Modify Course";
     button1.Show();
 }
Пример #4
0
        private void TrueNo_Click(object sender, EventArgs e)
        {
            switch (cadst)
            {
                case courseadminstate.name:
                    {
                        cadst = courseadminstate.title;
                        DetailBox.Text = "The Course is titled " + thisCourse.CourseTitle + ".";
                        newNames.Add(thisCourse.CourseName);
                    }
                    break;
                case courseadminstate.title:
                    {
                        cadst = courseadminstate.instructor;
                        DetailBox.Text = thisCourse.CourseName + "'s instructor is " + thisCourse.Instructor + ".";
                        newNames.Add(thisCourse.CourseTitle);
                    }
                    break;
                case courseadminstate.instructor:
                    {
                        cadst = courseadminstate.credits;
                        DetailBox.Text = thisCourse.CourseName + "is worth " + thisCourse.credits + " credits.";
                        newNames.Add(thisCourse.Instructor);
                    }
                    break;
                case courseadminstate.credits:
                    {
                        cadst = courseadminstate.time;
                        DetailBox.Text = thisCourse.CourseName + "meets " + thisCourse.Time;
                        newNames.Add(thisCourse.credits.ToString());
                    }
                    break;
                case courseadminstate.time:
                    {
                        double s = double.Parse(newNames[3]);
                        thisCourse.AdministerCourse(newNames[0], newNames[1], newNames[2], s, admin);

                        dataGridView1.Refresh();
                        hideDetail();
                        coursebase();
                    }
                    break;

            }
        }
Пример #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (state)
            {

                case adminstate.dflt: { } break; //Do nothing.
                case adminstate.student:
                    if (studstate == studentstate.sviewall)
                    {
                        asthisstudent = StudentList[dataGridView1.SelectedRows[0].Index];
                        //MessageBox.Show("Student : " + asthisstudent.FirstName + " " + asthisstudent.LastName);
                        studstate = studentstate.ssched;
                        this.Text = "View/Change " + asthisstudent.UserName + "'s course schedule.";
                        List<Course> StdCrs = new List<Course>();
                        foreach (Course C in Courses)
                        {
                            if (asthisstudent.MyCourses.Contains(C.CourseName))
                            {
                                StdCrs.Add(C);
                            }
                        }
                        dataGridView1.DataSource = StdCrs;
                        AdvisorButton.Hide();
                        button1.Text = "Student List";
                        FastRegButton.Text = "View all courses";
                        FastRegButton.Show();
                    }
                    else
                    {
                        //state = adminstate.dflt;
                        //AdvisorButton.Show();
                        //MessageBox.Show("State 2b");
                        IVS();

                    }
                    break;
                case adminstate.faculty:
                    {
                        asthisfaculty = FacultyList[dataGridView1.SelectedRows[0].Index];
                        List<String> myCrsStringList = asthisfaculty.MyClasses;

                        foreach (Course c in Courses)
                        {
                            if (c.Instructor == asthisfaculty.UserName)
                            {
                                facCourse.Add(c);
                            }
                        }
                        dataGridView2.DataSource = facCourse;
                        dataGridView2.Show();
                    }
                    break;
                case adminstate.crs:
                    {
                        newNames = new List<String>(); //This prevents a hilarious error.
                        cadst = courseadminstate.name;
                        thisCourse = Courses[dataGridView1.SelectedRows[0].Index];
                        DetailBox.Text = "Course Name = " + thisCourse.CourseName + ".";
                        YesButton.Text = "Change?";
                        NoButton.Text = "Cancel Changes";
                        TrueNo.Show();
                        showDetail();
                    }
                    break;
                default: //MessageBox.Show("CASE 3");
                    break;
            }
        }