CollegeScheduleApprovalController.cs 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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.SchedulingManage.ScheduleApproval;
  7. using EMIS.ViewModel;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.CalendarManage;
  10. namespace EMIS.Web.Controllers.SchedulingManage.ScheduleApproval
  11. {
  12. [Authorization]
  13. public class CollegeScheduleApprovalController : Controller
  14. {
  15. public ICollegeScheduleApprovalServices collegeScheduleApprovalServices { get; set; }
  16. public ISchoolYearServices SchoolYearServices { get; set; }
  17. //
  18. // GET: /CollegeScheduleApproval/
  19. public ActionResult List()
  20. {
  21. var schoolYearView = SchoolYearServices.GetSchoolYearIsCurrent(true);
  22. var schoolyear = SchoolYearServices.GetSchoolYearViewListAfterCurrent().OrderBy(x => x.Code).Where(x => x.Value > schoolYearView.Value).FirstOrDefault();
  23. ViewBag.SchoolYearID = schoolyear.SchoolYearID;
  24. ViewBag.StartStatus = collegeScheduleApprovalServices.GetStartStatus();
  25. return View();
  26. }
  27. [HttpPost]
  28. public ActionResult List(QueryParamsModel pararms)
  29. {
  30. //ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  31. var SchoolyearID = pararms.getExtraGuid("SchoolyearDropdownList");
  32. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  33. var approvalStatus = pararms.getExtraInt("DictionaryApprovalStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryApprovalStatus");
  34. return base.Json(collegeScheduleApprovalServices.GetCollegeScheduleApprovalViewGrid(SchoolyearID, collegeID, approvalStatus, (int)pararms.page, (int)pararms.rows));
  35. }
  36. [HttpPost]
  37. public ActionResult Submit(string collegeScheduleStatusIDs, string collegeIDs, Guid schoolYearID)
  38. {
  39. try
  40. {
  41. List<Guid?> list = new List<Guid?>();
  42. for (int i = 0; i < collegeScheduleStatusIDs.Split(',').Length; i++)
  43. {
  44. string id = collegeScheduleStatusIDs.Split(',')[i];
  45. if (!string.IsNullOrEmpty(id))
  46. {
  47. list.Add(new Guid(id));
  48. }
  49. }
  50. List<Guid?> collegelist = new List<Guid?>();
  51. for (int i = 0; i < collegeIDs.Split(',').Length; i++)
  52. {
  53. string id = collegeIDs.Split(',')[i];
  54. if (!string.IsNullOrEmpty(id))
  55. {
  56. collegelist.Add(new Guid(id));
  57. }
  58. }
  59. collegeScheduleApprovalServices.Submit(list, collegelist, schoolYearID);
  60. return base.Json("提交成功");
  61. }
  62. catch (Exception ex)
  63. {
  64. string mge = ex.Message;
  65. return base.Json("提交失败,原因:" + mge);
  66. }
  67. }
  68. [HttpPost]
  69. public ActionResult Approve(string collegeScheduleStatusIDs)
  70. {
  71. try
  72. {
  73. List<Guid> list = new List<Guid>();
  74. for (int i = 0; i < collegeScheduleStatusIDs.Split(',').Length; i++)
  75. {
  76. string id = collegeScheduleStatusIDs.Split(',')[i];
  77. if (!string.IsNullOrEmpty(id))
  78. {
  79. list.Add(new Guid(id));
  80. }
  81. }
  82. collegeScheduleApprovalServices.Approve(list);
  83. return base.Json("审核成功");
  84. }
  85. catch (Exception ex)
  86. {
  87. string mge = ex.Message;
  88. return base.Json("审核失败,原因:" + mge);
  89. }
  90. }
  91. [HttpPost]
  92. public ActionResult ReturnBack(string collegeScheduleStatusIDs)
  93. {
  94. try
  95. {
  96. List<Guid> list = new List<Guid>();
  97. for (int i = 0; i < collegeScheduleStatusIDs.Split(',').Length; i++)
  98. {
  99. string id = collegeScheduleStatusIDs.Split(',')[i];
  100. if (!string.IsNullOrEmpty(id))
  101. {
  102. list.Add(new Guid(id));
  103. }
  104. }
  105. collegeScheduleApprovalServices.ReturnBack(list);
  106. return base.Json("撤回成功");
  107. }
  108. catch (Exception ex)
  109. {
  110. string mge = ex.Message;
  111. return base.Json("撤回失败,原因:" + mge);
  112. }
  113. }
  114. //
  115. // GET: /CollegeScheduleApproval/Details/5
  116. public ActionResult Details(int id)
  117. {
  118. return View();
  119. }
  120. //
  121. // GET: /CollegeScheduleApproval/Create
  122. public ActionResult Create()
  123. {
  124. return View();
  125. }
  126. //
  127. // POST: /CollegeScheduleApproval/Create
  128. [HttpPost]
  129. public ActionResult Create(FormCollection collection)
  130. {
  131. try
  132. {
  133. // TODO: Add insert logic here
  134. return RedirectToAction("Index");
  135. }
  136. catch
  137. {
  138. return View();
  139. }
  140. }
  141. //
  142. // GET: /CollegeScheduleApproval/Edit/5
  143. public ActionResult Edit(int id)
  144. {
  145. return View();
  146. }
  147. //
  148. // POST: /CollegeScheduleApproval/Edit/5
  149. [HttpPost]
  150. public ActionResult Edit(int id, FormCollection collection)
  151. {
  152. try
  153. {
  154. // TODO: Add update logic here
  155. return RedirectToAction("Index");
  156. }
  157. catch
  158. {
  159. return View();
  160. }
  161. }
  162. //
  163. // GET: /CollegeScheduleApproval/Delete/5
  164. public ActionResult Delete(int id)
  165. {
  166. return View();
  167. }
  168. //
  169. // POST: /CollegeScheduleApproval/Delete/5
  170. [HttpPost]
  171. public ActionResult Delete(int id, FormCollection collection)
  172. {
  173. try
  174. {
  175. // TODO: Add delete logic here
  176. return RedirectToAction("Index");
  177. }
  178. catch
  179. {
  180. return View();
  181. }
  182. }
  183. [HttpPost]
  184. public ActionResult GetStatusList(DropdownListBindType? bindType)
  185. {
  186. List<DropdownListItem> list = this.collegeScheduleApprovalServices.GetStatusViewList()
  187. .Select(x => new DropdownListItem { Text = x.Name, Value = x.ID }).ToList();
  188. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  189. DropdownList.FormatDropdownItemList(dbt, list);
  190. return base.Json(list);
  191. }
  192. }
  193. }