SOCDetailScoreController.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  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.DQPSystem;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Web.Controls.Mvc;
  10. using EMIS.ViewModel.DQPSystem;
  11. using Bowin.Common.Utility;
  12. using Bowin.Common.Data;
  13. using Bowin.Common.JSON;
  14. using EMIS.Utility;
  15. using EMIS.Utility.FormValidate;
  16. using EMIS.CommonLogic.SystemServices;
  17. using EMIS.ViewModel.SystemView;
  18. namespace EMIS.Web.Controllers.DQPSystem
  19. {
  20. [Authorization]
  21. public class SOCDetailScoreController : Controller
  22. {
  23. public ISOCDetailScoreServices SOCDetialScoreServices { get; set; }
  24. public ISOCDetailServices SOCDetailServices { get; set; }
  25. public IParameterServices ParameterServices { get; set; }
  26. public ISOCServices SOCServices { get; set; }
  27. /// <summary>
  28. /// 评分管理页面(最初的,直接显示每个学生课程soc,可以直接评分的页面)
  29. /// </summary>
  30. /// <returns></returns>
  31. public ActionResult List()
  32. {
  33. ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
  34. ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
  35. return View();
  36. }
  37. [HttpGet]
  38. public ActionResult SOCList()
  39. {
  40. return View();
  41. }
  42. [HttpPost]
  43. public ActionResult SOCList(QueryParamsModel pararms)
  44. {
  45. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  46. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  47. var user = CustomPrincipal.Current;
  48. //var coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
  49. //var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  50. //var educationMissionID = pararms.getExtraGuid("EducationMissionGrid");
  51. var result = SOCServices.GetSOCViewByTeacherIDGrid(configuretView, schoolyearID, user.UserID, (int)pararms.page, (int)pararms.rows);
  52. return Json(result);
  53. }
  54. public ActionResult SOCDetailList(Guid? socID)
  55. {
  56. ViewBag.SOCID = socID;
  57. return View();
  58. }
  59. [HttpPost]
  60. public ActionResult SOCDetailList(QueryParamsModel pararms, Guid? socID)
  61. {
  62. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  63. var schoolyearID = pararms.getExtraGuid("SchoolyearDropdown");
  64. var user = CustomPrincipal.Current;
  65. //var socID = pararms.getExtraGuid("SOCID");
  66. //var coursematerialID = pararms.getExtraGuid("CoursematerialIDDropdownGridBo");
  67. //var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  68. //var educationMissionID = pararms.getExtraGuid("EducationMissionGrid");
  69. var result = SOCDetailServices.GetSOCDetailViewByIDGrid(configuretView, schoolyearID, socID, user.UserID, (int)pararms.page, (int)pararms.rows);
  70. return Json(result);
  71. }
  72. public ActionResult StudentDetail(Guid? socDetailID)
  73. {
  74. ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
  75. ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
  76. ViewBag.SOCDetailID = socDetailID;
  77. return View();
  78. }
  79. [HttpPost]
  80. public ActionResult StudentDetail(QueryParamsModel pararms, Guid? SOCDetailID)
  81. {
  82. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  83. var user = CustomPrincipal.Current;
  84. return base.Json(SOCDetialScoreServices.GetSOCDetailStudentScoreViewByIDList(configuretView, SOCDetailID, user.UserID, (int)pararms.page, (int)pararms.rows));
  85. }
  86. public ActionResult GroupScoreList(Guid? socDetailID)
  87. {
  88. ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
  89. ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
  90. ViewBag.SOCDetailID = socDetailID;
  91. return View();
  92. }
  93. [HttpPost]
  94. public ActionResult GroupScoreList(QueryParamsModel pararms, Guid? SOCDetailID)
  95. {
  96. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  97. var user = CustomPrincipal.Current;
  98. return base.Json(SOCDetialScoreServices.GetSOCDetailGroupScoreViewByIDList(configuretView, SOCDetailID, user.UserID, (int)pararms.page, (int)pararms.rows));
  99. }
  100. public ActionResult AttachmentList(Guid? detailID, Guid? userID)
  101. {
  102. return View();
  103. }
  104. public ActionResult GroupList()
  105. {
  106. ViewBag.StartStatusID = (int)DQP_SOCDetailSubmitStatus.NotSubmit;
  107. ViewBag.CancelStatusID = (int)DQP_SOCDetailSubmitStatus.Canceled;
  108. return View();
  109. }
  110. public ActionResult GroupScore(Guid? socDetailGroupID)
  111. {
  112. return View();
  113. }
  114. public ActionResult GroupAttachmentList(Guid? detailID, Guid? socDetailGroupID)
  115. {
  116. return View();
  117. }
  118. public ActionResult GroupStudentList(Guid socDetailGroupID)
  119. {
  120. return View();
  121. }
  122. public ActionResult RawScoreList()
  123. {
  124. return View();
  125. }
  126. [HttpPost]
  127. public ActionResult StudentList(QueryParamsModel pararms)
  128. {
  129. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  130. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  131. var collegeID = pararms.getExtraGuid("cgbCollege");
  132. var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  133. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  134. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  135. var coursematerialID = pararms.getExtraGuid("cgbCourse");
  136. var recordStatus = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
  137. return base.Json(SOCDetialScoreServices.GetSOCDetailStudentScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
  138. coursematerialID, recordStatus, (int)pararms.page, (int)pararms.rows));
  139. }
  140. [HttpPost]
  141. public ActionResult AttachmentList(QueryParamsModel pararms)
  142. {
  143. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  144. var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
  145. var userID = pararms.getExtraGuid("hidUserID");
  146. return base.Json(SOCDetialScoreServices.GetSOCDetailStudentAttachmentViewList(configuretView, socDetailID, userID, (int)pararms.page, (int)pararms.rows));
  147. }
  148. [HttpPost]
  149. public ActionResult StudentSave()
  150. {
  151. var studentScoreViewList = DataGrid.GetTableData<SOCDetailStudentScoreView>("dgSOCDetailStudentScoreList");
  152. try
  153. {
  154. SOCDetialScoreServices.StudentSave(studentScoreViewList);
  155. return Json(new ReturnMessage()
  156. {
  157. IsSuccess = true,
  158. Message = "保存成功。"
  159. });
  160. }
  161. catch (Exception ex)
  162. {
  163. return Json(new ReturnMessage()
  164. {
  165. IsSuccess = false,
  166. Message = "保存失败:" + ex.Message
  167. });
  168. }
  169. }
  170. [HttpGet]
  171. public ActionResult StudentCancel(string socDetailStudentIDs)
  172. {
  173. ViewBag.DetailStudentList = socDetailStudentIDs;
  174. return View();
  175. }
  176. [HttpPost]
  177. public ActionResult StudentCancel()
  178. {
  179. //string socDetailStudentIDs = "";
  180. var socDetailStudentIDs = Request.Form["idList"];
  181. var remark = Request.Form["Remark"];
  182. var socDetailStudentIDList = socDetailStudentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  183. try
  184. {
  185. SOCDetialScoreServices.StudentCancel(socDetailStudentIDList, remark);
  186. return Json(new ReturnMessage()
  187. {
  188. IsSuccess = true,
  189. Message = "退回成功。"
  190. });
  191. }
  192. catch (Exception ex)
  193. {
  194. return Json(new ReturnMessage()
  195. {
  196. IsSuccess = false,
  197. Message = "退回失败:" + ex.Message
  198. });
  199. }
  200. }
  201. [HttpPost]
  202. public ActionResult StudentExcel()
  203. {
  204. NpoiExcelHelper neh = new NpoiExcelHelper();
  205. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  206. var user = CustomPrincipal.Current;
  207. var socDetailID = Request.Form["SOCDetailID"].ParseStrTo<Guid>();
  208. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  209. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  210. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  211. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  212. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  213. var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
  214. var recordStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
  215. var dt = SOCDetialScoreServices.GetSOCDetailStudentScoreViewList(configuretView, socDetailID, user.UserID)
  216. .Select(x => new
  217. {
  218. x.SchoolyearCode,
  219. x.EducationMissionNameStr,
  220. x.CourseCode,
  221. x.CourseName,
  222. x.Name,
  223. x.LoginID,
  224. x.SOCDetailName,
  225. //SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.##") : null,
  226. x.SOCDetailCredit,
  227. Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.##") : null,
  228. Score = x.Score.HasValue ? x.Score.Value.ToString("#.##") : null
  229. }).ToTable();
  230. string[] liststring = {
  231. "学年学期", "任务班名", "课程代码", "课程名称", "姓名", "学号",
  232. "成果名称", "成果学分", "成果权重", "成果得分"
  233. };
  234. neh.Export(dt, liststring, "学生成果评分表" + DateTime.Now.ToString("yyyyMMdd"));
  235. return Json(new ReturnMessage()
  236. {
  237. IsSuccess = true,
  238. Message = "导出成功。"
  239. });
  240. }
  241. [HttpPost]
  242. public ActionResult GroupList(QueryParamsModel pararms)
  243. {
  244. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  245. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  246. var collegeID = pararms.getExtraGuid("cgbCollege");
  247. var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  248. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  249. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  250. var coursematerialID = pararms.getExtraGuid("cgbCourse");
  251. var recordStatus = pararms.getExtraInt("ddlStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlStatus");
  252. return base.Json(SOCDetialScoreServices.GetSOCDetailGroupScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
  253. coursematerialID, recordStatus, (int)pararms.page, (int)pararms.rows));
  254. }
  255. [HttpPost]
  256. public ActionResult GroupScore(QueryParamsModel pararms)
  257. {
  258. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  259. var socDetailGroupID = Request.QueryString["SOCDetailGroupID"].ParseStrTo<Guid>();
  260. return base.Json(SOCDetialScoreServices.GetSOCDetailGroupRawScoreViewList(configuretView, socDetailGroupID.Value, pararms.page, pararms.rows));
  261. }
  262. [HttpPost]
  263. public ActionResult GroupScoreSave(Guid socDetailGroupID)
  264. {
  265. var studentRawScoreList = DataGrid.GetTableData<SOCDetailRawScoreView>("dgStudentScoreList");
  266. try
  267. {
  268. SOCDetialScoreServices.GroupScoreSave(socDetailGroupID, studentRawScoreList);
  269. return Json(new ReturnMessage()
  270. {
  271. IsSuccess = true,
  272. Message = "保存成功。"
  273. });
  274. }
  275. catch (Exception ex)
  276. {
  277. return Json(new ReturnMessage()
  278. {
  279. IsSuccess = false,
  280. Message = "保存失败:" + ex.Message
  281. });
  282. }
  283. }
  284. [HttpPost]
  285. public ActionResult GroupAttachmentList(QueryParamsModel pararms)
  286. {
  287. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  288. var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
  289. var socDetailGroupID = pararms.getExtraGuid("hidSOCDetailGroupID");
  290. return base.Json(SOCDetialScoreServices.GetSOCDetailGroupAttachmentViewList(configuretView, socDetailID, socDetailGroupID, (int)pararms.page, (int)pararms.rows));
  291. }
  292. [Obsolete]
  293. [HttpPost]
  294. public ActionResult GroupSave()
  295. {
  296. var groupScoreViewList = DataGrid.GetTableData<SOCDetailGroupScoreView>("dgSOCDetailGroupScoreList");
  297. try
  298. {
  299. SOCDetialScoreServices.GroupSave(groupScoreViewList);
  300. return Json(new ReturnMessage()
  301. {
  302. IsSuccess = true,
  303. Message = "保存成功。"
  304. });
  305. }
  306. catch (Exception ex)
  307. {
  308. return Json(new ReturnMessage()
  309. {
  310. IsSuccess = false,
  311. Message = "保存失败:" + ex.Message
  312. });
  313. }
  314. }
  315. [HttpGet]
  316. public ActionResult GroupCancel(string socDetailGroupIDs)
  317. {
  318. ViewBag.DetailGroupList = socDetailGroupIDs;
  319. return View();
  320. }
  321. [HttpPost]
  322. public ActionResult GroupCancel()
  323. {
  324. var socDetailGroupIDs = Request.Form["idList"];
  325. var remark = Request.Form["Remark"];
  326. var socDetailGroupIDList = socDetailGroupIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  327. try
  328. {
  329. SOCDetialScoreServices.GroupCancel(socDetailGroupIDList, remark);
  330. return Json(new ReturnMessage()
  331. {
  332. IsSuccess = true,
  333. Message = "退回成功。"
  334. });
  335. }
  336. catch (Exception ex)
  337. {
  338. return Json(new ReturnMessage()
  339. {
  340. IsSuccess = false,
  341. Message = "退回失败:" + ex.Message
  342. });
  343. }
  344. }
  345. [HttpPost]
  346. public ActionResult GroupExcel()
  347. {
  348. NpoiExcelHelper neh = new NpoiExcelHelper();
  349. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  350. var user = CustomPrincipal.Current;
  351. var socDetailID = Request.Form["SOCDetailID"].ParseStrTo<Guid>();
  352. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  353. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  354. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  355. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  356. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  357. var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
  358. var recordStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
  359. var dt = SOCDetialScoreServices.GetSOCDetailGroupScoreViewByIDList(configuretView, socDetailID, user.UserID)
  360. .Select(x => new
  361. {
  362. x.SchoolyearCode,
  363. x.CourseCode,
  364. x.CourseName,
  365. x.SOCDetailName,
  366. //SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.#") : null,
  367. x.SOCDetailCredit,
  368. Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.#") : null,
  369. x.ClassmajorName,
  370. x.Name,
  371. Score = x.Score.HasValue ? x.Score.Value.ToString("#.#") : null
  372. }).ToTable();
  373. string[] liststring = {
  374. "学年学期", "课程代码", "课程名称", "成果名称", "成果学分", "成果权重",
  375. "所在班级", "组名", "成果得分"
  376. };
  377. neh.Export(dt, liststring, "学生分组成果评分表" + DateTime.Now.ToString("yyyyMMdd"));
  378. return Json(new ReturnMessage()
  379. {
  380. IsSuccess = true,
  381. Message = "导出成功。"
  382. });
  383. }
  384. [HttpPost]
  385. public ActionResult RawList(QueryParamsModel pararms)
  386. {
  387. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  388. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  389. var collegeID = pararms.getExtraGuid("cgbCollege");
  390. var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  391. var standardID = pararms.getExtraInt("cbgStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cbgStandard");
  392. var classmajorID = pararms.getExtraGuid("cbgClassmajor");
  393. var coursematerialID = pararms.getExtraGuid("cgbCourse");
  394. return base.Json(SOCDetialScoreServices.GetSOCDetailRawScoreViewList(configuretView, schoolyearID, collegeID, yearID, standardID, classmajorID,
  395. coursematerialID, (int)pararms.page, (int)pararms.rows));
  396. }
  397. [HttpPost]
  398. public ActionResult RawExcel()
  399. {
  400. NpoiExcelHelper neh = new NpoiExcelHelper();
  401. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  402. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  403. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  404. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  405. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  406. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  407. var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
  408. var dt = SOCDetialScoreServices.GetSOCDetailRawScoreViewList(configuretView, schoolyearID, collegeID, yearID,
  409. standardID, classmajorID, coursematerialID)
  410. .Select(x => new
  411. {
  412. x.SchoolyearCode,
  413. x.CourseCode,
  414. x.CourseName,
  415. TotalCredit = x.TotalCredit.HasValue ? x.TotalCredit.Value.ToString("#.#") : null,
  416. x.Gradeyear,
  417. x.StandardDesc,
  418. x.ClassmajorName,
  419. x.LoginID,
  420. x.Name,
  421. x.SOCDetailName,
  422. SOCDetailCredit = x.SOCDetailCredit.HasValue ? x.SOCDetailCredit.Value.ToString("#.#") : null,
  423. Weight = x.Weight.HasValue ? x.Weight.Value.ToString("#.#") : null,
  424. Score = x.Score.HasValue ? x.Score.Value.ToString("#.#") : null,
  425. ActualScore = x.ActualScore.HasValue ? x.ActualScore.Value.ToString("#.#") : null
  426. }).ToTable();
  427. string[] liststring = {
  428. "学年学期", "课程代码", "课程名称", "课程学分", "年级", "专业",
  429. "班级", "学号", "姓名", "成果名称", "成果学分", "成果权重", "成果得分", "实际得分"
  430. };
  431. neh.Export(dt, liststring, "学生SOC原始成绩表" + DateTime.Now.ToString("yyyyMMdd"));
  432. return Json(new ReturnMessage()
  433. {
  434. IsSuccess = true,
  435. Message = "导出成功。"
  436. });
  437. }
  438. [HttpPost]
  439. public ActionResult StudentSubmit(string socDetailSubmitViews)
  440. {
  441. var userID = CustomPrincipal.Current.UserID;
  442. try
  443. {
  444. var socDetailSubmitViewList = socDetailSubmitViews.JsonToObject<List<SOCDetailStudentKeyView>>();
  445. this.SOCDetialScoreServices.StudentSubmit(userID, socDetailSubmitViewList);
  446. return Json(new ReturnMessage()
  447. {
  448. IsSuccess = true,
  449. Message = "提交成功。"
  450. });
  451. }
  452. catch (Exception ex)
  453. {
  454. return Json(new ReturnMessage()
  455. {
  456. IsSuccess = false,
  457. Message = "提交失败:" + ex.Message
  458. });
  459. }
  460. }
  461. public ActionResult StudentAttachmentList(Guid? socDetailID, Guid? socDetailGroupID)
  462. {
  463. var userID = CustomPrincipal.Current.UserID;
  464. var socDetailStudentKeyView = new SOCDetailStudentKeyView { SOCDetailID = socDetailID, SOCDetailGroupID = socDetailGroupID };
  465. ViewBag.IsStudentCanUpload = this.SOCDetialScoreServices.IsStudentCanUpload(userID, socDetailStudentKeyView);
  466. return View(socDetailStudentKeyView);
  467. }
  468. [HttpPost]
  469. public ActionResult StudentAttachmentList(SOCDetailStudentKeyView socDetailStudentKeyView)
  470. {
  471. var userID = CustomPrincipal.Current.UserID;
  472. try
  473. {
  474. var sessionName = FileUploadHelper.GetFileUploadSessionName((socDetailStudentKeyView.SOCDetailGroupID ?? socDetailStudentKeyView.SOCDetailID) ?? Guid.Empty);
  475. var fileList = (List<FileUploadView>)Session[sessionName];
  476. this.SOCDetialScoreServices.SaveFile(userID, socDetailStudentKeyView, fileList);
  477. return Json(new ReturnMessage()
  478. {
  479. IsSuccess = true,
  480. Message = "保存成功。"
  481. });
  482. }
  483. catch (Exception ex)
  484. {
  485. return Json(new ReturnMessage()
  486. {
  487. IsSuccess = false,
  488. Message = "保存失败:" + ex.Message
  489. });
  490. }
  491. }
  492. public ActionResult StudentScoreList()
  493. {
  494. ViewBag.ScoreDigitCount = ParameterServices.GetParameterValue<int>(CF_ParameterType.ScoreDigitCount) ?? 1;
  495. return View();
  496. }
  497. [HttpPost]
  498. public ActionResult StudentCoursematerialList()
  499. {
  500. var userID = CustomPrincipal.Current.UserID;
  501. List<SOCStudentScoreTotalView> socStudentScoreTotalViewList = new List<SOCStudentScoreTotalView>();
  502. //课程成绩
  503. var socStudentScoreItemViewList = this.SOCDetialScoreServices.GetStudentScoreItemViewList(userID);
  504. if (socStudentScoreItemViewList.Count > 0)
  505. {
  506. SOCStudentScoreTotalView socStudentScoreTotalView = this.SOCDetialScoreServices.GetStudentScoreTotalView(userID);
  507. if (socStudentScoreTotalView == null)
  508. {
  509. socStudentScoreTotalView = new SOCStudentScoreTotalView();
  510. }
  511. try
  512. {
  513. socStudentScoreTotalView.ListStarttermID = socStudentScoreItemViewList.Select(x => (int)x.StarttermID).Distinct().ToList();
  514. }
  515. catch (Exception ex)
  516. {
  517. throw ex;
  518. }
  519. socStudentScoreTotalView.SOCStudentScoreItemViewList = socStudentScoreItemViewList.ToList();
  520. socStudentScoreTotalViewList.Add(socStudentScoreTotalView);
  521. }
  522. return Json(socStudentScoreTotalViewList);
  523. }
  524. [HttpPost]
  525. public ActionResult StudentDetailScoreList(Guid? coursematerialID, int? startTermID)
  526. {
  527. var userID = CustomPrincipal.Current.UserID;
  528. return base.Json(this.SOCDetialScoreServices.GetSOCDetailRawScoreViewList(coursematerialID, startTermID, userID));
  529. }
  530. [HttpPost]
  531. public ActionResult GroupStudentList(QueryParamsModel pararms)
  532. {
  533. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  534. var socDetailGroupID = pararms.getExtraGuid("hidSOCDetailGroupID");
  535. return base.Json(SOCDetialScoreServices.GetSOCDetailGroupStudentViewList(configuretView, socDetailGroupID, (int)pararms.page, (int)pararms.rows));
  536. }
  537. [HttpPost]
  538. public ActionResult DetailStudentGroupList(QueryParamsModel pararms)
  539. {
  540. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  541. var socDetailID = pararms.getExtraGuid("hidSOCDetailID");
  542. var userID = CustomPrincipal.Current.UserID;
  543. return base.Json(SOCDetialScoreServices.GetSOCDetailGroupStudentViewList(configuretView, socDetailID.Value, userID, (int)pararms.page, (int)pararms.rows));
  544. }
  545. [HttpGet]
  546. public ActionResult SendMessage(string studentUserIDLists)
  547. {
  548. ViewBag.UserIDLists = studentUserIDLists;
  549. return View();
  550. }
  551. public ActionResult SendMessage(AnnouncementView announcementView)
  552. {
  553. var userIDs = Request.Form["idList"];
  554. //var message = Request.Form["Message"];
  555. announcementView.Content = HttpContext.Server.HtmlDecode(announcementView.Content);
  556. var userIDList = userIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
  557. try
  558. {
  559. SOCDetialScoreServices.SendMessage(userIDList, announcementView);
  560. return Json(new ReturnMessage()
  561. {
  562. IsSuccess = true,
  563. Message = "发送成功。"
  564. });
  565. }
  566. catch (Exception ex)
  567. {
  568. return Json(new ReturnMessage()
  569. {
  570. IsSuccess = false,
  571. Message = "发送失败:" + ex.Message
  572. });
  573. }
  574. //return View();
  575. }
  576. [HttpGet]
  577. public ActionResult Remark()
  578. {
  579. return View();
  580. }
  581. public ActionResult UploaderSave(FormCollection form)
  582. {
  583. Response.Cache.SetNoStore();
  584. try
  585. {
  586. FileUploadView upfile = new FileUploadView();
  587. var files = Request.Files;
  588. var formID = (!string.IsNullOrEmpty(Request["v"])) ? new Guid(Request["v"]) : (Guid?)null;
  589. string sessionName = FileUploadHelper.GetFileUploadSessionName(formID.Value);
  590. var socDetial = SOCDetialScoreServices.GetSOCDetialView(formID.Value);
  591. var savePath = "SOC";
  592. if(socDetial!=null)
  593. {
  594. savePath = "SOC/" + socDetial.SchoolyearCode + "/" + socDetial.YearID + "级/" + socDetial.EducationMissionNameStr + "-" + socDetial.CourseName + "-" + socDetial.SOCDetailName + "/" + socDetial.LoginID + socDetial.Name;
  595. }
  596. //检查文件扩展名字
  597. var postedFile = files["Filedata"]; //得到要上传文件
  598. //if (postedFile != null)
  599. //{
  600. // if (postedFile.ContentLength > (1024 * 1024 * 10))
  601. // {
  602. // throw new Exception("上传的文件不能大于10M");
  603. // }
  604. //}
  605. if (postedFile.FileName == null)
  606. {
  607. return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
  608. }
  609. upfile.FileID = Function.NewPKGuid();
  610. string fileUrl = FileUploadHelper.UploadFile(postedFile, savePath);
  611. upfile.FileUrl = fileUrl;
  612. upfile.FileName = postedFile.FileName;
  613. upfile.FormID = formID;
  614. if (Session[sessionName] == null)
  615. {
  616. Session[sessionName] = new List<FileUploadView>();
  617. }
  618. ((List<FileUploadView>)Session[sessionName]).Add(upfile);
  619. return Json(upfile, JsonRequestBehavior.AllowGet);
  620. }
  621. catch
  622. //(Exception ex)
  623. {
  624. //return Json(new ReturnMessage()
  625. //{
  626. // IsSuccess = false,
  627. // Message = "发送失败:" + ex.Message
  628. //});
  629. }
  630. return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
  631. }
  632. [HttpPost]
  633. public ActionResult Download()
  634. {
  635. try
  636. {
  637. NpoiExcelHelper neh = new NpoiExcelHelper();
  638. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  639. string WindowStr = Request.UrlReferrer.ToString();
  640. int IndexofID = WindowStr.LastIndexOf("=");
  641. WindowStr = WindowStr.Remove(0, IndexofID + 1);
  642. var IDs = Request.Form["IDs"];
  643. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  644. var collegeID = Request.Form["cgbCollege"].ParseStrTo<Guid>();
  645. var yearID = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  646. var standardID = Request.Form["cbgStandard"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["cbgStandard"].ParseStrTo<int>();
  647. var classmajorID = Request.Form["cbgClassmajor"].ParseStrTo<Guid>();
  648. var coursematerialID = Request.Form["cgbCourse"].ParseStrTo<Guid>();
  649. var recordStatus = Request.Form["ddlStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlStatus"].ParseStrTo<int>();
  650. var isGroupList = Request.Form["isGroupList"].ParseStrTo<int>();
  651. List<Guid?> IDList = new List<Guid?>();
  652. if (IDs != "")
  653. {
  654. IDList = IDs.SplitIDString();
  655. }
  656. else
  657. {
  658. IDList = null;
  659. }
  660. var socDetailList = SOCDetialScoreServices.Download(configuretView, schoolyearID, collegeID, yearID,
  661. standardID, classmajorID, coursematerialID, recordStatus, IDList);
  662. if (isGroupList== 1)
  663. {
  664. socDetailList = SOCDetialScoreServices.GroupListDownload(configuretView, schoolyearID, collegeID, yearID,
  665. standardID, classmajorID, coursematerialID, recordStatus, IDList);
  666. }
  667. List<FileUploadHelper.RemoteFileInfo> fileInfoList = new List<FileUploadHelper.RemoteFileInfo>();
  668. foreach (var soc in socDetailList)
  669. {
  670. FileUploadHelper.RemoteFileInfo fileInfo = new FileUploadHelper.RemoteFileInfo();
  671. fileInfo.FileName = soc.EducationMissionNameStr + "-" + soc.CourseName + "-" + soc.SOCDetailName+ "/" + soc.LoginID + soc.Name+"/"+soc.FileName;
  672. fileInfo.RemotePath = (soc.SOCDetailUrl.Trim().StartsWith("http://") ? soc.SOCDetailUrl.Trim() : Url.Content(soc.SOCDetailUrl.Trim()));
  673. fileInfoList.Add(fileInfo);
  674. }
  675. if (fileInfoList.Count > 0)
  676. {
  677. var zipFileStream = FileUploadHelper.DownLoadFiles("SOC成果","学生成果下载"+ DateTime.Now.Year+"-"+DateTime.Now.Month+"-"+DateTime.Now.Day, fileInfoList);
  678. return File(zipFileStream, System.Net.Mime.MediaTypeNames.Application.Zip,"学生成果下载"+ DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + ".zip");
  679. }
  680. else
  681. {
  682. return RedirectToAction("MsgShowAndOpen", "Common", new
  683. {
  684. WindowID = WindowStr,
  685. msg = "没有成果可下载!",
  686. });
  687. }
  688. }
  689. catch (Exception ex)
  690. {
  691. string mge = ex.Message;
  692. return base.Json("下载失败,原因:" + mge + "!");
  693. }
  694. }
  695. }
  696. }