using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.Students; using Bowin.Common.Exceptions; namespace EMIS.Web.Controllers.StudentSystem.Examine { [Authorization] public class ExamineApplyController : Controller { public Lazy StudentRecordService { get; set; } public Lazy ExamineApplyService { get; set; } // // GET: /ExamineApply/ public ActionResult Apply() { var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal; var Student = StudentRecordService.Value.GetStudentByStudentNo(user.UserID); return View(Student); } /// /// 列表查询 /// /// /// [HttpPost] public ActionResult GetExaminationSubjectList() { var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal; return base.Json(ExamineApplyService.Value.GetExaminationSubjectList(user.UserID)); } /// /// /// /// [HttpPost] public ActionResult GetExaminationRegisterList() { var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal; return base.Json(ExamineApplyService.Value.GetExaminationRegisterList(user.UserID)); } public ActionResult ApplySubmit(string ExaminationSubjectID) { try { Guid subjectID = Guid.Parse(Request.Params["ExaminationSubjectID"]); int version = int.Parse(Request.Params["Version"]); var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal; ExamineApplyService.Value.ApplySubmit(subjectID, user.UserID); return base.Json("报名成功"); } catch (Exception ex) { GetExceptionDetailMessage(ex); string mge = GetExceptionDetailMessage(ex).Message; return base.Json("报名失败,原因:" + mge); } } Exception GetExceptionDetailMessage(Exception ex) { if (ex.InnerException == null) { return ex; } else return GetExceptionDetailMessage(ex.InnerException); } public ActionResult ApplyCancel(string ExaminationRegistrationIDs) { try { var xaminationRegistrationIDList = ExaminationRegistrationIDs.Split(',').Where(x => x.IndexOf("-") >= 0).Select(x => new Guid(x)).ToList(); var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal; ExamineApplyService.Value.ApplyCancel(xaminationRegistrationIDList); return base.Json("撤销成功"); } catch (Exception ex) { string mge = ex.Message; return base.Json("撤销失败,原因:" + mge); } } } }