123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMISOnline.CommonLogic.CourseworkServices;
- using EMISOnline.CommonLogic.StudentServices;
- using EMISOnline.Entities;
- using Bowin.Web.Controls.Mvc;
- using EMISOnline.ViewModel.Coursework;
- namespace EMISOnline.Web.Controllers.Manage
- {
- [Authorization]
- public partial class CourseworkController : Controller
- {
- public ITeacherScoreServices TeacherScoreServices { get; set; }
- public ISchoolyearServices SchoolyearServices { get; set; }
- public ActionResult CourseScoreList()
- {
- return View();
- }
- public JsonResult getConrseScoreJson(int page, int rows, string CoursematerialName, string StudentName)
- {
- var teacher = HttpContext.User as EMISOnline.Utility.FormValidate.CustomPrincipal;
- var schoolyear = SchoolyearServices.GetStudentSchollyear(teacher.UserID);
- var list = TeacherScoreServices.ConrseScoreList(page, rows, CoursematerialName, StudentName, teacher.UserID, schoolyear.SchoolyearID);
- return Json(list, JsonRequestBehavior.AllowGet);
- }
- [HttpPost]
- public JsonResult setConrseScore(string models)
- {
- try
- {
- var strmodels = models.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
- var teacher = HttpContext.User as EMISOnline.Utility.FormValidate.CustomPrincipal;
- var schoolyear = SchoolyearServices.GetStudentSchollyear(teacher.UserID);
- List<ER_TeacherScore> teas = new List<ER_TeacherScore>();
- string result = "";
- strmodels.ToList().ForEach(strm =>
- {
- var strdatas=strm.Split(',');
- var tea = new ER_TeacherScore();
- teas.Add(tea);
- tea.TeacherScoreID = strdatas[1].Contains("null") ? Guid.Empty : new Guid(strdatas[1].Trim());
- tea.UserID = new Guid(strdatas[0].Trim());
- tea.CoursematerialID = new Guid(strdatas[2].Trim());
- tea.Score = strdatas[3].Contains("null") ? 0 : decimal.Parse(strdatas[3].Trim());
- tea.CreateTime = DateTime.Now;
- tea.ModifyTime = DateTime.Now;
- tea.CreateUserID = teacher.UserID;
- tea.ModifyUserID = teacher.UserID;
- tea.SchoolyearID = schoolyear.SchoolyearID;
- tea.RecordStatus = 1;
- });
- result = TeacherScoreServices.SetStudentScore(teas);
- if (string.IsNullOrEmpty(result))
- {
- return Json(new { IsSuccess = true, msg = "修改成功!" }, JsonRequestBehavior.AllowGet);
- }
- else
- {
- return Json(new { IsSuccess = false, msg = "失败:" + result }, JsonRequestBehavior.AllowGet);
- }
- }
- catch (Exception ex)
- {
- return Json(new { IsSuccess = false, msg = "失败:" + ex.Message }, JsonRequestBehavior.AllowGet);
- }
- }
- }
- }
|