ExaminationApplayStudentListController.cs 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038
  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.ExaminationApply;
  7. using EMIS.ViewModel;
  8. using EMIS.Web.Controls;
  9. using Bowin.Common.Data;
  10. using Bowin.Common.Utility;
  11. using EMIS.Utility;
  12. using Bowin.Common;
  13. using EMIS.CommonLogic.CalendarManage;
  14. using EMIS.CommonLogic.Students;
  15. using Bowin.Web.Controls.Mvc;
  16. using System.Text;
  17. using EMIS.ViewModel.ExaminationApply;
  18. using EMIS.ViewModel.Students;
  19. using System.IO;
  20. using System.Data;
  21. namespace EMIS.Web.Controllers.ExaminationApply
  22. {
  23. [Authorization]
  24. public class ExaminationApplayStudentListController : Controller
  25. {
  26. public IExaminationSubjectServices ExaminationSubjectServices { get; set; }
  27. public ISchoolYearServices SchoolYearServices { get; set; }
  28. public IExamineApplyServices ExamineApplyService { get; set; }
  29. public ActionResult List()
  30. {
  31. var schoolYear = SchoolYearServices.GetSchoolYearIsCurrent(true);
  32. ViewBag.SchoolYearID = schoolYear == null ? "-1" : schoolYear.SchoolyearID.ToString();//默认当前学年
  33. return View();
  34. }
  35. public ActionResult Export()
  36. {
  37. return View();
  38. }
  39. [HttpPost]
  40. public ActionResult List(QueryParamsModel pararms)
  41. {
  42. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  43. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  44. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  45. var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
  46. var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
  47. var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
  48. var collegeID = pararms.getExtraGuid("cgCollege");
  49. var year = pararms.getExtraInt("ddlYear") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  50. var classmajorID = pararms.getExtraGuid("cgClassmajor");
  51. var recordStatus = pararms.getExtraInt("PayRecordStatus") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("PayRecordStatus");
  52. var isConfirm = pararms.getExtraInt("IsConfirm") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsConfirm");
  53. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  54. return base.Json(ExaminationSubjectServices.GetStudentListViewGrid(configuretView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  55. schoolAreaID, collegeID, year, classmajorID, recordStatus, isConfirm, (int)pararms.page, (int)pararms.rows));
  56. }
  57. [HttpPost]
  58. public ActionResult Excel()
  59. {
  60. NpoiExcelHelper neh = new NpoiExcelHelper();
  61. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  62. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  63. var examinationBatchID = Request.Form["cgExaminationBatch"].ParseStrTo<Guid>();
  64. var examinationTypeID = Request.Form["cgExaminationType"].ParseStrTo<Guid>();
  65. var examinationProjectID = Request.Form["cgExaminationProject"].ParseStrTo<Guid>();
  66. var schoolAreaID = Request.Form["ddlSchoolArea"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlSchoolArea"].ParseStrTo<int>();
  67. var collegeID = Request.Form["cgCollege"].ParseStrTo<Guid>();
  68. var year = Request.Form["ddlYear"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  69. var classmajorID = Request.Form["cgClassmajor"].ParseStrTo<Guid>();
  70. var recordStatus = Request.Form["PayRecordStatus"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["PayRecordStatus"].ParseStrTo<int>();
  71. var isConfirm = Request.Form["IsConfirm"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["IsConfirm"].ParseStrTo<int>();
  72. var examinationRegistrationIDs = Request.Form["SelectedID"];
  73. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  74. List<Guid?> selectIDlist = new List<Guid?>();
  75. if (examinationRegistrationIDs != "" && examinationRegistrationIDs != null)
  76. {
  77. selectIDlist = examinationRegistrationIDs.SplitIDString();
  78. }
  79. var dt = ExaminationSubjectServices.GetStudentListViewForExport(configuretView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  80. schoolAreaID, collegeID, year, classmajorID, recordStatus, isConfirm,selectIDlist).Select(x => new
  81. {
  82. x.SchoolyearCode,
  83. x.ExaminationBatchName,
  84. x.ExaminationProjectName,
  85. x.SchoolAreaName,
  86. x.CollegeName,
  87. x.ClassmajorName,
  88. x.UserName,
  89. x.SexName,
  90. x.CertificatesTypeName,
  91. x.IDNumber,
  92. x.FeeTypeAndFee,
  93. x.PayFee,
  94. x.RecordStatusStr,
  95. x.WechatOrderID,
  96. x.RefundOrderID,
  97. x.ExaminationRegistrationConfirmNo,
  98. x.Remark,
  99. }).ToTable();
  100. string[] liststring = { "学年学期", "考试批次", "项目名称", "校区", "院系所", "班级", "姓名", "性别", "证件类型", "证件号码", "报名项目(费用)", "金额", "缴费状态", "微信订单号", "微信退款单号", "确认单号", "备注" };
  101. neh.Export(dt, liststring, "考试报名名单");
  102. return RedirectToAction("MsgShow", "Common", new
  103. {
  104. msg = "导出成功。",
  105. url = Url.Content("~/ExaminationApplayStudentList/List").AddMenuParameter()
  106. });
  107. }
  108. /// <summary>
  109. /// 复制新增
  110. /// </summary>
  111. /// <param name="examinationRegistrationID"></param>
  112. /// <returns></returns>
  113. public ActionResult CopyAdd(Guid examinationRegistrationID)
  114. {
  115. StudentListView studentListView = new StudentListView();
  116. studentListView = ExaminationSubjectServices.GetStudentListView(examinationRegistrationID);
  117. return View("Edit", studentListView);
  118. }
  119. /// <summary>
  120. /// 复制新增
  121. /// </summary>
  122. /// <param name="studentListView"></param>
  123. /// <returns></returns>
  124. [HttpPost]
  125. public ActionResult CopyAdd(StudentListView studentListView)
  126. {
  127. studentListView.ExaminationRegistrationID = Guid.Empty;
  128. return this.Edit(studentListView);
  129. }
  130. /// <summary>
  131. /// 新增
  132. /// </summary>
  133. /// <param name="examinationRegistrationID"></param>
  134. /// <returns></returns>
  135. [HttpGet]
  136. public ActionResult Edit(Guid? examinationRegistrationID, Guid? schoolYearID, Guid? examinationBatchID, Guid? examinationTypeID, Guid? examinationProjectID)
  137. {
  138. StudentListView studentListView = new StudentListView();
  139. if (schoolYearID.HasValue)
  140. {
  141. studentListView.SchoolyearID = schoolYearID;
  142. }
  143. if (examinationBatchID.HasValue)
  144. {
  145. studentListView.ExaminationBatchID = examinationBatchID;
  146. }
  147. if (schoolYearID.HasValue)
  148. {
  149. studentListView.ExaminationTypeID = examinationTypeID;
  150. }
  151. if (schoolYearID.HasValue)
  152. {
  153. studentListView.ExaminationProjectID = examinationProjectID;
  154. }
  155. if (examinationRegistrationID.HasValue && examinationRegistrationID != Guid.Empty)
  156. {
  157. studentListView = ExaminationSubjectServices.GetStudentListView(examinationRegistrationID);
  158. }
  159. return View(studentListView);
  160. }
  161. /// <summary>
  162. /// 新增
  163. /// </summary>
  164. /// <param name="studentListView"></param>
  165. /// <returns></returns>
  166. [HttpPost]
  167. public ActionResult Edit(StudentListView studentListView)
  168. {
  169. try
  170. {
  171. var studentList = DataGrid.GetTableData<StudentsView>("dgStudentList");
  172. ExaminationSubjectServices.AddSave(studentListView, studentList);
  173. string UrlStr = Url.Action("Edit").AddMenuParameter() + "&schoolYearID=" + studentListView.SchoolyearID + "&examinationBatchID=" + studentListView.ExaminationBatchID
  174. + "&examinationTypeID=" + studentListView.ExaminationTypeID + "&examinationProjectID=" + studentListView.ExaminationProjectID;
  175. return RedirectToAction("MsgShowAndOpenAddUrl", "Common", new
  176. {
  177. WindowID = Request["WindowID"],
  178. msg = "保存成功!",
  179. url = UrlStr,
  180. title = "报名名单新增",
  181. });
  182. }
  183. catch (Exception ex)
  184. {
  185. return Json(new ReturnMessage()
  186. {
  187. IsSuccess = false,
  188. Message = "保存失败,原因:" + ex.Message
  189. });
  190. }
  191. }
  192. /// <summary>
  193. /// 修改
  194. /// </summary>
  195. /// <param name="examinationRegistrationID"></param>
  196. /// <returns></returns>
  197. [HttpGet]
  198. public ActionResult FeeTypeEdit(Guid? examinationRegistrationID)
  199. {
  200. StudentListView studentListView = new StudentListView();
  201. if (examinationRegistrationID.HasValue && examinationRegistrationID != Guid.Empty)
  202. {
  203. studentListView = ExaminationSubjectServices.GetStudentListView(examinationRegistrationID);
  204. }
  205. return View(studentListView);
  206. }
  207. /// <summary>
  208. /// 修改
  209. /// </summary>
  210. /// <param name="studentListView"></param>
  211. /// <returns></returns>
  212. [HttpPost]
  213. public ActionResult FeeTypeEdit(StudentListView studentListView)
  214. {
  215. try
  216. {
  217. //var studentList = DataGrid.GetTableData<StudentsView>("dgStudentList");
  218. ExaminationSubjectServices.EditSave(studentListView);
  219. return Json(new ReturnMessage()
  220. {
  221. IsSuccess = true,
  222. Message = "保存成功。"
  223. });
  224. }
  225. catch (Exception ex)
  226. {
  227. return Json(new ReturnMessage()
  228. {
  229. IsSuccess = false,
  230. Message = "保存失败,原因:" + ex.Message
  231. });
  232. }
  233. }
  234. [HttpPost]
  235. public ActionResult Delete(string examinationRegistrationIDs)
  236. {
  237. try
  238. {
  239. var examinationRegistrationIDList = examinationRegistrationIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
  240. ExaminationSubjectServices.Delete(examinationRegistrationIDList);
  241. return base.Json("删除成功");
  242. }
  243. catch (Exception ex)
  244. {
  245. string mge = ex.Message;
  246. return base.Json("删除失败,原因:" + mge + "!");
  247. }
  248. }
  249. [HttpGet]
  250. public ActionResult ChangeFee(string examinationRegistrationIDs)
  251. {
  252. ViewBag.ExaminationRegistrationIDs = examinationRegistrationIDs;
  253. return View();
  254. }
  255. [HttpPost]
  256. public ActionResult ChangeFee(StudentListView studentListView)
  257. {
  258. try
  259. {
  260. decimal? Fee = Request.Form["Fee"].ParseStrTo<decimal>();
  261. string Remark = Request.Form["Remark"];
  262. string examinationRegistrationIDs = Request.Form["examinationRegistrationIDs"];
  263. var examinationRegistrationIDList = examinationRegistrationIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
  264. ExaminationSubjectServices.ChangeFee(examinationRegistrationIDList, Fee, Remark);
  265. return Json(new ReturnMessage()
  266. {
  267. IsSuccess = true,
  268. Message = "修改成功。"
  269. });
  270. }
  271. catch (Exception ex)
  272. {
  273. return Json(new ReturnMessage()
  274. {
  275. IsSuccess = false,
  276. Message = "修改失败,原因:" + ex.Message
  277. });
  278. }
  279. }
  280. [HttpPost]
  281. public ActionResult Confirm(string examinationRegistrationIDs)
  282. {
  283. try
  284. {
  285. var examinationRegistrationIDList = examinationRegistrationIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
  286. var filePathUrl = Url.Content(Const.LOCAL_SETTING_UPLOAD_FILEPATH);
  287. var confirmID = ExaminationSubjectServices.Confirm(examinationRegistrationIDList, filePathUrl);
  288. return Json(new ReturnMessage()
  289. {
  290. IsSuccess = true,
  291. Message = confirmID.ToString(),
  292. });
  293. }
  294. catch (Exception ex)
  295. {
  296. return Json(new ReturnMessage()
  297. {
  298. IsSuccess = false,
  299. Message = "确认失败,原因:" + ex.Message
  300. });
  301. }
  302. }
  303. [HttpPost]
  304. public ActionResult CancelConfirm(string examinationRegistrationIDs)
  305. {
  306. try
  307. {
  308. var examinationRegistrationIDList = examinationRegistrationIDs.Split(',').Select(x => (Guid)new Guid(x)).ToList();
  309. ExaminationSubjectServices.CancelConfirm(examinationRegistrationIDList);
  310. return Json(new ReturnMessage()
  311. {
  312. IsSuccess = true,
  313. Message = "取消成功。"
  314. });
  315. }
  316. catch (Exception ex)
  317. {
  318. return Json(new ReturnMessage()
  319. {
  320. IsSuccess = false,
  321. Message = "取消失败,原因:" + ex.Message
  322. });
  323. }
  324. }
  325. [HttpPost]
  326. public ActionResult StudentList(QueryParamsModel pararms, Guid? examinationRegistrationID)
  327. {
  328. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  329. var studentList = ExaminationSubjectServices.GetStudentViewList(configuretView, examinationRegistrationID,(int)pararms.page, (int)pararms.rows);
  330. return Json(studentList);
  331. }
  332. public ActionResult StudentSelect(Guid? examinationRegistrationID, Guid? examinationBatchID, Guid? examinationProjectID)
  333. {
  334. ViewBag.examinationBatchID = examinationBatchID;
  335. ViewBag.examinationProjectID = examinationProjectID;
  336. ViewBag.examinationRegistrationID = examinationRegistrationID;
  337. return View();
  338. }
  339. [HttpPost]
  340. public ActionResult StudentListForSelect(QueryParamsModel pararms, Guid? examinationRegistrationID, Guid? examinationBatchID, Guid? examinationProjectID)
  341. {
  342. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  343. var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
  344. var collegeID = pararms.getExtraGuid("CollegeComboGrid");
  345. var grademajorID = pararms.getExtraGuid("GrademajorComboGrid");
  346. var year = pararms.getExtraInt("ddlYear") == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  347. var standardID = pararms.getExtraInt("StandardID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("StandardID");
  348. var classmajorID = pararms.getExtraGuid("ClassmajorComboGrid");
  349. //examinationPlanID = Request.Form["examinationPlanID"].ParseStrTo<Guid>();
  350. return base.Json(ExaminationSubjectServices.GetStudentListForSelect(configuretView, examinationRegistrationID, examinationBatchID, examinationProjectID, schoolAreaID, collegeID, grademajorID, year, standardID, classmajorID, (int)pararms.page, (int)pararms.rows));
  351. }
  352. //[HttpGet]
  353. //public ActionResult ExportPictures(string selectedIDs)
  354. //{
  355. // ViewBag.selectedID = selectedIDs;
  356. // return View();
  357. //}
  358. [HttpPost]
  359. public ActionResult ExportPictures()
  360. {
  361. try
  362. {
  363. string WindowStr = Request.UrlReferrer.ToString();
  364. int IndexofID = WindowStr.LastIndexOf("=");
  365. WindowStr = WindowStr.Remove(0, IndexofID + 1);
  366. WindowStr = WindowStr.Substring(0, WindowStr.Length - 1);
  367. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(null);
  368. var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo<Guid>();
  369. var examinationBatchID = Request.Form["cgExaminationBatch"].ParseStrTo<Guid>();
  370. var examinationTypeID = Request.Form["cgExaminationType"].ParseStrTo<Guid>();
  371. var examinationProjectID = Request.Form["cgExaminationProject"].ParseStrTo<Guid>();
  372. var schoolAreaID = Request.Form["ddlSchoolArea"].ParseStrTo<int>() == DropdownList.SELECT_ALL ? null : Request.Form["ddlSchoolArea"].ParseStrTo<int>();
  373. var collegeID = Request.Form["cgCollege"].ParseStrTo<Guid>();
  374. var year = Request.Form["ddlYear"].ParseStrTo<int>() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo<int>();
  375. var classmajorID = Request.Form["cgClassmajor"].ParseStrTo<Guid>();
  376. var recordStatus = Request.Form["PayRecordStatus"].ParseStrTo<int>() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["PayRecordStatus"].ParseStrTo<int>();
  377. var isConfirm = Request.Form["IsConfirm"].ParseStrTo<int>() == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL ? null : Request.Form["IsConfirm"].ParseStrTo<int>();
  378. var selectedIDs = Request.Form["SelectedID"];
  379. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  380. //WebClient conn = new WebClient();
  381. List<StudentsView> studentList = new List<StudentsView>();
  382. if (!string.IsNullOrEmpty(selectedIDs))
  383. {
  384. var selectedIDList = selectedIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  385. studentList = ExaminationSubjectServices.GetStudentViewListByIDList(selectedIDList).ToList();
  386. }
  387. else
  388. {
  389. studentList = ExaminationSubjectServices.GetStudentListByCondition(configuretView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  390. schoolAreaID, collegeID, year, classmajorID, recordStatus, isConfirm).ToList();
  391. }
  392. var remoteFileList = studentList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x =>
  393. new EMIS.Utility.FileUploadHelper.RemoteFileInfo
  394. {
  395. FileName = x.IDNumber + Path.GetExtension(x.PhotoUrl.Trim()),
  396. RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : Url.Content(x.PhotoUrl.Trim()))
  397. }).ToList();
  398. //if (ExportPictureType == "IDNumberToPicture")
  399. //{
  400. // remoteFileList = studentList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x =>
  401. // new EMIS.Utility.FileUploadHelper.RemoteFileInfo
  402. // {
  403. // FileName = x.IDNumber + Path.GetExtension(x.PhotoUrl.Trim()),
  404. // RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : Url.Content(x.PhotoUrl.Trim()))
  405. // }).ToList();
  406. //}
  407. //if (ExportPictureType == "ExamineeNumToPicture")
  408. //{
  409. // remoteFileList = studentList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x =>
  410. // new EMIS.Utility.FileUploadHelper.RemoteFileInfo
  411. // {
  412. // FileName = x.ExamineeNum + Path.GetExtension(x.PhotoUrl.Trim()),
  413. // RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : Url.Content(x.PhotoUrl.Trim()))
  414. // }).ToList();
  415. //}
  416. //if (ExportPictureType == "LoginIDandUserNameToPicture")
  417. //{
  418. // remoteFileList = studentList.Where(x => !string.IsNullOrEmpty(x.PhotoUrl)).Select(x =>
  419. // new EMIS.Utility.FileUploadHelper.RemoteFileInfo
  420. // {
  421. // FileName = x.LoginID + x.UserName + Path.GetExtension(x.PhotoUrl.Trim()),
  422. // RemotePath = (x.PhotoUrl.Trim().StartsWith("http://") ? x.PhotoUrl.Trim() : Url.Content(x.PhotoUrl.Trim()))
  423. // }).ToList();
  424. //}
  425. if (remoteFileList.Count > 0)
  426. {
  427. var zipFileStream = FileUploadHelper.DownLoadFiles(Guid.NewGuid().ToString(), "学生相片", remoteFileList);
  428. return File(zipFileStream, System.Net.Mime.MediaTypeNames.Application.Zip, "学生相片.zip");
  429. }
  430. else
  431. {
  432. return RedirectToAction("MsgShow", "Common", new
  433. {
  434. WindowID = Request["WindowID"],
  435. msg = "没有相片可导出!",
  436. url = Url.Action("List").AddMenuParameter(),
  437. });
  438. }
  439. }
  440. catch (Exception ex)
  441. {
  442. string mge = ex.Message;
  443. return RedirectToAction("MsgShow", "Common", new
  444. {
  445. WindowID = Request["WindowID"],
  446. msg = "导出失败。原因:" + mge + "!",
  447. url = Url.Action("List").AddMenuParameter()
  448. });
  449. }
  450. }
  451. public ActionResult RegistrationConfirmReport(string examinationRegistrationConfirmIDs)
  452. {
  453. var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  454. ViewBag.ExaminationRegistrationConfirmID = examinationRegistrationConfirmIDs;
  455. //ViewBag.UserID = curUser.UserID.ToString();
  456. return View();
  457. }
  458. [HttpGet]
  459. public ActionResult StudentImport(string errorFile, string operationTips)
  460. {
  461. ViewBag.ErrorFile = errorFile;
  462. //if (string.IsNullOrEmpty(operationTips))
  463. //{
  464. // operationTips = "错误数据下载";
  465. //}
  466. ViewBag.operationTips = operationTips;
  467. //ViewBag.result = errorResult;
  468. //if (errorResult != null)
  469. //{
  470. // return View(errorResult);
  471. //}
  472. return View(new ExcelImportResult());
  473. }
  474. [HttpPost]
  475. public ActionResult StudentImport(HttpPostedFileBase file, Guid? schoolyearID, Guid? examinationBatchID, Guid? examinationTypeID, Guid? examinationProjectID, Guid? examinationProjectFeeID, int? feeTypeID)
  476. {
  477. try
  478. {
  479. //var schoolyearID = pararms.getExtraGuid("schoolyearID");
  480. //var examinationBatchID = pararms.getExtraGuid("examinationBatchID");
  481. //var examinationTypeID = pararms.getExtraGuid("examinationTypeID");
  482. //var examinationProjectID = pararms.getExtraGuid("examinationProjectID");
  483. //var examinationProjectFeeID = pararms.getExtraGuid("examinationProjectFeeID");
  484. //var feeTypeID = pararms.getExtraInt("feeTypeID") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("feeTypeID");
  485. if (!NpoiExcelHelper.GetIsCompatible(file.FileName))
  486. {
  487. throw new Exception("只允许上传xls和xlsx格式的Excel文件!");
  488. }
  489. var excel = new NpoiExcelHelper();
  490. #region 表单头
  491. Dictionary<string, string> cellheader = new Dictionary<string, string>
  492. {
  493. { "IDNumber", "证件号" },
  494. { "UserName", "姓名" },
  495. };
  496. #endregion
  497. StringBuilder errorMsg = new StringBuilder(); // 错误信息
  498. string sourceWebPath = FileUploadHelper.UploadFile(file);
  499. var sourcePhysicalPath = Server.MapPath(sourceWebPath);
  500. List<StudentListView> errList = new List<StudentListView>();
  501. List<StudentListView> dataList = new List<StudentListView>();
  502. int errCount = 0;
  503. int OkCount = 0;
  504. var insertList = ExaminationSubjectServices.StudentImport(cellheader, out OkCount, out errList, out errCount, sourcePhysicalPath,
  505. schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID, examinationProjectFeeID, feeTypeID);
  506. if (errCount > 0)
  507. {
  508. //errorResult = insertList;
  509. var errorPhysicalPath = sourcePhysicalPath;
  510. var errorWebPaths = sourceWebPath;
  511. string errorWebPath = string.Format("{0}", NpoiExcelHelper.EntityListToExcel2003(cellheader, errList, "学生报名名单失败文件", errorWebPaths));
  512. insertList.ErrorFilePath = errorWebPath;
  513. insertList.Message = string.Format("提示:成功导入{0}条记录,失败{1}条,详情请点击错误数据下载查看。", OkCount < 1 ? 0 : OkCount, errCount < 1 ? 0 : errCount);
  514. //ViewBag.operationTips = Errinfo;
  515. //ViewBag.result = insertList;
  516. //// //return RedirectToAction("Import", new { errorFile = errorWebPath, operationTips = Errinfo });
  517. //return RedirectToAction("MsgShow", "Common", new
  518. //{
  519. // WindowID = "none",
  520. // msg = "导入失败!",
  521. // url = Url.Action("StudentImport").AddMenuParameter() + "&errorFile=" + errorWebPath + "&operationTips=" + Errinfo + "&result=" + insertList.Data + "&WindowID=" + Request["WindowID"]
  522. //});
  523. return View(insertList);
  524. }
  525. else
  526. {
  527. return View(insertList);
  528. }
  529. }
  530. catch (Exception ex)
  531. {
  532. return RedirectToAction("MsgShow", "Common", new
  533. {
  534. WindowID = Request["WindowID"],
  535. msg = "导入失败,原因:" + ex.Message + "!",
  536. url = Url.Action("Edit").AddMenuParameter()
  537. });
  538. }
  539. }
  540. /// <summary>
  541. /// 获取批次下拉(根据学年学期)
  542. /// </summary>
  543. /// <param name="pararms"></param>
  544. /// <returns></returns>
  545. [HttpPost]
  546. public ActionResult GetExaminationBatchViewGrid(QueryParamsModel pararms)
  547. {
  548. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  549. var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown");
  550. return base.Json(ExaminationSubjectServices.GetExaminationBatchViewForComboGrid(configuretView, schoolyearID, (int)pararms.page, (int)pararms.rows));
  551. }
  552. /// <summary>
  553. /// 获取考试类型下拉(根据学年学期)
  554. /// </summary>
  555. /// <param name="pararms"></param>
  556. /// <returns></returns>
  557. [HttpPost]
  558. public ActionResult GetExaminationTypeViewGrid(QueryParamsModel pararms)
  559. {
  560. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  561. var schoolyearID = pararms.getExtraGuid("SchoolYearDropdown");
  562. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  563. return base.Json(ExamineApplyService.GetExaminationTypeViewForComboGrid(configuretView, schoolyearID, examinationBatchID, (int)pararms.page, (int)pararms.rows));
  564. }
  565. /// <summary>
  566. /// 获取项目下拉(根据批次,考试类型)
  567. /// </summary>
  568. /// <param name="pararms"></param>
  569. /// <returns></returns>
  570. [HttpPost]
  571. public ActionResult GetProjectListViewGrid(QueryParamsModel pararms)
  572. {
  573. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  574. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  575. var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
  576. return base.Json(ExaminationSubjectServices.GetExaminationProjectViewGridForComboGrid(configuretView, examinationBatchID, examinationTypeID, (int)pararms.page, (int)pararms.rows));
  577. }
  578. /// <summary>
  579. /// 获取项目收费标准下拉(根据项目)学生端,根据批次项目控制查询
  580. /// </summary>
  581. /// <param name="pararms"></param>
  582. /// <returns></returns>
  583. [HttpPost]
  584. public ActionResult GetExaminationProjectFeeViewGrid(QueryParamsModel pararms)
  585. {
  586. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  587. var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
  588. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  589. return base.Json(ExaminationSubjectServices.GetProjectFeeTypeViewForComboGrid(configuretView, examinationBatchID, examinationProjectID, (int)pararms.page, (int)pararms.rows));
  590. }
  591. /// <summary>
  592. /// 获取项目收费标准下拉(根据项目)教师端,根据收费项目查询
  593. /// </summary>
  594. /// <param name="pararms"></param>
  595. /// <returns></returns>
  596. [HttpPost]
  597. public ActionResult GetExaminationProjectFeeViewByBaseGrid(QueryParamsModel pararms)
  598. {
  599. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  600. var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
  601. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  602. return base.Json(ExaminationSubjectServices.GetProjectFeeTypeViewByBaseForComboGrid(configuretView, examinationBatchID, examinationProjectID, (int)pararms.page, (int)pararms.rows));
  603. }
  604. /// <summary>
  605. /// 获取收费项下拉(根据项目收费标准)
  606. /// </summary>
  607. /// <param name="pararms"></param>
  608. /// <returns></returns>
  609. [HttpPost]
  610. public ActionResult GetFeeTypeViewGrid(QueryParamsModel pararms)
  611. {
  612. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  613. var examinationProjectFeeID = pararms.getExtraGuid("cgExaminationProjectFee");
  614. return base.Json(ExaminationSubjectServices.GetFeeTypeViewForComboGrid(configuretView, examinationProjectFeeID, (int)pararms.page, (int)pararms.rows));
  615. }
  616. public ActionResult InfoExport()
  617. {
  618. return View();
  619. }
  620. public ActionResult DailyExport(QueryParamsModel pararms, string selectedIDs)
  621. {
  622. NpoiExcelHelper neh = new NpoiExcelHelper();
  623. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  624. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  625. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  626. var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
  627. var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
  628. var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
  629. var collegeID = pararms.getExtraGuid("cgCollege");
  630. var year = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  631. var classmajorID = pararms.getExtraGuid("cgClassmajor");
  632. var recordStatus = pararms.getExtraInt("PayRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("PayRecordStatus");
  633. var isConfirm = pararms.getExtraInt("IsConfirm") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsConfirm");
  634. var examinationRegistrationIDs = Request.Form["SelectedID"];
  635. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  636. List<Guid?> selectIDlist = new List<Guid?>();
  637. if (selectedIDs != "" && selectedIDs != null)
  638. {
  639. selectIDlist = selectedIDs.SplitIDString();
  640. }
  641. var dt = ExaminationSubjectServices.GetStudentListForExportViewGrid(configuretView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  642. schoolAreaID, collegeID, year, classmajorID, recordStatus, isConfirm, selectIDlist).Select(x => new
  643. {
  644. x.Year,
  645. x.SchoolAreaName,
  646. x.CollegeName,
  647. x.StandardName,
  648. x.ClassmajorName,
  649. x.ExaminationTypeName,
  650. x.ExaminationProjectName,
  651. x.StudentNo,
  652. x.UserName,
  653. x.SexName,
  654. x.IDNumber,
  655. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : ""),
  656. x.NationName,
  657. x.EducationName,
  658. x.ResidenceTypeName,
  659. x.ResidenceStr,
  660. x.HomeAddress,
  661. x.Mobile,
  662. x.FeeTypeAndFee,
  663. x.PayFee,
  664. RegistrDate = (x.RegistrDate.HasValue ? x.RegistrDate.Value.ToString("yyyy-MM-dd") : ""),
  665. PayDate = (x.PayDate.HasValue ? x.PayDate.Value.ToString("yyyy-MM-dd") : ""),
  666. x.WeChatNo,
  667. x.RecordStatusStr,
  668. x.Remark
  669. }).ToTable();
  670. dt = AddSeriNumToDataTable(dt);
  671. string[] liststring = { "序号","年级", "校区", "院系所", "专业", "班级", "项目种类","项目名称","学号", "姓名", "性别",
  672. "身份证号", "出生日期","民族","学历","户口性质", "户口所在地", "家庭住址", "联系电话", "报名项目(费用)",
  673. "总费用","报名日期","收费日期","微信号", "状态", "备注" };
  674. neh.Export(dt, liststring, "常规信息");
  675. return RedirectToAction("MsgShow", "Common", new
  676. {
  677. msg = "导出成功。",
  678. url = Url.Content("~/ExaminationApplayStudentList/InfoExport").AddMenuParameter()
  679. });
  680. }
  681. public ActionResult PJ5Export(QueryParamsModel pararms, string selectedIDs)
  682. {
  683. NpoiExcelHelper neh = new NpoiExcelHelper();
  684. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  685. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  686. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  687. var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
  688. var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
  689. var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
  690. var collegeID = pararms.getExtraGuid("cgCollege");
  691. var year = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  692. var classmajorID = pararms.getExtraGuid("cgClassmajor");
  693. var recordStatus = pararms.getExtraInt("PayRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("PayRecordStatus");
  694. var isConfirm = pararms.getExtraInt("IsConfirm") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsConfirm");
  695. var examinationRegistrationIDs = Request.Form["SelectedID"];
  696. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  697. List<Guid?> selectIDlist = new List<Guid?>();
  698. if (examinationRegistrationIDs != "" && examinationRegistrationIDs != null)
  699. {
  700. selectIDlist = examinationRegistrationIDs.SplitIDString();
  701. }
  702. var dt = ExaminationSubjectServices.GetStudentListForExportViewGrid(configuretView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  703. schoolAreaID, collegeID, year, classmajorID, recordStatus, isConfirm, selectIDlist).Select(x => new
  704. {
  705. x.UserName,
  706. x.CertificatesTypeName,
  707. x.IDNumber,
  708. x.SpecialSign,
  709. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : ""),
  710. x.SexName,
  711. x.EducationName,
  712. x.WorkingYears,
  713. x.WorkPlace,
  714. x.ProfessionalQualificationLevel,
  715. x.Copy,
  716. x.ExaminationTypeName,
  717. x.AppraisalPersonalType,
  718. x.PersonalType,
  719. x.ResidenceTypeName,
  720. x.ResidenceStr,
  721. x.NationName,
  722. x.PoliticsName,
  723. x.MaritalStatus,
  724. x.NationalQualificationLevel,
  725. x.PositionLevel,
  726. x.NationalAndCode,
  727. x.Address,
  728. RegistrDate = (x.RegistrDate.HasValue ? x.RegistrDate.Value.ToString("yyyy-MM-dd") : ""),
  729. x.ResitTheory,
  730. x.ResitPractice,
  731. x.ResitOne,
  732. x.ResitTwo,
  733. x.ResitThree,
  734. x.ResitFour,
  735. x.ProfessionalTitle,
  736. x.IsNotTheory,
  737. x.TheoryScore,
  738. x.PracticeScore,
  739. x.ResitOneScore,
  740. x.ResitTwoScore,
  741. x.ResitThreeScore,
  742. x.ResitFourScore,
  743. x.Mobile
  744. }).ToTable();
  745. dt = AddSeriNumToDataTable(dt);
  746. string[] liststring = { "序号","姓名", "证件名称", "证件编号", "特殊标志", "出生日期","性别","文化程度", "工龄", "工作单位","上一级职业资格级别", "副本",
  747. "考试类型","鉴定人员类别","人员类别", "户口性质", "户口所在地", "民族", "政治面貌","婚姻状况","国家职业资格等级","专业技术职务级别","国家/地区代码",
  748. "联系地址", "报名日期", "补考理论","补考实操","补加考1","补加考2", "补加考3", "补加考4","职称","是否免考理论","理论成绩","实操成绩", "加考1成绩",
  749. "加考2成绩", "加考3成绩","加考4成绩","考生手机"};
  750. neh.Export(dt, liststring, "广州市PJ5信息");
  751. return RedirectToAction("MsgShow", "Common", new
  752. {
  753. msg = "导出成功。",
  754. url = Url.Content("~/ExaminationApplayStudentList/InfoExport").AddMenuParameter()
  755. });
  756. }
  757. public ActionResult HighNewExport(QueryParamsModel pararms, string selectedIDs)
  758. {
  759. NpoiExcelHelper neh = new NpoiExcelHelper();
  760. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  761. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  762. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  763. var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
  764. var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
  765. var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
  766. var collegeID = pararms.getExtraGuid("cgCollege");
  767. var year = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  768. var classmajorID = pararms.getExtraGuid("cgClassmajor");
  769. var recordStatus = pararms.getExtraInt("PayRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("PayRecordStatus");
  770. var isConfirm = pararms.getExtraInt("IsConfirm") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsConfirm");
  771. var examinationRegistrationIDs = Request.Form["SelectedID"];
  772. if (configuretView.Attribute == Bowin.Web.Controls.Mvc.DropdownList.SELECT_ALL.ToString()) configuretView.Attribute = "";
  773. List<Guid?> selectIDlist = new List<Guid?>();
  774. if (examinationRegistrationIDs != "" && examinationRegistrationIDs != null)
  775. {
  776. selectIDlist = examinationRegistrationIDs.SplitIDString();
  777. }
  778. var dt = ExaminationSubjectServices.GetStudentListForExportViewGrid(configuretView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  779. schoolAreaID, collegeID, year, classmajorID, recordStatus, isConfirm, selectIDlist).Select(x => new
  780. {
  781. x.CertificatesTypeName,
  782. x.IDNumber,
  783. x.UserName,
  784. x.EnglishName,
  785. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : ""),
  786. x.SexName,
  787. x.WorkPlace,
  788. x.EducationName,
  789. x.JoinWorkDate,
  790. x.WorkingYears,
  791. x.WorkType,
  792. x.Area,
  793. x.ResidenceStr,
  794. x.Place,
  795. x.NationName,
  796. x.PoliticsName,
  797. x.Mobile,
  798. x.ZipCode,
  799. x.IDCardAddress,
  800. x.HomeAddress,
  801. x.IsSoldier,
  802. x.IsLaidOff,
  803. x.IsUnemployment,
  804. x.IsDisability,
  805. x.IsFarmer,
  806. x.IsLabour,
  807. x.Other,
  808. x.DeclareOccupation,
  809. x.DeclareLevel,
  810. x.DeclareCondition,
  811. x.AppraisalType,
  812. x.OldCertificateNumber,
  813. x.ExamineeType,
  814. x.SubsidyTarget,
  815. x.SubsidyCertificateType,
  816. x.SubsidyCertificateNumber,
  817. x.ExamineeRemark,
  818. x.ExamineeCampus
  819. }).ToTable();
  820. dt = AddSeriNumToDataTable(dt);
  821. string[] liststring = { "序号","身份证件类型","身份证件编号", "中文姓名", "英文姓名", "出生日期","性别", "工作单位","文化程度", "参加工作时间","职业年限",
  822. "从事职业","考生来源","户口所在省(市)","户口所在市(区)", "民族", "政治面貌","联系电话","邮政编码","身份证住址","常住住址", "现役军人", "下岗人员",
  823. "失业人员", "残疾人员","农民工","劳教劳改人员", "其它", "申报职业","申报级别","申报条件","鉴定分类","原证书编号", "考生类别","补贴对象", "补贴证件类型",
  824. "补贴证件编码","报名备注","报名单位"};
  825. neh.Export(dt, liststring, "高新信息");
  826. return RedirectToAction("MsgShow", "Common", new
  827. {
  828. msg = "导出成功。",
  829. url = Url.Content("~/ExaminationApplayStudentList/InfoExport").AddMenuParameter()
  830. });
  831. }
  832. [HttpPost]
  833. public ActionResult ExportBySelect(QueryParamsModel pararms, string selectedIDs, string colnames, string showname)
  834. {
  835. NpoiExcelHelper neh = new NpoiExcelHelper();
  836. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  837. var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
  838. var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
  839. var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
  840. var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
  841. var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
  842. var collegeID = pararms.getExtraGuid("cgCollege");
  843. var year = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
  844. var classmajorID = pararms.getExtraGuid("cgClassmajor");
  845. var recordStatus = pararms.getExtraInt("PayRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("PayRecordStatus");
  846. var isConfirm = pararms.getExtraInt("IsConfirm") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("IsConfirm");
  847. List<Guid?> selectIDlist = new List<Guid?>();
  848. if (selectedIDs != "" && selectedIDs != null)
  849. {
  850. selectIDlist = selectedIDs.SplitIDString();
  851. }
  852. List<string> namelist = new List<string>();
  853. for (int i = 0; i < showname.Split(',').Length; i++)
  854. {
  855. string col = showname.Split(',')[i];
  856. if (!string.IsNullOrEmpty(col))
  857. {
  858. namelist.Add(col);
  859. }
  860. }
  861. List<string> idlist = new List<string>();
  862. for (int i = 0; i < colnames.Split(',').Length; i++)
  863. {
  864. string col = colnames.Split(',')[i];
  865. if (!string.IsNullOrEmpty(col))
  866. {
  867. idlist.Add(col);
  868. }
  869. }
  870. var dt = ExaminationSubjectServices.GetStudentListForExportViewGrid(configuretView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
  871. schoolAreaID, collegeID, year, classmajorID, recordStatus, isConfirm, selectIDlist).Select(x => new
  872. {
  873. x.SchoolAreaName,
  874. x.ExamineeNum,
  875. x.UserName,
  876. x.SexName,
  877. BirthDate = (x.BirthDate.HasValue ? x.BirthDate.Value.ToString("yyyy-MM-dd") : ""),
  878. x.IDNumber,
  879. x.QQ,
  880. x.Email,
  881. x.PhoneNumber,
  882. x.SchoolCode,
  883. x.SchoolName,
  884. x.StandardCode,
  885. x.StandardName,
  886. LearnSystem = (x.LearnSystem.HasValue ? (x.LearnSystem.Value % 1 == 0 ? x.LearnSystem.Value.ToString("0") : x.LearnSystem.Value.ToString("0.0")) : ""),
  887. x.LearningformName,
  888. x.EducationName,
  889. EntranceDate = (x.EntranceDate.HasValue ? x.EntranceDate.Value.ToString("yyyy-MM-dd") : ""),
  890. PlanningGraduateDate = (x.PlanningGraduateDate.HasValue ? x.PlanningGraduateDate.Value.ToString("yyyy-MM-dd") : ""),
  891. x.GraduationResultName,
  892. x.StudentNo,
  893. x.PoliticsName,
  894. x.NationName,
  895. x.CampusName,
  896. x.CollegeName,
  897. x.ClassmajorCode,
  898. x.ClassmajorName,
  899. x.Remark,
  900. }).ToTable(namelist);
  901. string[] liststring = idlist.ToArray();
  902. neh.Export(dt, liststring, "自定义信息");
  903. return RedirectToAction("MsgShow", "Common", new
  904. {
  905. msg = "导出成功!",
  906. url = Url.Content("~/ExaminationApplayStudentList/InfoExport").AddMenuParameter()
  907. });
  908. }
  909. /// <summary>
  910. /// 在DataTable中添加一序号列,编号从1依次递增
  911. /// </summary>
  912. /// <param >DataTable</param>
  913. /// <returns></returns>
  914. private DataTable AddSeriNumToDataTable(DataTable dt)
  915. {
  916. //需要返回的值
  917. DataTable dtNew;
  918. if (dt.Columns.IndexOf("序号") >= 0)
  919. {
  920. dtNew = dt;
  921. }
  922. else //添加一序号列,并且在第一列
  923. {
  924. int rowLength = dt.Rows.Count;
  925. int colLength = dt.Columns.Count;
  926. DataRow[] newRows = new DataRow[rowLength];
  927. dtNew = new DataTable();
  928. //在第一列添加“序号”列
  929. dtNew.Columns.Add("序号");
  930. for (int i = 0; i < colLength; i++)
  931. {
  932. dtNew.Columns.Add(dt.Columns[i].ColumnName);
  933. //复制dt中的数据
  934. for (int j = 0; j < rowLength; j++)
  935. {
  936. if (newRows[j] == null)
  937. newRows[j] = dtNew.NewRow();
  938. //将其他数据填充到第二列之后,因为第一列为新增的序号列
  939. newRows[j][i + 1] = dt.Rows[j][i];
  940. }
  941. }
  942. foreach (DataRow row in newRows)
  943. {
  944. dtNew.Rows.Add(row);
  945. }
  946. }
  947. //对序号列填充,从1递增
  948. for (int i = 0; i < dt.Rows.Count; i++)
  949. {
  950. dtNew.Rows[i]["序号"] = i + 1;
  951. }
  952. return dtNew;
  953. }
  954. public ActionResult AddStudentsCheck(string IDNumberStr, Guid? schoolyearID, Guid? examinationBatchID, Guid? examinationTypeID, Guid? examinationProjectID, Guid? examinationProjectFeeID, int? feeTypeID)
  955. {
  956. List<string> IDNumberlist = new List<string>();
  957. if (IDNumberStr != "" && IDNumberStr != null)
  958. {
  959. IDNumberlist = IDNumberStr.Split(',').ToList();
  960. }
  961. var studentList = ExaminationSubjectServices.AddStudentsCheck(IDNumberlist, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID, examinationProjectFeeID, feeTypeID);
  962. //var successfulID = studentList.Select(x => x.IDNumber).ToList();
  963. return Json(studentList);
  964. }
  965. }
  966. }