using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.Students; using EMIS.CommonLogic.ScoreManage; using EMIS.ViewModel; namespace EMIS.Web.ServiceControllers.ExamineApplyManage { public class ExamineApplyServicesController : Controller { // // GET: /ExamineApplyServices/ public IExamineApplyServices ExamineApplyServices { get; set; } public ILevelScoreServices LevelScoreServices { get; set; } public ActionResult GetExaminationSubjectList(Guid? UserID) { //var schoolyear = SchoolYearServices.GetCurrentSchoolYear(); return Json(ExamineApplyServices.GetExaminationSubjectList(UserID.Value), JsonRequestBehavior.AllowGet); } public ActionResult GetExaminationApplyViewByExaminationSubjectID(Guid? ExaminationSubjectID) { return Json(ExamineApplyServices.GetExaminationApplyViewByExaminationSubjectID(ExaminationSubjectID), JsonRequestBehavior.AllowGet); } public ActionResult GetExaminationRegisterCount(Guid? UserID) { return Json(ExamineApplyServices.GetExaminationRegisterList(UserID.Value).rows.Count, JsonRequestBehavior.AllowGet); } public ActionResult GetExaminationRegisterList(Guid? UserID) { return Json(ExamineApplyServices.GetExaminationRegisterList(UserID.Value), JsonRequestBehavior.AllowGet); } public ActionResult GetStudentLevelScoreList(Guid? UserID, Guid? schoolYearID, int pageIndex, int pageSize) { return Json(LevelScoreServices.GetStudentLevelScoreGrid(new ConfiguretView(), schoolYearID, null, UserID.Value, pageIndex, pageSize), JsonRequestBehavior.AllowGet); } public ActionResult GetExaminationRegisterAndLevelScoreList(Guid? UserID, Guid? schoolYearID, int pageIndex, int pageSize) { return Json(ExamineApplyServices.GetLevelScoreViewAndRegisterList(UserID.Value, schoolYearID, pageIndex, pageSize), JsonRequestBehavior.AllowGet); } public ActionResult StudentApplySubmit(Guid? ExaminationSubjectID, Guid? UserID) { try { ExamineApplyServices.ApplySubmit(ExaminationSubjectID.Value, UserID.Value); return Json(new ReturnMessage { IsSuccess = true, Message = "报名成功" }); } catch (Exception ex) { GetExceptionDetailMessage(ex); string mge = GetExceptionDetailMessage(ex).Message; return Json(new ReturnMessage { IsSuccess = false, Message = "报名失败,原因:" + mge }); } } Exception GetExceptionDetailMessage(Exception ex) { if (ex.InnerException == null) { return ex; } else return GetExceptionDetailMessage(ex.InnerException); } public ActionResult StudentApplyCancel(Guid? ExaminationRegistrationID) { try { List idList = new List(); idList.Add(ExaminationRegistrationID.Value); ExamineApplyServices.ApplyCancel(idList); return Json(new ReturnMessage { IsSuccess = true, Message = "取消成功" }); } catch (Exception ex) { GetExceptionDetailMessage(ex); string mge = GetExceptionDetailMessage(ex).Message; return Json(new ReturnMessage { IsSuccess = false, Message = "取消失败,原因:" + mge }); } } } }