//Takes in all students and checks if they are on the roster of the instance object
        //if the ZID is found int the roster it will print the student using the .ToString() override.
        public string PrintRoster(BindingList <Student> students)
        {
            var builder = new StringBuilder();

            if (students == null)
            {
                throw new ArgumentNullException("students cannot be null.");
            }

            var courseInfo = string.Format("Course: {0} {1}-{2} ({3}/{4})", DepartmentCode, CourseNumber, SectionNumber, EnrolledCount, MaximumCapacity);

            builder.Append(courseInfo);
            builder.Append(Environment.NewLine);
            builder.Append("-------------------------------------------------------------------");
            builder.Append(Environment.NewLine);
            if (!EnrolledStudents.Any())
            {
                builder.Append("There are no students currently enrolled in this course.");
            }
            else
            {
                foreach (var student in students)
                {
                    if (EnrolledStudents.Contains(student.ZId))
                    {
                        var studentInfo = string.Format("{0}\t{1}, {2}\t{3}", student.ZId, student.LastName, student.FirstName, student.Major);
                        builder.Append(studentInfo);
                        builder.Append(Environment.NewLine);
                    }
                }
            }

            return(builder.ToString());
        }
Beispiel #2
0
    //**************************************
    //
    public EnrollFlags Enroll(Student s)
    {
        // First, make sure that this Student is not already
        // enrolled for this Section, has not already enrolled
        // in another section of this class and that he/she has
        // NEVER taken and passed the course before.

        Transcript transcript = s.Transcript;

        if (s.IsEnrolledIn(this) ||
            s.IsCurrentlyEnrolledInSimilar(this) ||
            transcript.VerifyCompletion(RepresentedCourse))
        {
            return(EnrollFlags.PREVIOUSLY_ENROLLED);
        }

        // If there are any prerequisites for this course,
        // check to ensure that the Student has completed them.

        Course c = RepresentedCourse;

        if (c.HasPrerequisites())
        {
            foreach (Course pre in c.Prerequisites)
            {
                // See if the Student's Transcript reflects
                // successful completion of the prerequisite.

                if (!transcript.VerifyCompletion(pre))
                {
                    return(EnrollFlags.PREREQ_NOT_SATISFIED);
                }
            }
        }

        // If the total enrollment is already at the
        // the capacity for this Section, we reject this
        // enrollment request.

        if (!ConfirmSeatAvailability())
        {
            return(EnrollFlags.SECTION_FULL);
        }

        // If we made it to here in the code, we're ready to
        // officially enroll the Student.

        // Note bidirectionality:  this Section holds
        // onto the Student via the Dictionary, and then
        // the Student is given an object reference to this Section.

        if (!EnrolledStudents.ContainsKey(s.Id))
        {
            EnrolledStudents.Add(s.Id, s);
        }

        s.AddSection(this);
        return(EnrollFlags.SUCCESSFULLY_ENROLLED);
    }
 public IActionResult Enroll(Student student)
 {
     if (ModelState.IsValid)
     {
         EnrolledStudents.Add(student);
         return(View("EnrollDone", student));
     }
     return(View());
 }
        private void AddStudent()
        {
            mDataService.AddStudent(NewStudent);
            EnrolledStudents.Add(NewStudent);
            SelectedSection.StudentIds.Add(NewStudent.Id);
            mDataService.Save();

            SelectedEnrolledStudent = NewStudent;

            NewStudent = new Student(string.Empty, string.Empty);
        }
        private void EnrollStudent()
        {
            var theStudent = SelectedNonEnrolledStudent;

            SelectedSection.StudentIds.Add(theStudent.Id);
            mDataService.Save();

            EnrolledStudents.Add(theStudent);
            NonEnrolledStudents.Remove(theStudent);

            SelectedEnrolledStudent = theStudent;
        }
