ScoreConvertController_Lxl.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using EMIS.ViewModel;
  7. using EMIS.Web.Controls;
  8. using Bowin.Web.Controls.Mvc;
  9. using EMIS.CommonLogic.ScoreManage;
  10. using EMIS.ViewModel.ScoreManage;
  11. using Bowin.Common.Utility;
  12. using EMIS.Utility;
  13. using Bowin.Common.Data;
  14. using EMIS.Utility.FormValidate;
  15. namespace EMIS.Web.Controllers.ScoreManage
  16. {
  17. [Authorization]
  18. public partial class ScoreConvertController : Controller
  19. {
  20. //
  21. // GET: /ScoreConvertByApply/
  22. public IScoreConvertByApplyServices scoreConvertByApplyServices { get; set; }
  23. public ActionResult ByApplyList()
  24. {
  25. ViewBag.StartStatusID = scoreConvertByApplyServices.GetStartStatus();
  26. return View();
  27. }
  28. [HttpPost]
  29. public ActionResult ByApplyList(QueryParamsModel pararms)
  30. {
  31. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  32. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  33. var collegeID = pararms.getExtraGuid("cgbCollege");
  34. var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  35. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  36. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  37. var coursematerial = pararms.getExtraGuid("cbgCourse");
  38. var recordStatus = pararms.getExtraInt("ddlRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlRecordStatus");
  39. return base.Json(scoreConvertByApplyServices.GetScoreConvertByApplyViewGrid(configuretView, schoolyearID, collegeID, yearID,
  40. standardID, classmajorID, coursematerial, recordStatus, pararms.page, pararms.rows));
  41. }
  42. public ActionResult StudentByApplyList()
  43. {
  44. ViewBag.StartStatusID = scoreConvertByApplyServices.GetStartStatus();
  45. return View();
  46. }
  47. [HttpPost]
  48. public ActionResult StudentByApplyList(QueryParamsModel pararms)
  49. {
  50. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  51. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  52. var collegeID = pararms.getExtraGuid("cgbCollege");
  53. var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  54. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  55. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  56. var coursematerial = pararms.getExtraGuid("cbgCourse");
  57. var recordStatus = pararms.getExtraInt("ddlRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlRecordStatus");
  58. return base.Json(scoreConvertByApplyServices.GetScoreConvertByApplyViewGrid(configuretView, schoolyearID, collegeID, yearID,
  59. standardID, classmajorID, coursematerial, recordStatus, pararms.page, pararms.rows));
  60. }
  61. public ActionResult ByApplyEdit(Guid? scoreConvertByApplyID)
  62. {
  63. ScoreConvertByApplyView scoreConvertByApplyView = new ScoreConvertByApplyView();
  64. if (scoreConvertByApplyID.HasValue)
  65. {
  66. scoreConvertByApplyView = scoreConvertByApplyServices.GetScoreConvertByApplyView(scoreConvertByApplyID);
  67. }
  68. else {
  69. scoreConvertByApplyView.ScoreConvertByApplyID = Guid.NewGuid();
  70. }
  71. return View(scoreConvertByApplyView);
  72. }
  73. [HttpPost]
  74. public ActionResult ByApplyEdit(ScoreConvertByApplyView scoreConvertByApplyView)
  75. {
  76. try
  77. {
  78. var sessionName = FileUploadHelper.GetFileUploadSessionName(scoreConvertByApplyView.ScoreConvertByApplyID);
  79. var fileList = (List<FileUploadView>)Session[sessionName];
  80. scoreConvertByApplyServices.Save(scoreConvertByApplyView, fileList);
  81. return Json(new ReturnMessage()
  82. {
  83. IsSuccess = true,
  84. Message = "保存成功"
  85. });
  86. }
  87. catch (Exception ex)
  88. {
  89. return Json(new ReturnMessage()
  90. {
  91. IsSuccess = false,
  92. Message = "保存失败," + ex.Message
  93. });
  94. }
  95. }
  96. public ActionResult StudentByApplyEdit(Guid? scoreConvertByApplyID)
  97. {
  98. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  99. ScoreConvertByApplyView scoreConvertByApplyView = new ScoreConvertByApplyView();
  100. if (scoreConvertByApplyID.HasValue)
  101. {
  102. scoreConvertByApplyView = scoreConvertByApplyServices.GetScoreConvertByApplyView(scoreConvertByApplyID);
  103. }
  104. else
  105. {
  106. scoreConvertByApplyView.ScoreConvertByApplyID = Guid.NewGuid();
  107. scoreConvertByApplyView.UserID = curUser.UserID;
  108. }
  109. return View(scoreConvertByApplyView);
  110. }
  111. [HttpPost]
  112. public ActionResult StudentByApplyEdit(ScoreConvertByApplyView scoreConvertByApplyView)
  113. {
  114. try
  115. {
  116. var sessionName = FileUploadHelper.GetFileUploadSessionName(scoreConvertByApplyView.ScoreConvertByApplyID);
  117. var fileList = (List<FileUploadView>)Session[sessionName];
  118. scoreConvertByApplyServices.Save(scoreConvertByApplyView, fileList);
  119. return Json(new ReturnMessage()
  120. {
  121. IsSuccess = true,
  122. Message = "保存成功"
  123. });
  124. }
  125. catch (Exception ex)
  126. {
  127. return Json(new ReturnMessage()
  128. {
  129. IsSuccess = false,
  130. Message = "保存失败," + ex.Message
  131. });
  132. }
  133. }
  134. [HttpPost]
  135. public ActionResult ByApplySubmit(string scoreConvertByApplyIDs)
  136. {
  137. try
  138. {
  139. var scoreConvertByApplyIDList = scoreConvertByApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  140. scoreConvertByApplyServices.Submit(scoreConvertByApplyIDList, CustomPrincipal.Current.UserID);
  141. return base.Json(new ReturnMessage { IsSuccess = true, Message = "提交成功" });
  142. }
  143. catch (Exception ex)
  144. {
  145. return base.Json(new ReturnMessage { IsSuccess = false, Message = "提交失败," + ex.Message });
  146. }
  147. }
  148. [HttpPost]
  149. public ActionResult ByApplyApprove(string scoreConvertByApplyIDs, Guid actionID, string comment)
  150. {
  151. try
  152. {
  153. var scoreConvertByApplyIDList = scoreConvertByApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  154. scoreConvertByApplyServices.ScoreConvertByApplyApprove(scoreConvertByApplyIDList, CustomPrincipal.Current.UserID, actionID, comment);
  155. return base.Json(new ReturnMessage { IsSuccess = true, Message = "审核成功" });
  156. }
  157. catch (Exception ex)
  158. {
  159. return base.Json(new ReturnMessage { IsSuccess = false, Message = "审核失败," + ex.Message });
  160. }
  161. }
  162. [HttpPost]
  163. public ActionResult ByApplyExcel()
  164. {
  165. NpoiExcelHelper neh = new NpoiExcelHelper();
  166. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  167. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  168. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  169. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  170. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  171. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  172. var coursematerial = Request.Form["cbgCourse"].ParseStrTo<Guid>();
  173. var recordStatus = Request.Form["ddlRecordStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlRecordStatus"].ParseStrTo<int>();
  174. var scoreConvertByApplyIDString = Request.Form["SelectedID"];
  175. var scoreConvertByApplyIDList = scoreConvertByApplyIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  176. var dt = scoreConvertByApplyServices.GetScoreConvertByApplyViewList(configuretView, schoolyearID, collegeID, yearID,
  177. standardID, classmajorID, coursematerial, recordStatus, scoreConvertByApplyIDList)
  178. .Select(x => new
  179. {
  180. x.SchoolyearCode,
  181. x.CollegeName,
  182. x.StandardDesc,
  183. x.ClassmajorName,
  184. x.LoginID,
  185. x.Name,
  186. x.CourseCode,
  187. x.CourseName,
  188. x.TotalScore,
  189. //x.SchoolyearNumName,
  190. //x.SchoolcodeName,
  191. x.RecordStatusDesc
  192. }).ToTable();
  193. string[] liststring = {
  194. "学年学期", RSL.Get("College"), "专业", "班级", "学号", "姓名",
  195. "课程代码", "课程名称", "成绩", "状态"
  196. };
  197. neh.Export(dt, liststring, "申报认定列表" + DateTime.Now.ToString("yyyyMMdd"));
  198. return Json(new ReturnMessage()
  199. {
  200. IsSuccess = true,
  201. Message = "导出成功。"
  202. });
  203. }
  204. [HttpPost]
  205. public ActionResult StudentByApplyExcel()
  206. {
  207. NpoiExcelHelper neh = new NpoiExcelHelper();
  208. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  209. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  210. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  211. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  212. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  213. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  214. var coursematerial = Request.Form["cbgCourse"].ParseStrTo<Guid>();
  215. var recordStatus = Request.Form["ddlRecordStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlRecordStatus"].ParseStrTo<int>();
  216. var scoreConvertByApplyIDString = Request.Form["SelectedID"];
  217. var scoreConvertByApplyIDList = scoreConvertByApplyIDString.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  218. var dt = scoreConvertByApplyServices.GetScoreConvertByApplyViewList(configuretView, schoolyearID, collegeID, yearID,
  219. standardID, classmajorID, coursematerial, recordStatus, scoreConvertByApplyIDList)
  220. .Select(x => new
  221. {
  222. x.SchoolyearCode,
  223. x.CollegeName,
  224. x.StandardDesc,
  225. x.ClassmajorName,
  226. x.LoginID,
  227. x.Name,
  228. x.CourseCode,
  229. x.CourseName,
  230. x.TotalScore,
  231. x.SchoolyearNumName,
  232. x.SchoolcodeName,
  233. x.RecordStatusDesc
  234. }).ToTable();
  235. string[] liststring = {
  236. "学年学期", RSL.Get("College"), "专业", "班级", "学号", "姓名",
  237. "课程代码", "课程名称", "成绩", "开课学年", "开课学期", "状态"
  238. };
  239. neh.Export(dt, liststring, "申报认定列表" + DateTime.Now.ToString("yyyyMMdd"));
  240. return Json(new ReturnMessage()
  241. {
  242. IsSuccess = true,
  243. Message = "导出成功。"
  244. });
  245. }
  246. [HttpPost]
  247. public ActionResult ByApplyDelete(string scoreConvertByApplyIDs)
  248. {
  249. try
  250. {
  251. var scoreConvertByApplyIDList = scoreConvertByApplyIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  252. scoreConvertByApplyServices.Delete(scoreConvertByApplyIDList);
  253. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
  254. }
  255. catch (Exception ex)
  256. {
  257. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败," + ex.Message });
  258. }
  259. }
  260. [HttpGet]
  261. public ActionResult Attachment(Guid? scoreConvertByApplyID)
  262. {
  263. return View();
  264. }
  265. [HttpPost]
  266. public ActionResult Attachment(QueryParamsModel pararms)
  267. {
  268. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  269. var scoreConvertByApplyID = pararms.getExtraGuid("hidScoreConvertByApplyID");
  270. var attachment = scoreConvertByApplyServices.GetAttachment(scoreConvertByApplyID, pararms.page, pararms.rows);
  271. return Json(attachment);
  272. }
  273. [HttpGet]
  274. public ActionResult Upload(Guid? scoreConvertByApplyID)
  275. {
  276. ScoreConvertByApplyView scoreConvertByApplyView = new ScoreConvertByApplyView();
  277. scoreConvertByApplyView.ScoreConvertByApplyID = scoreConvertByApplyID.Value;
  278. return View(scoreConvertByApplyView);
  279. }
  280. [HttpPost]
  281. public ActionResult Upload()
  282. {
  283. return Json("上传成功");
  284. }
  285. [HttpPost]
  286. public ActionResult GetFileListByConvertID(Guid? scoreConvertByApplyID)
  287. {
  288. //var convertByApplyID = scoreConvertByApplyID.ParseStrTo<Guid>();
  289. var sessionName = FileUploadHelper.GetFileUploadSessionName(scoreConvertByApplyID ?? Guid.Empty);
  290. var fileList = (List<FileUploadView>)Session[sessionName];
  291. return Json(fileList);
  292. }
  293. }
  294. }