ExamineApplyController.cs 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 Bowin.Common.Exceptions;
  8. namespace EMIS.Web.Controllers.StudentSystem.Examine
  9. {
  10. [Authorization]
  11. public class ExamineApplyController : Controller
  12. {
  13. public Lazy<IStudentRecordServices> StudentRecordService { get; set; }
  14. public Lazy<IExamineApplyServices> ExamineApplyService { get; set; }
  15. //
  16. // GET: /ExamineApply/
  17. public ActionResult Apply()
  18. {
  19. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  20. var Student = StudentRecordService.Value.GetStudentByStudentNo(user.UserID);
  21. return View(Student);
  22. }
  23. /// <summary>
  24. /// 列表查询
  25. /// </summary>
  26. /// <param name="pararms"></param>
  27. /// <returns></returns>
  28. [HttpPost]
  29. public ActionResult GetExaminationSubjectList()
  30. {
  31. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  32. return base.Json(ExamineApplyService.Value.GetExaminationSubjectList(user.UserID));
  33. }
  34. /// <summary>
  35. ///
  36. /// </summary>
  37. /// <returns></returns>
  38. [HttpPost]
  39. public ActionResult GetExaminationRegisterList()
  40. {
  41. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  42. return base.Json(ExamineApplyService.Value.GetExaminationRegisterList(user.UserID));
  43. }
  44. public ActionResult ApplySubmit(string ExaminationSubjectID)
  45. {
  46. try
  47. {
  48. Guid subjectID = Guid.Parse(Request.Params["ExaminationSubjectID"]);
  49. int version = int.Parse(Request.Params["Version"]);
  50. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  51. ExamineApplyService.Value.ApplySubmit(subjectID, user.UserID);
  52. return base.Json("报名成功");
  53. }
  54. catch (Exception ex)
  55. {
  56. GetExceptionDetailMessage(ex);
  57. string mge = GetExceptionDetailMessage(ex).Message;
  58. return base.Json("报名失败,原因:" + mge);
  59. }
  60. }
  61. Exception GetExceptionDetailMessage(Exception ex)
  62. {
  63. if (ex.InnerException == null)
  64. {
  65. return ex;
  66. }
  67. else
  68. return GetExceptionDetailMessage(ex.InnerException);
  69. }
  70. public ActionResult ApplyCancel(string ExaminationRegistrationIDs)
  71. {
  72. try
  73. {
  74. var xaminationRegistrationIDList = ExaminationRegistrationIDs.Split(',').Where(x => x.IndexOf("-") >= 0).Select(x => new Guid(x)).ToList();
  75. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  76. ExamineApplyService.Value.ApplyCancel(xaminationRegistrationIDList);
  77. return base.Json("撤销成功");
  78. }
  79. catch (Exception ex)
  80. {
  81. string mge = ex.Message;
  82. return base.Json("撤销失败,原因:" + mge);
  83. }
  84. }
  85. }
  86. }