public List <StudentResultShow> GetResultByRegistrationId(int studentRegisterId)
        {
            List <StudentResultShow> resultList         = _studentResultGateway.GetResultByRegistrationId(studentRegisterId);
            List <Course>            enrolledCourseList = _studentEnrollManager.GetEnrolledCoursesByStudentId(studentRegisterId);
            List <StudentResultShow> newResultList      = new List <StudentResultShow>();
            StudentResultShow        studentResult      = null;

            foreach (Course course in enrolledCourseList)
            {
                bool flag = false;
                foreach (StudentResultShow resultShow in resultList)
                {
                    if (resultShow.CourseName == course.CourseName)
                    {
                        newResultList.Add(resultShow);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    studentResult = new StudentResultShow();
                    string grade = "Not Graded Yet";
                    studentResult.CourseCode = course.CourseCode;
                    studentResult.CourseName = course.CourseName;
                    studentResult.GradeName  = grade;
                    newResultList.Add(studentResult);
                }
            }
            return(newResultList);
        }
        public List <StudentResultShow> GetResultByRegistrationId(int studentRegisterId)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "select CourseCode,CourseName,Grade from Showresult where Id='" + studentRegisterId + "' ";


            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();

            SqlDataReader reader = command.ExecuteReader();


            List <StudentResultShow> resultList = new List <StudentResultShow>();

            while (reader.Read())
            {
                StudentResultShow result = new StudentResultShow();
                result.CourseName = reader["CourseName"].ToString();
                result.GradeName  = reader["Grade"].ToString();

                result.CourseCode = reader["CourseCode"].ToString();

                resultList.Add(result);
            }
            reader.Close();
            connection.Close();
            return(resultList);
        }
예제 #3
0
        public ActionResult ShowResult(StudentResultShow studentResult)
        {
            var studentList = _studentRegisterManager.GetAllStudents();

            ViewBag.Students = new SelectList(studentList, "StudentId", "RegNumber");

            GeneratePdf(studentResult.StudentRegisterId);
            return(View());
        }