Beispiel #6
0
 public bool UpdateTeacherComment([FromBody] EnrolledStudents model)
 {
     try
     {
         CoursesRepository _searchRepository = new CoursesRepository();
         var result = _searchRepository.UpdateTeacherComment(model.Comments, model.ResultId);
         return(result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #7
0
 public QuestionsAndAnswers ExamRecords([FromBody] EnrolledStudents model)
 {
     try
     {
         CoursesRepository _searchRepository = new CoursesRepository();
         var Result = _searchRepository.ExamRecords(model.ExamId, model.Username, model.Result);
         return(Result);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Beispiel #8
0
  //**************************************
  //	
  public bool Drop(Student s) {
    // We may only drop a student if he/she is enrolled.

    if (!s.IsEnrolledIn(this)) {
      return false;
    }  
    else {
      // Find the student in our Dictionary, and remove it.

      EnrolledStudents.Remove(s.Id);

      // Note bidirectionality.

      s.DropSection(this);
      return true;
    }
  }
Beispiel #9
0
 //Takes in all students and checks if they are on the roster of the instance object
 //if the ZID is found int the roster it will print the student using the .ToString() override.
 public void PrintRoster(List <Student> students)
 {
     if (students == null)
     {
         throw new ArgumentNullException("students cannot be null.");
     }
     Console.WriteLine("\nCourse: {0} {1}-{2} ({3}/{4})", DepartmentCode, CourseNumber, SectionNumber, EnrolledCount, MaximumCapacity);
     Console.WriteLine("-------------------------------------------------------------------");
     if (!EnrolledStudents.Any())
     {
         Console.WriteLine("There are no students currently enrolled in this course.");
     }
     else
     {
         foreach (var student in students)
         {
             if (EnrolledStudents.Contains(student.ZId))
             {
                 Console.WriteLine("{0} {1}, {2} {3}", student.ZId, student.LastName, student.FirstName, student.Major);
             }
         }
     }
 }
Beispiel #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Rebecca - If no session exists, or if  not a Senior University Manager, redirect to default page.
        if (Session["user"] == null || (Convert.ToInt32(Session["typeID"]) != 3))
        {
            Response.Redirect("../Default.aspx");
        }
        else
        {
            //Otherwise, store session in username field.
            string user = Session["user"].ToString();
            username.Text  = user;
            username1.Text = user;

            // Rebecca:
            //////////////////////////////////////////////// CALCULATIONS /////////////////////////////////////////////////

            //1 Student Count
            //Databinding the completed listview
            StudentList.DataBind();

            //Counting number of students
            int sum = StudentList.Items.Count();

            //Placing student count in label
            if (sum == 0)
            {
                studentCount.Text = "No students on record";
            }
            else
            {
                studentCount.Text = Convert.ToString(sum);
            }

            //2 Dropped Out Count
            //Databinding the completed listview
            DroppedOutStudents.DataBind();
            //Counting number of students dropped out
            int droppedOut = DroppedOutStudents.Items.Count();

            //If no students are dropped out set the label to 0, otherwise put the number of students counted in the label.
            if (droppedOut == 0)
            {
                studentDropped.Text = "0";
            }
            else
            {
                studentDropped.Text = Convert.ToString(droppedOut) + " students have left a course.";
            }

            //Calculating drop out rate:
            decimal DropOut     = Decimal.Divide(droppedOut, sum) * 100;
            double  dropOutRate = Convert.ToInt32(DropOut);
            PercentageDroppedOut.Text = Convert.ToString(dropOutRate) + "%";


            //3 Caculating Retention:
            int retention = sum - droppedOut;
            Retention.Text = Convert.ToString(retention) + " students have remained on course.";

            //Retention Rate:
            decimal retent        = Decimal.Divide(retention, sum) * 100;
            double  RetentionRate = Convert.ToInt32(retent);
            retentionRate.Text = Convert.ToString(RetentionRate) + "%";

            //4 Enrolled Count
            //Databinding the completed listview
            EnrolledStudents.DataBind();
            //Counting number of students enrolled
            int enrolled = EnrolledStudents.Items.Count();

            //If no students are counted set the label to 0, otherwise put the number of students counted in the label.
            if (enrolled == 0)
            {
                studentEnrolled.Text = "0";
            }
            else
            {
                studentEnrolled.Text = Convert.ToString(enrolled);
            }

            //Calculating enrolled rate:
            decimal Enrolled     = Decimal.Divide(enrolled, sum) * 100;
            double  EnrolledRate = Convert.ToInt32(Enrolled);
            enrolledRate.Text = Convert.ToString(EnrolledRate) + "%";

            //5 Counting all results on record
            results.DataBind();
            int resultnum = results.Items.Count();

            //6 Results Passed Count
            //Databinding the completed listview
            Passed.DataBind();

            //Counting number of pass results
            int passnum = Passed.Items.Count();

            //Placing pass count in label
            if (passnum == 0)
            {
                pass.Text = "No pass results on record.";
            }
            else
            {
                pass.Text = Convert.ToString(passnum) + " students have pass results.";
            }

            //Calculating pass rate:
            decimal PassedRate = Decimal.Divide(passnum, resultnum) * 100;
            double  PassRate   = Convert.ToInt32(PassedRate);
            passrate.Text = Convert.ToString(PassRate) + "%";


            //7 Results Failed Count
            //Databinding the completed listview
            Failed.DataBind();

            //Counting number of fail results
            int failnum = Failed.Items.Count();

            //Placing pass count in label
            if (failnum == 0)
            {
                fail.Text = "No fail results on record.";
            }
            else
            {
                fail.Text = Convert.ToString(failnum) + " students have fail results.";
            }

            //Calculating pass rate:
            decimal FailedRate = Decimal.Divide(failnum, resultnum) * 100;
            double  FailRate   = Convert.ToInt32(FailedRate);
            failrate.Text = Convert.ToString(FailRate) + "%";

            //8 Fees Unpaid Count
            //Databinding the completed listview
            unpaidlist.DataBind();

            //Counting number of unpaid fees
            int unpaidnum = unpaidlist.Items.Count();

            //Placing unpaid fee count in label
            if (unpaidnum == 0)
            {
                feesunpaid.Text = "No records";
            }
            else
            {
                feesunpaid.Text = Convert.ToString(unpaidnum) + " students have no payments.";
            }

            //Calculating unpaid rate:
            decimal UnpaidRate = Decimal.Divide(unpaidnum, sum) * 100;
            double  unpaidrate = Convert.ToInt32(UnpaidRate);
            feesunpaidrate.Text = Convert.ToString(unpaidrate) + "%";

            //9 Fees Paid Count
            //Databinding the completed listview
            paidlist.DataBind();

            //Counting number of fail results
            int paidnum = paidlist.Items.Count();

            //Placing paid count in label
            if (unpaidnum == 0)
            {
                feespaid.Text = "No records";
            }
            else
            {
                feespaid.Text = Convert.ToString(paidnum) + " students have paid off their fees.";
            }

            //Calculating paid rate:
            decimal PaidRate = Decimal.Divide(paidnum, sum) * 100;
            double  paidrate = Convert.ToInt32(PaidRate);
            feespaidrate.Text = Convert.ToString(paidrate) + "%";

            //10 Payments Made Count
            //Databinding the completed listview
            paymentlist.DataBind();

            //Counting number of payments
            int paymentnum = paymentlist.Items.Count();

            //Placing payments count in label
            if (paymentnum == 0)
            {
                paymade.Text = "No records";
            }
            else
            {
                paymade.Text = Convert.ToString(paymentnum) + " students have made a payment.";
            }

            //Calculating payments rate:
            decimal paymentRate = Decimal.Divide(paymentnum, sum) * 100;
            double  Payrate     = Convert.ToInt32(paymentRate);
            paymentsrate.Text = Convert.ToString(Payrate) + "%";

            //4 Progression Count
            //Databinding the completed listview
            firstyearlist.DataBind();
            //Counting number of students dropped out
            int first = firstyearlist.Items.Count();

            if (first == 0)
            {
                FirstPercent.Text = "0";
            }
            else
            {
                FirstPercent.Text = Convert.ToString(first) + " first years.";
            }

            //Calculating first year rate:
            decimal firstP    = Decimal.Divide(first, sum) * 100;
            double  firstRate = Convert.ToInt32(firstP);
            FirstCount.Text = Convert.ToString(firstRate) + "%";

            //Databinding the completed listview
            secondyearlist.DataBind();
            //Counting number of students dropped out
            int second = secondyearlist.Items.Count();

            if (second == 0)
            {
                SecondPercent.Text = "0";
            }
            else
            {
                SecondPercent.Text = Convert.ToString(second) + " second years.";
            }

            //Calculating second year rate:
            decimal secondP    = Decimal.Divide(second, sum) * 100;
            double  secondRate = Convert.ToInt32(secondP);
            SecondCount.Text = Convert.ToString(secondRate) + "%";

            //Databinding the completed listview
            thirdyearlist.DataBind();
            //Counting number of students dropped out
            int third = thirdyearlist.Items.Count();

            if (third == 0)
            {
                ThirdPercent.Text = "0";
            }
            else
            {
                ThirdPercent.Text = Convert.ToString(third) + " third years.";
            }


            //Calculating third year rate:
            decimal thirdP    = Decimal.Divide(third, sum) * 100;
            double  thirdRate = Convert.ToInt32(thirdP);
            ThirdCount.Text = Convert.ToString(thirdRate) + "%";



            ////////////////////////////////// CHARTS: ///////////////////////////////////////////////

            //Chart 1 - Enrolled & not enrolled student values for x & y axis:
            int      notenrolled   = sum - enrolled;
            int[]    chart1yValues = { notenrolled, enrolled };
            string[] chart1xValues = { "Unregistered", "Enrolled" };
            //Adding values above to chart:
            Chart1.Series["Series1"].Points.DataBindXY(chart1xValues, chart1yValues);
            //Styling Chart:
            Chart1.Series["Series1"].Font            = new Font("Calibri", 11, FontStyle.Bold);
            Chart1.Series["Series1"]["PointWidth"]   = "5";
            Chart1.Series["Series1"].Points[0].Color = Color.CadetBlue;
            Chart1.Series["Series1"].Points[1].Color = Color.DarkCyan;


            //Chart 2 - Student Results values for x & y axis:
            int[]    resultyValues = { passnum, failnum };
            string[] resultxValues = { "Passed", "Failed" };
            //Adding values above to chart:
            ResultsChart.Series["Series1"].Points.DataBindXY(resultxValues, resultyValues);
            //Styling Chart:
            ResultsChart.Series["Series1"].Font            = new Font("Calibri", 11, FontStyle.Bold);
            ResultsChart.Series["Series1"]["PointWidth"]   = "0.1";
            ResultsChart.Series["Series1"].Points[0].Color = Color.MediumSeaGreen;
            ResultsChart.Series["Series1"].Points[1].Color = Color.Firebrick;


            //Chart 3 - bar chart drop out/retention values for x & y axis:
            int[]    dropyValues = { sum, retention, droppedOut };
            string[] dropxValues = { "Total Students", "Retention", "Dropped out" };
            //Adding values above to chart:
            DropChart.Series["Series1"].Points.DataBindXY(dropxValues, dropyValues);
            //Styling Chart:
            DropChart.Series["Series1"].Font            = new Font("Calibri", 11, FontStyle.Bold);
            DropChart.Series["Series1"].Points[0].Color = Color.Goldenrod;
            DropChart.Series["Series1"].Points[1].Color = Color.DarkGray;
            DropChart.Series["Series1"].Points[2].Color = Color.Peru;


            //Chart 4 - Finance values for x & y axis:
            int[]    financeyValues = { paidnum, unpaidnum, paymentnum };
            string[] financexValues = { "Fees Paid", "Fees Unpaid", "Payments Made" };
            //Adding values above to chart:
            FinanceChart.Series["Series1"].Points.DataBindXY(financexValues, financeyValues);
            //Styling Chart:
            FinanceChart.Series["Series1"].Font            = new Font("Calibri", 11, FontStyle.Bold);
            FinanceChart.Series["Series1"]["PointWidth"]   = "0.1";
            FinanceChart.Series["Series1"].Points[0].Color = Color.Thistle;
            FinanceChart.Series["Series1"].Points[1].Color = Color.RosyBrown;
            FinanceChart.Series["Series1"].Points[2].Color = Color.LightGoldenrodYellow;

            //Chart 5 - Progression values for x & y axis:
            int[]    progressyValues = { first, second, third };
            string[] progressxValues = { "First", "Second", "Third" };
            //Adding values above to chart:
            ProgressChart.Series["Series1"].Points.DataBindXY(progressxValues, progressyValues);
            //Styling Chart:
            ProgressChart.Series["Series1"].Font            = new Font("Calibri", 11, FontStyle.Bold);
            ProgressChart.Series["Series1"]["PointWidth"]   = "0.1";
            ProgressChart.Series["Series1"].Points[0].Color = Color.SlateGray;
            ProgressChart.Series["Series1"].Points[1].Color = Color.DarkSlateBlue;
            ProgressChart.Series["Series1"].Points[2].Color = Color.Lavender;
        }
    }