PersonalInfoController.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.IO;
  7. using Bowin.Web.Controls.Mvc;
  8. using EMIS.Web.Controls;
  9. using EMIS.Utility;
  10. using EMIS.ViewModel;
  11. using EMIS.ViewModel.StudentManage.StudentProfile;
  12. using EMIS.CommonLogic.StudentManage.StudentProfile;
  13. using EMIS.CommonLogic.StudentWeb.InfoCenter;
  14. namespace EMIS.Web.Controllers.StudentWeb.InfoCenter
  15. {
  16. [Authorization]
  17. public class PersonalInfoController : Controller
  18. {
  19. public Lazy<IPersonalInfoServices> PersonalInfoServices { get; set; }
  20. public Lazy<IStudentServices> StudentServices { get; set; }
  21. /// <summary>
  22. /// 个人信息(学生)页面
  23. /// </summary>
  24. /// <returns></returns>
  25. public ActionResult Index()
  26. {
  27. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  28. var studentView = StudentServices.Value.GetStudentView(user.UserID);
  29. return View(studentView);
  30. }
  31. /// <summary>
  32. /// 编辑
  33. /// </summary>
  34. /// <returns></returns>
  35. public ActionResult Edit()
  36. {
  37. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  38. return View();
  39. }
  40. /// <summary>
  41. /// 编辑
  42. /// </summary>
  43. /// <param name="studentView"></param>
  44. /// <returns></returns>
  45. [HttpPost]
  46. public ActionResult Edit(StudentView studentView)
  47. {
  48. try
  49. {
  50. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  51. return RedirectToAction("MsgShow", "Common", new
  52. {
  53. WindowID = Request["WindowID"],
  54. msg = "保存成功。",
  55. url = Url.Action("Index").AddMenuParameter()
  56. });
  57. }
  58. catch (Exception ex)
  59. {
  60. return RedirectToAction("MsgShowAndOpen", "Common", new
  61. {
  62. WindowID = Request["WindowID"],
  63. msg = "保存失败,原因:" + ex.Message
  64. });
  65. }
  66. }
  67. /// <summary>
  68. /// 网上校对开放对象信息
  69. /// </summary>
  70. /// <returns></returns>
  71. [HttpPost]
  72. public ActionResult CheckOpenObject()
  73. {
  74. try
  75. {
  76. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  77. PersonalInfoServices.Value.StudentOpenObject(user.UserID);
  78. return Json(new ReturnMessage()
  79. {
  80. IsSuccess = true,
  81. Message = "允许校对。"
  82. });
  83. }
  84. catch (Exception ex)
  85. {
  86. return Json(new ReturnMessage()
  87. {
  88. IsSuccess = false,
  89. Message = "禁止校对:" + ex.Message
  90. });
  91. }
  92. }
  93. /// <summary>
  94. /// 个人信息校对
  95. /// </summary>
  96. /// <returns></returns>
  97. public ActionResult CheckEdit()
  98. {
  99. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  100. var studentEditFeildList = PersonalInfoServices.Value.GetStudentEditFeildList();
  101. if (studentEditFeildList != null && studentEditFeildList.Count() > 0)
  102. {
  103. ViewBag.EditFeildViews = studentEditFeildList;
  104. ViewBag.TypeNames = studentEditFeildList.OrderBy(x => x.OrderNo).GroupBy(x => x.TypeName).Select(x => x.Key).ToList();
  105. var studentView = StudentServices.Value.GetStudentView(user.UserID);
  106. return View(studentView);
  107. }
  108. else
  109. {
  110. throw new Exception("对应的校对控制信息为空(未配置)。");
  111. }
  112. }
  113. /// <summary>
  114. /// 个人信息校对
  115. /// </summary>
  116. /// <param name="studentView"></param>
  117. /// <returns></returns>
  118. [HttpPost]
  119. public ActionResult CheckEdit(StudentView studentView)
  120. {
  121. try
  122. {
  123. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  124. Dictionary<string, object> studentViewDataList = new Dictionary<string, object>();
  125. foreach (var key in typeof(StudentView).GetProperties())
  126. {
  127. if (key.PropertyType.IsValueType || key.PropertyType.Name.StartsWith("String"))
  128. {
  129. studentViewDataList.Add(key.Name, key.GetValue(studentView, null));
  130. }
  131. }
  132. PersonalInfoServices.Value.StudentCheckEdit(studentViewDataList, user.UserID);
  133. return Json(new ReturnMessage()
  134. {
  135. IsSuccess = true,
  136. Message = "提交成功。"
  137. });
  138. }
  139. catch (Exception ex)
  140. {
  141. return Json(new ReturnMessage()
  142. {
  143. IsSuccess = false,
  144. Message = "提交失败,原因:" + ex.Message
  145. });
  146. }
  147. }
  148. /// <summary>
  149. /// 核对
  150. /// </summary>
  151. /// <returns></returns>
  152. [HttpPost]
  153. public ActionResult Proofread()
  154. {
  155. try
  156. {
  157. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  158. PersonalInfoServices.Value.StudentProofread(user.UserID);
  159. return Json(new ReturnMessage()
  160. {
  161. IsSuccess = true,
  162. Message = "核对成功。"
  163. });
  164. }
  165. catch (Exception ex)
  166. {
  167. return Json(new ReturnMessage()
  168. {
  169. IsSuccess = false,
  170. Message = "核对失败:" + ex.Message
  171. });
  172. }
  173. }
  174. /// <summary>
  175. /// 学籍报表(个性化配置)
  176. /// </summary>
  177. /// <returns></returns>
  178. public ActionResult CradReport()
  179. {
  180. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  181. ViewBag.LoginUserID = curUser.UserID.ToString();
  182. return View();
  183. }
  184. /// <summary>
  185. /// Excel导出
  186. /// </summary>
  187. /// <returns></returns>
  188. [HttpPost]
  189. public ActionResult Excel()
  190. {
  191. return null;
  192. }
  193. }
  194. }