EvaluationGradeControlController.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Bowin.Common.Utility;
  7. using Bowin.Common.Data;
  8. using Bowin.Common.Linq;
  9. using Bowin.Common.JSON;
  10. using Bowin.Web.Controls.Mvc;
  11. using EMIS.Utility;
  12. using EMIS.Web.Controls;
  13. using EMIS.ViewModel;
  14. using EMIS.ViewModel.EvaluationManage.EvaluationSetting;
  15. using EMIS.CommonLogic.EvaluationManage.EvaluationSetting;
  16. namespace EMIS.Web.Controllers.EvaluationManage.EvaluationSetting
  17. {
  18. [Authorization]
  19. public class EvaluationGradeControlController : Controller
  20. {
  21. public Lazy<IEvaluationGradeControlServices> EvaluationGradeControlServices { get; set; }
  22. /// <summary>
  23. /// 评价控制(年级专业)页面
  24. /// </summary>
  25. /// <returns></returns>
  26. public ActionResult List()
  27. {
  28. return View();
  29. }
  30. /// <summary>
  31. /// 评价控制(年级专业)列表查询
  32. /// </summary>
  33. /// <param name="pararms"></param>
  34. /// <returns></returns>
  35. [HttpPost]
  36. public ActionResult List(QueryParamsModel pararms)
  37. {
  38. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  39. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  40. var campusID = pararms.getExtraGuid("CampusDropdown");
  41. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  42. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  43. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  44. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  45. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  46. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  47. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  48. var semesterID = pararms.getExtraInt("DictionarySemester") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionarySemester");
  49. var dateRange = pararms.getExtraDateTime("txtDateRange");
  50. return base.Json(EvaluationGradeControlServices.Value.GetEvaluationGradeControlViewGrid(configuretView, schoolyearID, campusID, collegeID, gradeID,
  51. standardID, educationID, learningformID, learnSystem, semesterID, dateRange, inSchoolStatus, (int)pararms.page, (int)pararms.rows));
  52. }
  53. /// <summary>
  54. /// 复制新增
  55. /// </summary>
  56. /// <param name="evaluationGradeControlID"></param>
  57. /// <returns></returns>
  58. public ActionResult CopyAdd(Guid evaluationGradeControlID)
  59. {
  60. var evaluationGradeControlView = new EvaluationGradeControlView();
  61. evaluationGradeControlView = EvaluationGradeControlServices.Value.GetEvaluationGradeControlView(evaluationGradeControlID);
  62. return View("Edit", evaluationGradeControlView);
  63. }
  64. /// <summary>
  65. /// 复制新增
  66. /// </summary>
  67. /// <param name="evaluationGradeControlView"></param>
  68. /// <returns></returns>
  69. [HttpPost]
  70. public ActionResult CopyAdd(EvaluationGradeControlView evaluationGradeControlView)
  71. {
  72. evaluationGradeControlView.EvaluationGradeControlID = Guid.Empty;
  73. return this.Edit(evaluationGradeControlView);
  74. }
  75. /// <summary>
  76. /// 编辑
  77. /// </summary>
  78. /// <param name="evaluationGradeControlID"></param>
  79. /// <returns></returns>
  80. [HttpGet]
  81. public ActionResult Edit(Guid? evaluationGradeControlID)
  82. {
  83. var evaluationGradeControlView = new EvaluationGradeControlView();
  84. if (evaluationGradeControlID.HasValue && evaluationGradeControlID != Guid.Empty)
  85. {
  86. evaluationGradeControlView = EvaluationGradeControlServices.Value.GetEvaluationGradeControlView(evaluationGradeControlID);
  87. }
  88. else
  89. {
  90. evaluationGradeControlView.StartTime = DateTime.Now;
  91. evaluationGradeControlView.EndTime = DateTime.Now.AddMonths(1);
  92. }
  93. return View(evaluationGradeControlView);
  94. }
  95. /// <summary>
  96. /// 编辑
  97. /// </summary>
  98. /// <param name="evaluationGradeControlView"></param>
  99. /// <returns></returns>
  100. [HttpPost]
  101. public ActionResult Edit(EvaluationGradeControlView evaluationGradeControlView)
  102. {
  103. try
  104. {
  105. EvaluationGradeControlServices.Value.EvaluationGradeControlEdit(evaluationGradeControlView);
  106. return Json(new ReturnMessage()
  107. {
  108. IsSuccess = true,
  109. Message = "保存成功。"
  110. });
  111. }
  112. catch (Exception ex)
  113. {
  114. return Json(new ReturnMessage()
  115. {
  116. IsSuccess = false,
  117. Message = "保存失败,原因:" + ex.Message
  118. });
  119. }
  120. }
  121. /// <summary>
  122. /// 评价控制(年级专业)信息批量新增
  123. /// </summary>
  124. /// <returns></returns>
  125. [HttpGet]
  126. public ActionResult EvaluationGradeControlBatchAdd()
  127. {
  128. EvaluationGradeControlView evaluationGradeControlView = new EvaluationGradeControlView();
  129. evaluationGradeControlView.StartTime = DateTime.Now;
  130. evaluationGradeControlView.EndTime = DateTime.Now.AddMonths(1);
  131. return View(evaluationGradeControlView);
  132. }
  133. /// <summary>
  134. /// 评价控制(年级专业)信息批量新增
  135. /// </summary>
  136. /// <param name="evaluationGradeControlView"></param>
  137. /// <returns></returns>
  138. public ActionResult EvaluationGradeControlBatchAdd(EvaluationGradeControlView evaluationGradeControlView)
  139. {
  140. try
  141. {
  142. var grademajorIDList = Request["grademajorIDList"].JsonToObject<List<Guid?>>();
  143. string result = EvaluationGradeControlServices.Value.EvaluationGradeControlBatchAdd(grademajorIDList, evaluationGradeControlView);
  144. return Json(new ReturnMessage()
  145. {
  146. IsSuccess = true,
  147. Message = "新增成功" + result + "。"
  148. });
  149. }
  150. catch (Exception ex)
  151. {
  152. return Json(new ReturnMessage()
  153. {
  154. IsSuccess = false,
  155. Message = "新增失败,原因:" + ex.Message
  156. });
  157. }
  158. }
  159. /// <summary>
  160. /// 查询对应的未新增年级专业信息GrademajorView
  161. /// </summary>
  162. /// <param name="pararms"></param>
  163. /// <returns></returns>
  164. [HttpPost]
  165. public ActionResult GrademajorNoAddList(QueryParamsModel pararms)
  166. {
  167. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  168. var campusID = pararms.getExtraGuid("CampusDropdown");
  169. var collegeID = pararms.getExtraGuid("CollegeDropdown");
  170. var gradeID = pararms.getExtraInt("DictionaryGrade") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryGrade");
  171. var standardID = pararms.getExtraInt("DictionaryStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryStandard");
  172. var educationID = pararms.getExtraInt("DictionaryEducation") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryEducation");
  173. var learningformID = pararms.getExtraInt("DictionaryLearningform") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryLearningform");
  174. var learnSystem = pararms.getExtraString("DictionaryLearnSystem");
  175. var inSchoolStatus = pararms.getExtraInt("DictionaryInschoolStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DictionaryInschoolStatus");
  176. var schoolyearID = pararms.getExtraGuid("SchoolyearID");
  177. return base.Json(EvaluationGradeControlServices.Value.GetGrademajorViewNoAddGrid(configuretView, campusID, collegeID, gradeID, standardID,
  178. educationID, learningformID, learnSystem, inSchoolStatus, schoolyearID, (int)pararms.page, (int)pararms.rows));
  179. }
  180. /// <summary>
  181. /// 查询对应的未新增年级专业信息Excel导出
  182. /// </summary>
  183. /// <returns></returns>
  184. [HttpPost]
  185. public ActionResult GrademajorNoAddListExcel()
  186. {
  187. return null;
  188. }
  189. /// <summary>
  190. /// 删除
  191. /// </summary>
  192. /// <param name="evaluationGradeControlIDs"></param>
  193. /// <returns></returns>
  194. [HttpPost]
  195. public ActionResult Delete(string evaluationGradeControlIDs)
  196. {
  197. try
  198. {
  199. List<Guid?> list = evaluationGradeControlIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  200. EvaluationGradeControlServices.Value.EvaluationGradeControlDelete(list);
  201. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功。" });
  202. }
  203. catch (Exception ex)
  204. {
  205. return base.Json(new ReturnMessage() { IsSuccess = false, Message = "删除失败,原因:" + ex.Message });
  206. }
  207. }
  208. /// <summary>
  209. /// Excel导出
  210. /// </summary>
  211. /// <returns></returns>
  212. [HttpPost]
  213. public ActionResult Excel()
  214. {
  215. try
  216. {
  217. NpoiExcelHelper neh = new NpoiExcelHelper();
  218. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  219. var schoolyearID = Request.Form["SchoolyearDropdown"] == DropdownList.SELECT_ALL.ToString() ? null : Request.Form["SchoolyearDropdown"].ParseStrTo<Guid>();
  220. var campusID = Request.Form["CampusDropdown"].ParseStrTo<Guid>();
  221. var collegeID = Request.Form["CollegeDropdown"].ParseStrTo<Guid>();
  222. var gradeID = Request.Form["DictionaryGrade"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryGrade"].ParseStrTo<int>();
  223. var standardID = Request.Form["DictionaryStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryStandard"].ParseStrTo<int>();
  224. var educationID = Request.Form["DictionaryEducation"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryEducation"].ParseStrTo<int>();
  225. var learningformID = Request.Form["DictionaryLearningform"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryLearningform"].ParseStrTo<int>();
  226. var learnSystem = Request.Form["DictionaryLearnSystem"].ToString();
  227. var inSchoolStatus = Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionaryInschoolStatus"].ParseStrTo<int>();
  228. var semesterID = Request.Form["DictionarySemester"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["DictionarySemester"].ParseStrTo<int>();
  229. var dateRange = Request.Form["txtDateRange"].ParseStrTo<DateTime>();
  230. var dt = EvaluationGradeControlServices.Value.GetEvaluationGradeControlViewList(configuretView, schoolyearID, campusID, collegeID, gradeID,
  231. standardID, educationID, learningformID, learnSystem, semesterID, dateRange, inSchoolStatus)
  232. .Select(x => new
  233. {
  234. x.SchoolyearCode,
  235. x.GrademajorCode,
  236. x.GrademajorName,
  237. x.FacultymajorNo,
  238. x.FacultymajorName,
  239. x.CollegeNo,
  240. x.CollegeName,
  241. x.CampusNo,
  242. x.CampusName,
  243. x.GradeID,
  244. x.SemesterName,
  245. x.StandardCode,
  246. x.StandardID,
  247. x.StandardName,
  248. x.EducationName,
  249. x.LearningformName,
  250. LearnSystem = x.LearnSystem.HasValue ? x.LearnSystem.Value.ToString("#.#") : null,
  251. x.StartSchoolyearCode,
  252. x.GraduateSchoolyearCode,
  253. x.Number,
  254. StartTime = x.StartTime == null ? null : x.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
  255. EndTime = x.EndTime == null ? null : x.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss"),
  256. x.ClassmajorCount,
  257. x.StudentCount,
  258. x.CreateUserName,
  259. x.ModifyUserName,
  260. ModifyTime = x.ModifyTime == null ? null : x.ModifyTime.Value.ToString("yyyy-MM-dd HH:mm:ss")
  261. }).ToTable();
  262. string[] liststring = {
  263. "学年学期", "年级专业编号", "年级专业名称", "院系专业编号", "院系专业名称", RSL.Get("CollegeCode"), RSL.Get("College"),
  264. RSL.Get("CampusCode"), RSL.Get("CampusName"), "年级", "入学学期", "专业代码", "专业ID(Value)", "专业名称", RSL.Get("EducationID"),
  265. "学习形式", "学制", "入学学年学期", "毕业学期", "可评次数", "开始时间", "结束时间", "班级数", "学生数", "创建人", "修改人", "修改时间"
  266. };
  267. var title = "年级控制信息";
  268. if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.No)
  269. {
  270. title = "年级控制信息(非在校)";
  271. }
  272. if (inSchoolStatus == (int)CF_INOrOutSchoolStatus.Yes)
  273. {
  274. title = "年级控制信息(在校)";
  275. }
  276. neh.Export(dt, liststring, title + DateTime.Now.ToString("yyyyMMdd"));
  277. return Json(new ReturnMessage()
  278. {
  279. IsSuccess = true,
  280. Message = "导出成功。"
  281. });
  282. }
  283. catch (Exception ex)
  284. {
  285. return Json(new ReturnMessage()
  286. {
  287. IsSuccess = false,
  288. Message = "导出失败,原因:" + ex.Message
  289. });
  290. }
  291. }
  292. }
  293. }