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)); }
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)); }