123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.CommonLogic.Students;
- using EMIS.CommonLogic.SystemSetting;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using Bowin.Common.Utility;
- using Bowin.Common.Data;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.StudentSystem.MyGrade
- {
- [Authorization]
- public class CourseGradeController : Controller
- {
- public IStudentRecordServices StudentRecordService { get; set; }
- public Lazy<IDictionaryServices> DictionaryServices { get; set; }
- public Lazy<ICourseGradeServices> CourseGradeServices { get; set; }
- public IMenuServices menuServices { get; set; }
-
- //
- // GET: /CourseGrade/
- public ActionResult ViewGrade()
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- decimal ScoreCredit = 0;
- var Student = CourseGradeServices.Value.GetStudentInfo(user.UserID);
- var Grade = CourseGradeServices.Value.GetStudentCourseGrade(user.UserID);
- //Student.AverageGrade = Grade.Sum(x => x.TotalScore) / Grade.Count;
- foreach (var starttermIDS in Grade.GroupBy(q => q.StarttermID).Select(q => q.Key))
- {
- var YearGradeS = Grade.Where(q => q.StarttermID == starttermIDS).ToList();
- foreach (var Grades in YearGradeS)
- {
-
- ScoreCredit += Grades.ScoreCredit??0;
-
- }
- }
- Student.ScoreCredit = ScoreCredit;
- string menuNo = HttpContext.Request["MNU"];
- string path = menuServices.GetFullMenuPath(menuNo);
- ViewBag.Path = path;
- ViewBag.CurseGrade = Grade;
- return View(Student);
- }
- public ActionResult GTViewGrade()
- {
- var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
- decimal ScoreCredit = 0;
- var Student = CourseGradeServices.Value.GetStudentInfo(user.UserID);
- var Grade = CourseGradeServices.Value.GetStudentCourseGrade(user.UserID);
- //Student.AverageGrade = Grade.Sum(x => x.TotalScore) / Grade.Count;
- foreach (var starttermIDS in Grade.GroupBy(q => q.StarttermID).Select(q => q.Key))
- {
- var YearGradeS = Grade.Where(q => q.StarttermID == starttermIDS).ToList();
- foreach (var Grades in YearGradeS)
- {
- ScoreCredit += Grades.ScoreCredit ?? 0;
- }
- }
- Student.ScoreCredit = ScoreCredit;
- string menuNo = HttpContext.Request["MNU"];
- string path = menuServices.GetFullMenuPath(menuNo);
- ViewBag.Path = path;
- ViewBag.CurseGrade = Grade;
- return View(Student);
- }
- public ActionResult StudentScoreReport()
- {
- return View();
- }
- /// <summary>
- /// 学生个人成绩明细列表查询
- /// </summary>
- /// <param name="pararms"></param>
- /// <returns></returns>
- [HttpPost]
- public ActionResult GetSubmitedScoreList(Guid? CoursematerialID, int? StartTermID, Guid? UserID)
- {
- return base.Json(CourseGradeServices.Value.GetSubmitedScoreList(CoursematerialID, StartTermID, UserID));
- }
- /// <summary>
- /// 导出
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public ActionResult Excel()
- {
- NpoiExcelHelper neh = new NpoiExcelHelper();
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
- Guid? CoursematerialID = Request.Form["CoursematerialID"].ParseStrTo<Guid>();
- int? StarTermID = Request.Form["StarTermID"].ParseStrTo<int>();
- Guid? UserID = Request.Form["UserID"].ParseStrTo<Guid>();
- var dt = CourseGradeServices.Value.GetStudentPersonalScoreViewList(configuretView, CoursematerialID, StarTermID, UserID).Select(x => new
- {
- x.LoginID,
- x.UserName,
- x.SchoolyearCode,
- x.CourseCode,
- x.CourseName,
- x.TotalScore,
- x.Pingshi,
- x.Jishu,
- x.Lilun,
- x.ScoreCredit,
- x.CreateTime,
- x.OperaUser,
- x.ExamsCategoryName,
- x.ExamsStateName,
- x.Remarks
- }).ToTable();
- string[] liststring = { "学号", "姓名", "学年学期", "课程代码", "课程名称", "总成绩", @EMIS.Utility.RSL.Get("Peacetime"), @EMIS.Utility.RSL.Get("Technique"), @EMIS.Utility.RSL.Get("Theoretical"),
- "课程学分", "课程类型", "录入时间", "录入人", "考试性质", "考试状态", "备注" };
- neh.Export(dt, liststring, "成绩详细信息");
- return RedirectToAction("MsgShow", "Common", new
- {
- msg = "导出成功!",
- url = Url.Action("List").AddMenuParameter()
- });
- }
- }
- }
|