public List <GradeReport> GetListGradeReports() { var listGradeReports = new List <GradeReport>(); var gradeReportRepo = new GradeReportRepo(); var sectionRepo = new SectionRepo(); var myclass = GetClassName(); var mycourse = GetCourseID(); var section = sectionRepo.GetSectionByClassCourse(myclass, mycourse); var num = GetNumGradeReport(); if (section == null) { return(listGradeReports); } for (int i = 0; i < num; ++i) { int index = i + 2; var report = new GradeReport(); report.SectionID = section.ID; report.StudentID = data[index][1]; report.Midterm = double.Parse(data[index][3]); report.Final = double.Parse(data[index][4]); report.Other = double.Parse(data[index][5]); report.Total = double.Parse(data[index][6]); listGradeReports.Add(report); } return(listGradeReports); }
public GradeReport UpdateGradeReport(int sectionID, string studentID, double mid, double fin, double other, double total) { OleDbCommand cmd = dbconn.SqlCommand( "UPDATE grade_report SET midterm=?, final=?, other=?, total=? WHERE section_id=? AND student_id=?", mid, fin, other, total, sectionID, studentID ); try { cmd.ExecuteNonQuery(); } catch { return(null); } GradeReport gradeReport = new GradeReport(); gradeReport.SectionID = sectionID; gradeReport.StudentID = studentID; gradeReport.Midterm = mid; gradeReport.Final = fin; gradeReport.Other = other; gradeReport.Total = total; return(gradeReport); }
public static GradeReport Read(ref OleDbDataReader rd) { var gradeReport = new GradeReport(); gradeReport.SectionID = rd.GetInt32(0); gradeReport.StudentID = rd.GetString(1); gradeReport.Midterm = rd.GetDouble(2); gradeReport.Final = rd.GetDouble(3); gradeReport.Other = rd.GetDouble(4); gradeReport.Total = rd.GetDouble(5); return(gradeReport); }
public ActionResult GradeReportPartial(string EnrollmentId = "", string GradingId = "") { //ViewBag.EnrolledSubjectId = EnrolledSubjectId; ViewBag.EnrollmentId = EnrollmentId; List <Grades> model = unitOfWork.GradesRepo.Get(m => m.EnrolledSubjects.EnrollmentId == EnrollmentId && m.GradingId == GradingId).ToList(); //var subjects = model.Select(m => m.EnrolledSubjectId); GradeReport report = new GradeReport() { DataSource = model }; return(PartialView("_GradeReportPartial", report)); }
public GradeReport GetGradeReport(int sectionID, string studentID) { OleDbCommand cmd = dbconn.SqlCommand( "SELECT * FROM grade_report WHERE section_id=? AND student_id=?", sectionID, studentID ); OleDbDataReader rd = cmd.ExecuteReader(); GradeReport gradeReport = null; while (rd.Read()) { gradeReport = GradeReportReader.Read(ref rd); } return(gradeReport); }
public IActionResult Submit(string return_url, GradeReport report) { if (ModelState.IsValid) { using (var context = new SnContext()) { context.GradeReports.Add(report); context.SaveChanges(); } Flash("submission received", "success"); } else { Flash("submission not received", "danger"); } return(Redirect(return_url)); }
public GradeReport UpdateGradeReport(GradeReport r) { return(UpdateGradeReport(r.SectionID, r.StudentID, r.Midterm, r.Final, r.Other, r.Total)); }