Esempio n. 1
0
        public static List <student_grade> GetStudentGradeListByQual(db_tafebuddyEntities db, string studentId, string qual)
        {
            List <student_grade> listGrades = new List <student_grade>();

            student_studyplan ssp = db.student_studyplan.Where(a => a.QualCode.ToUpper().Equals(qual.ToUpper())).FirstOrDefault();

            Dictionary <string, string> subjects = new Dictionary <string, string>();

            var grades = db.student_grade.Where(a => a.StudentID.Equals(studentId)).ToList();

            grades.ForEach(a => subjects.Add(a.CRN, a.crn_detail.SubjectCode));

            // all the subjects according to the qualification
            List <string> subCodes = SRVReusltFunc.GetSubjectsByQualification(db, qual);


            foreach (var item in subCodes)
            {
                bool found = false;
                foreach (var i in subjects)
                {
                    if (i.Value.ToUpper().Equals(item.ToUpper()))
                    {
                        student_grade grade = db.student_grade.Where(a => a.crn_detail.CRN.ToUpper().Equals(i.Key.ToUpper()) && a.StudentID.Equals(studentId)).FirstOrDefault() as student_grade;
                        listGrades.Add(grade);
                        found = true;
                    }
                }
                if (!found)
                {
                    crn_detail        cd = db.crn_detail.Where(a => a.SubjectCode.ToUpper().Equals(item.ToUpper())).FirstOrDefault();
                    student_studyplan ss = db.student_studyplan.Where(a => a.StudentID.Equals(studentId) && a.QualCode.Equals(qual)).FirstOrDefault();
                    if (cd != null)
                    {
                        listGrades.Add(new student_grade()
                        {
                            StudentID    = studentId,
                            CRN          = cd.CRN,
                            TafeCompCode = cd.TafeCompCode,
                            TermCode     = ss.TermCodeStart,
                            TermYear     = ss.TermYearStart,
                            Grade        = "NS",
                            GradeDate    = null,
                            crn_detail   = cd,
                            student      = grades[0].student
                        });
                    }
                }
            }

            return(listGrades);
        }
Esempio n. 2
0
        public ActionResult IndexQual(string qual, string studentID)
        {
            var student_studyplan = db.student_studyplan.Where((a) => a.StudentID == studentID && a.QualCode.Equals(qual)).FirstOrDefault();
            var ssp = db.student_studyplan.Where(a => a.StudentID.Equals(studentID)).ToList();
            Dictionary <string, List <student_grade> > grades = new Dictionary <string, List <student_grade> >();

            foreach (var item in ssp)
            {
                grades.Add(item.QualCode, SRVReusltFunc.GetStudentGradeListByQual(db, studentID, item.QualCode));
            }
            //List<student_grade> grades = SRVReusltFunc.GetStudentGradeListByQual(db, studentID, qual);
            ViewBag.qual   = qual;
            ViewBag.grades = grades;

            List <ParchmentItem> pi = new List <ParchmentItem>();
            int qualYear            = 0;

            foreach (var item in grades)
            {
                if (item.Key.Equals(qual))
                {
                    qualYear = student_studyplan.student.student_studyplan.Where(a => a.QualCode.Equals(item.Key)).FirstOrDefault().TermYearStart;
                    foreach (var it in item.Value)
                    {
                        string q = it.student.student_studyplan.Where(a => a.QualCode.Equals(item.Key)).FirstOrDefault().QualCode;
                        //string q = it.term_datetime.student_studyplan.Where(a => a.StudentID.Equals(_st.StudentID)).FirstOrDefault().QualCode;
                        string sj = it.crn_detail.subject.SubjectCode; // q

                        pi.Add(new ParchmentItem()
                        {
                            grade   = it,
                            subject = it.crn_detail.subject,
                            comp    = it.crn_detail.competency,
                            subjectQualification = it.crn_detail.subject.subject_qualification.Where(a => a.QualCode.Equals(q)).First()
                        });
                    }
                }
            }
            ViewBag.year          = qualYear;
            ViewBag.parchmentItem = pi;

            return(View("Index", student_studyplan));
        }
Esempio n. 3
0
        public ActionResult SelectQual(string studentId, string qual, int?save)
        {
            List <student_grade> listGrades = new List <student_grade>();

            ViewBag.qual = qual;
            listGrades   = SRVReusltFunc.GetStudentGradeListByQual(db, studentId, qual);

            int failCount = 0;

            foreach (var item in listGrades)
            {
                if (item.Grade.ToUpper().Equals("F"))
                {
                    failCount++;
                }
            }
            ViewBag.passPercentage = Math.Round(1 - (double)failCount / listGrades.Count, 3) * 100;
            if (save == 1)
            {
                ViewBag.AddParchment = "true";
            }

            return(View("StudentResult", listGrades));
        }