コード例 #1
0
        //private void CourseInfo_Load(object sender, EventArgs e)
        //{
        //    // TODO: This line of code loads data into the 'courseRegistrationTableDataSet.CourseRegTable' table. You can move, or remove it, as needed.
        //    this.courseRegTableTableAdapter.Fill(this.courseRegistrationTableDataSet.CourseRegTable);

        //}

        private void SemesterComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            string semester = SemesterComboBox.Text;

            CourseRegistrationRepository crr   = new CourseRegistrationRepository();
            List <CourseRegistration>    cList = new List <CourseRegistration>();

            cList = crr.GetAllCourseInfo(semester, ID);

            DataTable cTable = new DataTable();

            cTable.Columns.Add("Course ID", typeof(string));
            cTable.Columns.Add("Course Name", typeof(string));
            cTable.Columns.Add("Section", typeof(string));
            cTable.Columns.Add("Status", typeof(string));

            for (int i = 0; i < cList.Count; i++)
            {
                cTable.Rows.Add(cList[i].CourseId, cList[i].CourseName, cList[i].Section, cList[i].Status);
            }

            CourseInfoGridView.DataSource = cTable;
            CourseInfoGridView.ReadOnly   = true;
        }
コード例 #2
0
        private void SemesterComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            semester = SemesterComboBox.Text;

            CourseRegistrationRepository gr    = new CourseRegistrationRepository();
            List <CourseRegistration>    gList = new List <CourseRegistration>();

            gList = gr.GetAllCourseInfo(semester, ID);
            AllCourseFalse();
            if (gList.Count == 6)
            {
                this.Course1Btn.Visible = true;
                this.Course1Btn.Text    = gList[0].CourseName + " " + gList[0].Section;

                this.Course2Btn.Visible = true;
                this.Course2Btn.Text    = gList[1].CourseName + " " + gList[1].Section;

                this.Course3Btn.Visible = true;
                this.Course3Btn.Text    = gList[2].CourseName + " " + gList[2].Section;

                this.Course4Btn.Visible = true;
                this.Course4Btn.Text    = gList[3].CourseName + " " + gList[3].Section;

                this.Course5Btn.Visible = true;
                this.Course5Btn.Text    = gList[4].CourseName + " " + gList[4].Section;

                this.Course6Btn.Visible = true;
                this.Course6Btn.Text    = gList[5].CourseName + " " + gList[5].Section;
            }
            else if (gList.Count == 5)
            {
                this.Course1Btn.Visible = true;
                this.Course1Btn.Text    = gList[0].CourseName + " " + gList[0].Section;

                this.Course2Btn.Visible = true;
                this.Course2Btn.Text    = gList[1].CourseName + " " + gList[1].Section;

                this.Course3Btn.Visible = true;
                this.Course3Btn.Text    = gList[2].CourseName + " " + gList[2].Section;

                this.Course4Btn.Visible = true;
                this.Course4Btn.Text    = gList[3].CourseName + " " + gList[3].Section;

                this.Course5Btn.Visible = true;
                this.Course5Btn.Text    = gList[4].CourseName + " " + gList[4].Section;
            }
            else if (gList.Count == 4)
            {
                this.Course1Btn.Visible = true;
                this.Course1Btn.Text    = gList[0].CourseName + " " + gList[0].Section;

                this.Course2Btn.Visible = true;
                this.Course2Btn.Text    = gList[1].CourseName + " " + gList[1].Section;

                this.Course3Btn.Visible = true;
                this.Course3Btn.Text    = gList[2].CourseName + " " + gList[2].Section;

                this.Course4Btn.Visible = true;
                this.Course4Btn.Text    = gList[3].CourseName + " " + gList[3].Section;
            }
            else if (gList.Count == 3)
            {
                this.Course1Btn.Visible = true;
                this.Course1Btn.Text    = gList[0].CourseName + " " + gList[0].Section;

                this.Course2Btn.Visible = true;
                this.Course2Btn.Text    = gList[1].CourseName + " " + gList[1].Section;

                this.Course3Btn.Visible = true;
                this.Course3Btn.Text    = gList[2].CourseName + " " + gList[2].Section;
            }
            else if (gList.Count == 2)
            {
                this.Course1Btn.Visible = true;
                this.Course1Btn.Text    = gList[0].CourseName + " " + gList[0].Section;

                this.Course2Btn.Visible = true;
                this.Course2Btn.Text    = gList[1].CourseName + " " + gList[1].Section;
            }
            else if (gList.Count == 1)
            {
                this.Course1Btn.Visible = true;
                this.Course1Btn.Text    = gList[0].CourseName + " " + gList[0].Section;
            }
        }