ExamineApplyServicesController.cs 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.CommonLogic.Students;
  7. using EMIS.CommonLogic.ScoreManage;
  8. using EMIS.ViewModel;
  9. namespace EMIS.Web.ServiceControllers.ExamineApplyManage
  10. {
  11. public class ExamineApplyServicesController : Controller
  12. {
  13. //
  14. // GET: /ExamineApplyServices/
  15. public IExamineApplyServices ExamineApplyServices { get; set; }
  16. public ILevelScoreServices LevelScoreServices { get; set; }
  17. public ActionResult GetExaminationSubjectList(Guid? UserID)
  18. {
  19. //var schoolyear = SchoolYearServices.GetCurrentSchoolYear();
  20. return Json(ExamineApplyServices.GetExaminationSubjectList(UserID.Value), JsonRequestBehavior.AllowGet);
  21. }
  22. public ActionResult GetExaminationApplyViewByExaminationSubjectID(Guid? ExaminationSubjectID)
  23. {
  24. return Json(ExamineApplyServices.GetExaminationApplyViewByExaminationSubjectID(ExaminationSubjectID), JsonRequestBehavior.AllowGet);
  25. }
  26. public ActionResult GetExaminationRegisterCount(Guid? UserID)
  27. {
  28. return Json(ExamineApplyServices.GetExaminationRegisterList(UserID.Value).rows.Count, JsonRequestBehavior.AllowGet);
  29. }
  30. public ActionResult GetExaminationRegisterList(Guid? UserID)
  31. {
  32. return Json(ExamineApplyServices.GetExaminationRegisterList(UserID.Value), JsonRequestBehavior.AllowGet);
  33. }
  34. public ActionResult GetStudentLevelScoreList(Guid? UserID, Guid? schoolYearID, int pageIndex, int pageSize)
  35. {
  36. return Json(LevelScoreServices.GetStudentLevelScoreGrid(new ConfiguretView(), schoolYearID, null, UserID.Value, pageIndex, pageSize), JsonRequestBehavior.AllowGet);
  37. }
  38. public ActionResult GetExaminationRegisterAndLevelScoreList(Guid? UserID, Guid? schoolYearID, int pageIndex, int pageSize)
  39. {
  40. return Json(ExamineApplyServices.GetLevelScoreViewAndRegisterList(UserID.Value, schoolYearID, pageIndex, pageSize), JsonRequestBehavior.AllowGet);
  41. }
  42. public ActionResult StudentApplySubmit(Guid? ExaminationSubjectID, Guid? UserID)
  43. {
  44. try
  45. {
  46. ExamineApplyServices.ApplySubmit(ExaminationSubjectID.Value, UserID.Value);
  47. return Json(new ReturnMessage { IsSuccess = true, Message = "报名成功" });
  48. }
  49. catch (Exception ex)
  50. {
  51. GetExceptionDetailMessage(ex);
  52. string mge = GetExceptionDetailMessage(ex).Message;
  53. return Json(new ReturnMessage { IsSuccess = false, Message = "报名失败,原因:" + mge });
  54. }
  55. }
  56. Exception GetExceptionDetailMessage(Exception ex)
  57. {
  58. if (ex.InnerException == null)
  59. {
  60. return ex;
  61. }
  62. else
  63. return GetExceptionDetailMessage(ex.InnerException);
  64. }
  65. public ActionResult StudentApplyCancel(Guid? ExaminationRegistrationID)
  66. {
  67. try
  68. {
  69. List<Guid> idList = new List<Guid>();
  70. idList.Add(ExaminationRegistrationID.Value);
  71. ExamineApplyServices.ApplyCancel(idList);
  72. return Json(new ReturnMessage { IsSuccess = true, Message = "取消成功" });
  73. }
  74. catch (Exception ex)
  75. {
  76. GetExceptionDetailMessage(ex);
  77. string mge = GetExceptionDetailMessage(ex).Message;
  78. return Json(new ReturnMessage { IsSuccess = false, Message = "取消失败,原因:" + mge });
  79. }
  80. }
  81. }
  82. }