示例#1
0
    protected void btnAddCourseOffering_Click1(object sender, EventArgs e)
    {
        string studentNumber = txtStudentName.Text;
        string studentName   = txtStudentName.Text;

        List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses();
        int j = ddlCourseOffering.SelectedIndex;

        string test = rblStudentStatus.SelectedValue;

        if (rblStudentStatus.SelectedValue == "Full-Time")
        {
            Student ourStudents = new FullTimeStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            int selectedIndex = ddlCourseOffering.SelectedIndex;

            coursesOffered[selectedIndex].AddStudent(ourStudents);

            RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";
        }

        else if (rblStudentStatus.SelectedValue == "Part-Time")
        {
            Student ourStudents = new PartTimeStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            int selectedIndex = ddlCourseOffering.SelectedIndex;

            coursesOffered[selectedIndex].AddStudent(ourStudents);

            RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";
        }
        else if (rblStudentStatus.SelectedValue == "Co-op")
        {
            Student ourStudents = new CoopStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            int selectedIndex = ddlCourseOffering.SelectedIndex;

            coursesOffered[selectedIndex].AddStudent(ourStudents);

            RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";
        }
    }
示例#2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        List <Course> userCourse = CourseDataAccess.retreiveAllCourses();

        userCourse.Sort(sortBy);

        string offeredSemester = ddlSemester.SelectedValue;
        int    offeredYear     = Int32.Parse(ddlOfferYear.SelectedValue);

        int courseIndex = ddlCourses.SelectedIndex - 1;

        CourseOffering coursesOffered = new CourseOffering(userCourse[courseIndex], offeredYear, offeredSemester);

        CourseOfferingsDataAccess.addNewCourseOffering(coursesOffered);
    }
示例#3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string courseNumber      = txtCourseNumber.Text;
        string courseName        = txtCourseName.Text;
        string stringCourseHours = txtCourseHours.Text;
        int    offeredYear       = Int32.Parse(ddlYear.SelectedValue);
        string offeredSemester   = ddlSemester.SelectedValue;
        int    courseHours       = Int32.Parse(stringCourseHours);

        userCourse = new Course(courseNumber, courseName, courseHours);
        CourseDataAccess.addNewCourse(userCourse);

        coursesOffered = new CourseOffering(userCourse, offeredYear, offeredSemester);
        CourseOfferingsDataAccess.addNewCourseOffering(coursesOffered);

        Response.Redirect(Request.RawUrl);
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        List <Course> userCourse = CourseDataAccess.retreiveAllCourses();

        int j = userCourse.Count - 1;

        List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses();
        int i = coursesOffered.Count - 1;

        List <Student> getStudents = StudentDataAccess.retreiveAllStudents();

        if (coursesOffered.Count == 0)
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
        }
        else
        {
            CourseOffering workingCourse = new CourseOffering(userCourse[j], coursesOffered[i].Year, coursesOffered[i].Semester);
            workingCourse.AddStudents(getStudents);
            workingCourse.GetStudents().Sort();
            workingCourse.GetStudents().Sort(sortBy);
            string courseNumber = workingCourse.CourseOffered.CourseNumber;

            userCourse[j] = CourseDataAccess.retreiveCourseByCourseID(courseNumber);
            Page.Title    = userCourse[j].ToString();

            Panel1.Visible = false;
            Panel2.Visible = true;

            if (workingCourse.GetStudents().Count == 0)
            {
                TableRow  lastRow     = new TableRow();
                TableCell lastRowCell = new TableCell();
                lastRowCell.Text            = "There are currently no students enlisted";
                lastRowCell.ForeColor       = System.Drawing.Color.Red;
                lastRowCell.ColumnSpan      = 4;
                lastRowCell.HorizontalAlign = HorizontalAlign.Center;
                lastRow.Cells.Add(lastRowCell);
                tblStudentRecords.Rows.Add(lastRow);
            }
            else
            {
                foreach (Student student in workingCourse.GetStudents())
                {
                    {
                        TableRow row = new TableRow();

                        TableCell cell = new TableCell();
                        cell.Text = student.Number;
                        row.Cells.Add(cell);

                        cell      = new TableCell();
                        cell.Text = student.Name;
                        row.Cells.Add(cell);

                        string studentType = student.ToString();

                        cell      = new TableCell();
                        cell.Text = StudentType.getStudentType(student);
                        row.Cells.Add(cell);

                        cell = new TableCell();
                        double tuitonToPay        = student.TuitionPayable();
                        string stringTuitionToPay = tuitonToPay.ToString();
                        cell.Text = stringTuitionToPay;
                        row.Cells.Add(cell);

                        tblStudentRecords.Rows.Add(row);
                    }
                }
            }
        }
    }
