You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

168 lines
5.2 KiB

  1. using Learun.Application.Base.SystemModule;
  2. using Learun.Application.TwoDevelopment.EducationalAdministration;
  3. using Learun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. using Learun.Application.Organization;
  10. using System.IO;
  11. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  12. {
  13. public class StuEnrollPhoneController : Controller
  14. {
  15. private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
  16. private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL();
  17. #region 视图
  18. public ActionResult Link()
  19. {
  20. return View();
  21. }
  22. public ActionResult Form()
  23. {
  24. return View();
  25. }
  26. public ActionResult Search(int type)
  27. {
  28. if (type == 1)
  29. {
  30. ViewBag.Title = "查询考试地点及时间";
  31. }
  32. if (type == 2)
  33. {
  34. ViewBag.Title = "查询录取结果";
  35. }
  36. return View();
  37. }
  38. public ActionResult SearchResult()
  39. {
  40. return View();
  41. }
  42. /// <summary>
  43. /// 招生简章
  44. /// </summary>
  45. /// <returns></returns>
  46. public ActionResult StuRecruitmentBrochure()
  47. {
  48. return View();
  49. }
  50. #endregion
  51. [HttpGet]
  52. [AjaxOnly]
  53. public ActionResult GetEmpInfoEntityByEmpNo(string empNo)
  54. {
  55. var EmpInfoData = empInfoIBLL.GetEmpInfoEntityByEmpNo(empNo);
  56. EmpInfoData.resume = WebHelper.HtmlDecode(EmpInfoData.resume);
  57. return Success(EmpInfoData);
  58. }
  59. /// <summary>
  60. /// 报名
  61. /// </summary>
  62. /// <param name="keyValue">主键</param>
  63. /// <param name="EmpNo">招生老师</param>
  64. /// <param name="strEntity"></param>
  65. /// <returns></returns>
  66. [HttpPost]
  67. [AjaxOnly]
  68. public ActionResult SaveForm(string keyValue, string EmpNo, string strEntity, string scoreList)
  69. {
  70. StuEnrollEntity entity = strEntity.ToObject<StuEnrollEntity>();
  71. List<StuEnrollMidExamScoreEntity> scoreData = scoreList.ToObject<List<StuEnrollMidExamScoreEntity>>();
  72. if (string.IsNullOrEmpty(keyValue))
  73. {
  74. var model = stuEnrollIBLL.GetEntityByPersonalData(entity.IDCard, entity.StuName);
  75. if (model != null)
  76. {
  77. return Fail("您已报名,请耐心等待结果!");
  78. }
  79. }
  80. entity.EmpNo = EmpNo;
  81. stuEnrollIBLL.SaveEnroll(keyValue, entity, scoreData);
  82. return Success("保存成功!");
  83. }
  84. /// <summary>
  85. ///
  86. /// </summary>
  87. /// <param name="type">1 查询考试地点及时间;2 查询录取结果</param>
  88. /// <param name="strEntity"></param>
  89. /// <returns></returns>
  90. [HttpGet]
  91. [AjaxOnly]
  92. public ActionResult SearchForm(int type, StuEnrollEntity entity)
  93. {
  94. var data = stuEnrollIBLL.SearchForm(type, entity);
  95. var jsonData = new object();
  96. if (data != null)
  97. {
  98. jsonData = new
  99. {
  100. StuEnroll = data,
  101. examData = stuEnrollIBLL.GetExamDataByStuId(data.StuId)
  102. };
  103. }
  104. else
  105. {
  106. jsonData = new
  107. {
  108. StuEnroll = data,
  109. examData = new List<ExamSubjectEntity>()
  110. };
  111. }
  112. return Success(jsonData);
  113. }
  114. /// <summary>
  115. /// 下载
  116. /// </summary>
  117. /// <param name="name">文件名称</param>
  118. /// <param name="pathName">原文件名称</param>
  119. /// <returns></returns>
  120. public ActionResult FileDownLoad(string name, string pathName)
  121. {
  122. FileStreamResult result = null;
  123. try
  124. {
  125. var path = Server.MapPath("~/Content/otherFile/");
  126. var pathoffull = path + pathName;
  127. FileStream fsread = new FileStream(pathoffull, FileMode.OpenOrCreate, FileAccess.ReadWrite);
  128. result = File(fsread, "application/pdf", name + ".pdf");
  129. return result;
  130. }
  131. catch (Exception ex)
  132. {
  133. return null;
  134. }
  135. }
  136. protected virtual ActionResult Success(string info)
  137. {
  138. return Content(new ResParameter { code = ResponseCode.success, info = info, data = new object { } }.ToJson());
  139. }
  140. protected virtual ActionResult Success(object data)
  141. {
  142. return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
  143. }
  144. protected virtual ActionResult Fail(object data)
  145. {
  146. return Content(new ResParameter { code = ResponseCode.fail, info = "响应失败", data = data }.ToJson());
  147. }
  148. protected virtual ActionResult JsonResult(object data)
  149. {
  150. return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
  151. }
  152. }
  153. }