示例#5
0
    protected void btnAddCourse_Click(object sender, EventArgs e)
    {
        string studentNumber = txtStudentNumber.Text;
        string studentName   = txtStudentName.Text;

        List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses();
        int j = coursesOffered.Count - 1;

        if (rblSortOptions.SelectedValue == "fullTime")
        {
            Student ourStudents = new FullTimeStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            List <Course> userCourse = CourseDataAccess.retreiveAllCourses();
            int           i          = userCourse.Count() - 1;


            CourseOffering courseOfferedCourses = new CourseOffering(userCourse[i], coursesOffered[j].Year, coursesOffered[j].Semester);

            courseOfferedCourses.AddStudent(ourStudents);
            courseOfferedCourses.GetStudents().Sort(sortBy);

            RegistrationDataAccess.addRegistration(ourStudents, courseOfferedCourses);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";

            Response.Redirect(Request.RawUrl);
        }

        else if (rblSortOptions.SelectedValue == "partTime")
        {
            Student ourStudents = new PartTimeStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            List <Course> userCourse = CourseDataAccess.retreiveAllCourses();
            int           i          = userCourse.Count() - 1;

            CourseOffering courseOfferedCourses = new CourseOffering(userCourse[i], coursesOffered[j].Year, coursesOffered[j].Semester);

            courseOfferedCourses.AddStudent(ourStudents);
            courseOfferedCourses.GetStudents().Sort(sortBy);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";

            Response.Redirect(Request.RawUrl);
        }
        else if (rblSortOptions.SelectedValue == "coop")
        {
            Student ourStudents = new CoopStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            List <Course> userCourse = CourseDataAccess.retreiveAllCourses();
            int           i          = userCourse.Count() - 1;

            CourseOffering courseOfferedCourses = new CourseOffering(userCourse[i], coursesOffered[j].Year, coursesOffered[j].Semester);

            courseOfferedCourses.AddStudent(ourStudents);
            courseOfferedCourses.GetStudents().Sort(sortBy);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";

            Response.Redirect(Request.RawUrl);
        }
    }
示例#6
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            List <Course> userCourse = CourseDataAccess.retreiveAllCourses();
            userCourse.Sort(sortBy);

            foreach (Course course in userCourse)
            {
                ListItem item = new ListItem(course.ToString());
                ddlCourses.Items.Add(item);
            }
        }

        List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses();

        coursesOffered.Sort(sortOffering);

        if (coursesOffered.Count == 0)
        {
            TableRow  lastRow     = new TableRow();
            TableCell lastRowCell = new TableCell();
            lastRowCell.Text            = "There are currently no students enlisted";
            lastRowCell.ForeColor       = System.Drawing.Color.Red;
            lastRowCell.ColumnSpan      = 4;
            lastRowCell.HorizontalAlign = HorizontalAlign.Center;
            lastRow.Cells.Add(lastRowCell);
            tblCourseOffering.Rows.Add(lastRow);
        }
        else
        {
            foreach (CourseOffering ourCourse in coursesOffered)
            {
                {
                    TableRow row = new TableRow();

                    TableCell cell = new TableCell();
                    cell.Text = ourCourse.CourseOffered.CourseNumber;
                    row.Cells.Add(cell);

                    cell      = new TableCell();
                    cell.Text = ourCourse.CourseOffered.CourseName;
                    row.Cells.Add(cell);

                    cell      = new TableCell();
                    cell.Text = ourCourse.Year.ToString();
                    row.Cells.Add(cell);

                    cell = new TableCell();
                    if (ourCourse.Semester == "Spring/Summer")
                    {
                        cell.Text = Semesters.SpringSummer;
                    }
                    else if (ourCourse.Semester == "Fall")
                    {
                        cell.Text = Semesters.Fall;
                    }
                    else if (ourCourse.Semester == "Winter")
                    {
                        cell.Text = Semesters.Winter;
                    }
                    row.Cells.Add(cell);

                    tblCourseOffering.Rows.Add(row);
                }
            }
        }
    }
示例#7
0
    protected void Page_PreRender(object sender, EventArgs e)

    {
        if (!IsPostBack)
        {
            List <CourseOffering> ourCourses = CourseOfferingsDataAccess.retreiveAllCourses();
            ourCourses.Sort(sortOffering);

            foreach (CourseOffering course in ourCourses)
            {
                ListItem item = new ListItem(course.ToString(), course.CourseOffered.CourseNumber);
                ddlCourseOffering.Items.Add(item);
            }
        }

        if (IsPostBack)
        {
            List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses();
            int selectedIndex = ddlCourseOffering.SelectedIndex;

            List <Student> studentsInOfferingList = RegistrationDataAccess.getStudentsFromOffering(coursesOffered[selectedIndex]);
            studentsInOfferingList.Sort(sortBy);

            if (studentsInOfferingList.Count == 0)
            {
                TableRow  lastRow     = new TableRow();
                TableCell lastRowCell = new TableCell();
                lastRowCell.Text            = "There are currently no students enlisted";
                lastRowCell.ForeColor       = System.Drawing.Color.Red;
                lastRowCell.ColumnSpan      = 4;
                lastRowCell.HorizontalAlign = HorizontalAlign.Center;
                lastRow.Cells.Add(lastRowCell);
                tblStudentRecords.Rows.Add(lastRow);
            }
            else
            {
                foreach (Student student in studentsInOfferingList)
                {
                    {
                        TableRow row = new TableRow();

                        TableCell cell = new TableCell();
                        cell.Text = student.Number;
                        row.Cells.Add(cell);

                        cell      = new TableCell();
                        cell.Text = student.Name;
                        row.Cells.Add(cell);

                        string studentType = student.ToString();

                        cell      = new TableCell();
                        cell.Text = StudentType.getStudentType(student);
                        row.Cells.Add(cell);

                        tblStudentRecords.Rows.Add(row);
                    }
                }
            }
        }
    }