CommonController.cs 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.Data;
  7. using System.Text;
  8. using System.IO;
  9. using System.Drawing.Imaging;
  10. using System.Reflection;
  11. using Autofac;
  12. using Bowin.Common.Utility;
  13. using Bowin.Common.Data;
  14. using Bowin.Common.Linq.Entity;
  15. using Bowin.Common.JSON;
  16. using Bowin.Web.Controls.Mvc;
  17. using EMIS.Web.Controls;
  18. using EMIS.Utility;
  19. using EMIS.Entities;
  20. using EMIS.ViewModel;
  21. using EMIS.ViewModel.EducationManagement;
  22. using EMIS.ViewModel.SystemView;
  23. using EMIS.CommonLogic.UniversityManage.SpecialtyClassManage;
  24. using EMIS.CommonLogic.EducationManagement;
  25. using EMIS.CommonLogic.SystemServices;
  26. namespace EMIS.Web.Controllers
  27. {
  28. [Authorization]
  29. public class CommonController : Controller
  30. {
  31. public IConfiguretermsInfoServices ConfiguretermsInfoServices { get; set; }
  32. public IBatchModifyServices BatchModifyServices { get; set; }
  33. public IMailVerifyServices MailVerifyServices { get; set; }
  34. public IUserServices UserServices { get; set; }
  35. public IWorkflowServices WorkflowServices { get; set; }
  36. public IContextMenuServices ContextMenuServices { get; set; }
  37. public IClassmajorServices ClassmajorServices { get; set; }
  38. public IControlItemServices ControlItemServices { get; set; }
  39. public EducationMissionClassView educationMissionClassView { get; set; }
  40. public IEducationMissionClassServices EducationMissionClassServices { get; set; }
  41. /// <summary>
  42. ///
  43. /// </summary>
  44. /// <param name="bindType"></param>
  45. /// <param name="dictionaryCode"></param>
  46. /// <returns></returns>
  47. [HttpPost]
  48. public ActionResult DictionaryDropDown(DropdownListBindType? bindType, string dictionaryCode)
  49. {
  50. List<DropdownListItem> list = DictionaryHelper.GetDictionaryValue(dictionaryCode).Where(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
  51. .Select(x => new DropdownListItem { Text = x.Name, Value = x.Value.ToString() }).ToList();
  52. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  53. DropdownList.FormatDropdownItemList(dbt, list);
  54. return base.Json(list);
  55. }
  56. /// <summary>
  57. ///
  58. /// </summary>
  59. /// <param name="bindType"></param>
  60. /// <returns></returns>
  61. [HttpPost]
  62. public ActionResult SchoolYearDropDown(DropdownListBindType? bindType)
  63. {
  64. List<DropdownListItem> list = DictionaryHelper.GetDictionaryValue(typeof(EMIS.ViewModel.CF_Year).Name)
  65. .Select(x => new DropdownListItem { Text = x.Name, Value = x.Value.ToString() })
  66. .OrderByDescending(x => x.Value).ToList();
  67. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  68. DropdownList.FormatDropdownItemList(dbt, list);
  69. return base.Json(list);
  70. }
  71. /// <summary>
  72. ///
  73. /// </summary>
  74. /// <param name="bindType"></param>
  75. /// <param name="menuNo"></param>
  76. /// <param name="formClass"></param>
  77. /// <returns></returns>
  78. [HttpPost]
  79. public ActionResult DynamicConditionDropDown(DropdownListBindType? bindType, string menuNo, string formClass)
  80. {
  81. if (menuNo == "")
  82. {
  83. menuNo = null;
  84. }
  85. var listAttribute = ConfiguretermsInfoServices.GetConfiguretermsInfo(menuNo, formClass);
  86. List<DropdownListItem> listdl = new List<DropdownListItem>();
  87. foreach (var item in listAttribute)
  88. {
  89. if (item.ControlType == "DictionaryDropDownList")
  90. {
  91. item.PostUrl = Url.Action("DictionaryDropDown") + "?dictionaryCode=" + item.DictionaryCode + "&bindType=" + (int)DropdownListBindType.SelectAll;
  92. item.ControlTextFiled = "Text";
  93. item.ControlValueFiled = "Value";
  94. }
  95. else if (!string.IsNullOrEmpty(item.PostUrl))
  96. {
  97. var temp = item.PostUrl.Split('?');
  98. if (temp.Length > 1)
  99. {
  100. item.PostUrl = item.PostUrl + "&bindType=" + (int)DropdownListBindType.SelectAll;
  101. }
  102. else
  103. {
  104. item.PostUrl = item.PostUrl + "?bindType=" + (int)DropdownListBindType.SelectAll;
  105. }
  106. item.PostUrl = Url.Content(item.PostUrl);
  107. }
  108. DropdownListItem ddl = new DropdownListItem { Text = item.Name, Value = item.ToJson() };
  109. listdl.Add(ddl);
  110. }
  111. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  112. DropdownList.FormatDropdownItemList(dbt, listdl);
  113. return base.Json(listdl);
  114. }
  115. /// <summary>
  116. ///
  117. /// </summary>
  118. /// <param name="menuClass"></param>
  119. /// <param name="mnu"></param>
  120. /// <returns></returns>
  121. [HttpPost]
  122. public JsonResult GetPositionConditionData(string menuClass, string mnu)
  123. {
  124. if (mnu == "")
  125. {
  126. mnu = null;
  127. }
  128. var configuretermsInfos = ConfiguretermsInfoServices.GetConfiguretermsInfo(mnu, menuClass);
  129. if (configuretermsInfos != null && configuretermsInfos.Count() > 0)
  130. {
  131. var result = new
  132. {
  133. Url = Url.Action("DynamicConditionDropDown") + "?menuNo=" + mnu + "&formClass=" + menuClass + "&bindType=" + (int)DropdownListBindType.None,
  134. TextField = "Text",
  135. ValueField = "Value",
  136. Condition = configuretermsInfos[0].listControl
  137. };
  138. return Json(result, JsonRequestBehavior.AllowGet);
  139. }
  140. else
  141. {
  142. var result = new
  143. {
  144. Url = Url.Action("DynamicConditionDropDown") + "?menuNo=" + mnu + "&formClass=" + menuClass + "&bindType=" + (int)DropdownListBindType.None,
  145. TextField = "Text",
  146. ValueField = "Value"
  147. };
  148. return Json(result, JsonRequestBehavior.AllowGet);
  149. }
  150. }
  151. /// <summary>
  152. ///
  153. /// </summary>
  154. /// <param name="controlName"></param>
  155. /// <param name="dataCondition"></param>
  156. /// <param name="textField"></param>
  157. /// <param name="valueFiled"></param>
  158. /// <param name="url"></param>
  159. /// <param name="configuretermsExpandJson"></param>
  160. /// <returns></returns>
  161. [HttpPost]
  162. public ActionResult GetPositionConditionComboGrid(string controlName, string dataCondition, string textField, string valueFiled,
  163. string url, string configuretermsExpandJson)
  164. {
  165. var configuretermsExpandList = configuretermsExpandJson.JsonToObject<List<Sys_ConfiguretermsExpand>>();
  166. List<DataGridColumn> columList = new List<DataGridColumn>();
  167. foreach (var configuretermsExpand in configuretermsExpandList)
  168. {
  169. BoundFieldColumn bfc = new BoundFieldColumn { FieldName = configuretermsExpand.ColumnValue, HeaderText = configuretermsExpand.ColumnName, Width = 0.1, Align = AlignStyle.Center };
  170. columList.Add(bfc);
  171. }
  172. ComboGridOptions comboGridOptions = new ComboGridOptions
  173. {
  174. TextField = textField,
  175. ValueField = valueFiled,
  176. ID = controlName,
  177. Name = controlName,
  178. EmptyText = "全部",
  179. GridOptions = new DataGridOptions
  180. {
  181. Columns = columList,
  182. IsCheckOnSelect = true,
  183. DataSourceUrl = Url.Content(url),
  184. IsPagination = true,
  185. IsShowRowNumbers = true,
  186. IsSingleSelect = false
  187. }
  188. };
  189. IDictionary<string, string> htmlAttributes = new Dictionary<string, string>() { { "data-condition", dataCondition } };
  190. return Json(MvcHtmlString.Create(Bowin.Web.Controls.Mvc.ComboGrid.CreateControl(comboGridOptions, htmlAttributes).Render()).ToHtmlString());
  191. }
  192. /// <summary>
  193. ///
  194. /// </summary>
  195. /// <param name="bindType"></param>
  196. /// <param name="menuNo"></param>
  197. /// <returns></returns>
  198. [HttpPost]
  199. public ActionResult BatchUpdateDropDown(DropdownListBindType? bindType, string menuNo)
  200. {
  201. List<DropdownListItem> listdl = new List<DropdownListItem>();
  202. string columnName = string.Empty;
  203. var listAttribute = BatchModifyServices.GetBatchModifyList(menuNo);
  204. foreach (var item in listAttribute)
  205. {
  206. DropdownListItem ddl = new DropdownListItem { Text = item.Name, Value = item.ToJson() };
  207. listdl.Add(ddl);
  208. }
  209. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  210. DropdownList.FormatDropdownItemList(dbt, listdl);
  211. return base.Json(listdl);
  212. }
  213. /// <summary>
  214. ///
  215. /// </summary>
  216. /// <param name="msg"></param>
  217. /// <param name="url"></param>
  218. /// <param name="windowId"></param>
  219. /// <returns></returns>
  220. public ActionResult MsgShow(string msg, string url, string windowId = "")
  221. {
  222. ViewBag.msg = msg;
  223. ViewBag.url = url;
  224. ViewBag.WindowID = string.IsNullOrEmpty(windowId) ? Request["WindowID"] : windowId;
  225. return View();
  226. }
  227. /// <summary>
  228. ///
  229. /// </summary>
  230. /// <param name="msg"></param>
  231. /// <returns></returns>
  232. public ActionResult Messager(string msg)
  233. {
  234. ViewBag.msg = msg;
  235. return View();
  236. }
  237. /// <summary>
  238. /// 弹出提示并关闭上级弹窗
  239. /// </summary>
  240. /// <param name="msg"></param>
  241. /// <param name="WindowID"></param>
  242. /// <returns></returns>
  243. public ActionResult MsgShowAndClose(string msg, string WindowID)
  244. {
  245. ViewBag.msg = msg;
  246. ViewBag.WindowID = string.IsNullOrEmpty(WindowID) ? Request["WindowID"] : WindowID;
  247. return View();
  248. }
  249. /// <summary>
  250. /// 弹出提示并打开原先弹窗
  251. /// </summary>
  252. /// <param name="msg"></param>
  253. /// <param name="WindowID"></param>
  254. /// <returns></returns>
  255. public ActionResult MsgShowAndOpen(string msg, string WindowID)
  256. {
  257. ViewBag.msg = msg;
  258. ViewBag.WindowID = string.IsNullOrEmpty(WindowID) ? Request["WindowID"] : WindowID;
  259. return View();
  260. }
  261. /// <summary>
  262. /// 弹出提示并打开原先弹窗
  263. /// </summary>
  264. /// <param name="msg"></param>
  265. /// <param name="url"></param>
  266. /// <param name="WindowID"></param>
  267. /// <returns></returns>
  268. public ActionResult MsgShowAndOpenAddUrl(string msg, string url, string WindowID)
  269. {
  270. ViewBag.msg = msg;
  271. ViewBag.WindowID = string.IsNullOrEmpty(WindowID) ? Request["WindowID"] : WindowID;
  272. ViewBag.url = url;
  273. return View();
  274. }
  275. /// <summary>
  276. /// 批量修改
  277. /// </summary>
  278. /// <returns></returns>
  279. [HttpPost]
  280. public ActionResult BatchModify()
  281. {
  282. string batchModifyName = Request["DropdownBatchModify"];
  283. var BatchModify = batchModifyName.JsonToObject<Sys_BatchModify>();
  284. string batchModifyValue = string.Empty;
  285. string hidBatchModify = Request["PL_hiddenBatchModify"];
  286. try
  287. {
  288. if (BatchModify.ControlType == "TextBox")
  289. batchModifyValue = Request[BatchModify.Value + "_TextBox"];
  290. else if (BatchModify.ControlType == "DropdownList")
  291. batchModifyValue = Request[BatchModify.Value + "_DropdownList"];
  292. else if (BatchModify.ControlType == "DictionaryDropDownList")
  293. batchModifyValue = Request[BatchModify.Value + "_DictionaryDropDownList"];
  294. else if (BatchModify.ControlType == "CheckBox")
  295. batchModifyValue = Request[BatchModify.Value + "_CheckBox"].Split(',').Length > 1 ? Request[BatchModify.Value + "_CheckBox"].Split(',')[0] : Request[BatchModify.Value + "_CheckBox"];
  296. else if (BatchModify.ControlType == "ComboGrid")
  297. batchModifyValue = Request[BatchModify.Value + "_ComboGrid"];
  298. else if (BatchModify.ControlType == "TextBoxDate")
  299. batchModifyValue = Request[BatchModify.Value + "_TextBoxDate"];
  300. else if (BatchModify.ControlType == "TextBoxDateTime")
  301. batchModifyValue = Request[BatchModify.Value + "_TextBoxDateTime"];
  302. else if (BatchModify.ControlType == "NumberBox")
  303. batchModifyValue = Request[BatchModify.Value + "_NumberBox"];
  304. if (BatchModify.ControlType != "TextBox")
  305. {
  306. if (batchModifyValue == "")
  307. {
  308. batchModifyValue = null;
  309. }
  310. else if (BatchModify.ControlType == "DropdownList" || BatchModify.ControlType == "DictionaryDropDownList")
  311. {
  312. if (batchModifyValue == DropdownList.PLEASE_SELECT.ToString())
  313. {
  314. batchModifyValue = null;
  315. }
  316. }
  317. }
  318. //获取修改的ID 转换成数组
  319. List<Guid> listID = new List<Guid>();
  320. for (int i = 0; i < hidBatchModify.Split(',').Length; i++)
  321. {
  322. string batchmodify = hidBatchModify.Split(',')[i];
  323. if (!string.IsNullOrEmpty(batchmodify))
  324. {
  325. listID.Add(new Guid(batchmodify));
  326. }
  327. }
  328. //List<string> funcationstringlist = BatchModifyServices.GetBatchModifyEvents(BatchModify.MNUID, BatchModify.MUNClass, BatchModify.Value);
  329. BatchModifyServices.BatchUpdate(BatchModify.MNUID, BatchModify.MUNClass, BatchModify.Value, (object)batchModifyValue, listID);
  330. return Json(new ReturnMessage { IsSuccess = true, Message = "批量修改成功。" });
  331. //return RedirectToAction("MsgShow", "Common", new
  332. //{
  333. // WindowID = "none",
  334. // msg = "批量修改成功。",
  335. // url = Url.Content(BatchModify.ReturnUrl).AddMenuParameter()
  336. //});
  337. }
  338. catch (Exception ex)
  339. {
  340. return Json(new ReturnMessage { IsSuccess = false, Message = "批量修改失败,原因:" + ex.Message });
  341. //return RedirectToAction("MsgShow", "Common", new
  342. //{
  343. // WindowID = "none",
  344. // msg = "批量修改失败,原因:" + ex.Message,
  345. // url = Url.Content(BatchModify.ReturnUrl).AddMenuParameter()
  346. //});
  347. }
  348. }
  349. public ActionResult UserRole(Guid userID)
  350. {
  351. return View();
  352. }
  353. public ActionResult RoleSelector()
  354. {
  355. return View();
  356. }
  357. public ActionResult CollegeSelector()
  358. {
  359. return View();
  360. }
  361. public ActionResult DepartmentSelector()
  362. {
  363. return View();
  364. }
  365. public ActionResult Uploader(string n, Guid? v, int? t, int? m)
  366. {
  367. string sessionCookieName = Const.LOCAL_SETTING_LOGIN_COOKIENAME;
  368. if (Request.Cookies[sessionCookieName] != null)
  369. ViewBag.hfcookieName = Request.Cookies[sessionCookieName].Value;
  370. if (v.HasValue)
  371. {
  372. ViewBag.name = n;
  373. ViewBag.value = v;
  374. ViewBag.type = t;
  375. ViewBag.maxSize = m;
  376. }
  377. return View();
  378. }
  379. public ActionResult UploaderInit(Guid? id, string n)
  380. {
  381. Response.Cache.SetNoStore();
  382. List<FileUploadView> result = new List<FileUploadView>();
  383. string sessionName = FileUploadHelper.GetFileUploadSessionName(id.Value);
  384. if (Session[sessionName] == null)
  385. {
  386. Session[sessionName] = new List<FileUploadView>();
  387. }
  388. using (var scope = AutofacHelper.RequestLifetimeScope.BeginLifetimeScope())
  389. {
  390. IFileUploadServices uploadService = scope.ResolveNamed<IFileUploadServices>(n);
  391. result = uploadService.GetFileList(id);
  392. Session[sessionName] = result;
  393. }
  394. return Json(result, JsonRequestBehavior.AllowGet);
  395. }
  396. public ActionResult UploaderSave(FormCollection form)
  397. {
  398. Response.Cache.SetNoStore();
  399. try
  400. {
  401. FileUploadView upfile = new FileUploadView();
  402. var files = Request.Files;
  403. var formID = (!string.IsNullOrEmpty(Request["v"])) ? new Guid(Request["v"]) : (Guid?)null;
  404. string sessionName = FileUploadHelper.GetFileUploadSessionName(formID.Value);
  405. //检查文件扩展名字
  406. var postedFile = files["Filedata"]; //得到要上传文件
  407. if (postedFile.FileName == null)
  408. {
  409. return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
  410. }
  411. var accepts = new List<string> { ".rar", ".doc", ".docx", ".xls", ".xlsx", ".zip", ".pdf", ".txt", ".swf", ".wmv", ".jpg", ".jpeg", ".png", ".bmp" };
  412. if (!string.IsNullOrEmpty(postedFile.FileName) && !accepts.Contains(Path.GetExtension(postedFile.FileName).ToLower()))
  413. {
  414. throw new Exception("不允许的文件类型。");
  415. }
  416. upfile.FileID = Function.NewPKGuid();
  417. string fileUrl = FileUploadHelper.UploadFile(postedFile);
  418. upfile.FileUrl = fileUrl;
  419. upfile.FileName = postedFile.FileName;
  420. upfile.FormID = formID;
  421. if (Session[sessionName] == null)
  422. {
  423. Session[sessionName] = new List<FileUploadView>();
  424. }
  425. ((List<FileUploadView>)Session[sessionName]).Add(upfile);
  426. return Json(upfile, JsonRequestBehavior.AllowGet);
  427. }
  428. catch (Exception ex)
  429. {
  430. //throw ex;
  431. return Json(new ReturnMessage { IsSuccess = false, Message = ex.Message });
  432. }
  433. //return Json(new FileUploadView(), JsonRequestBehavior.AllowGet);
  434. }
  435. public ActionResult UploaderDel(Guid? id, Guid? fileid)
  436. {
  437. string result = "";
  438. if (id.HasValue)
  439. {
  440. List<FileUploadView> fileList = new List<FileUploadView>();
  441. string sessionName = FileUploadHelper.GetFileUploadSessionName(id.Value);
  442. if (Session[sessionName] == null)
  443. {
  444. Session[sessionName] = new List<FileUploadView>();
  445. }
  446. fileList = (List<FileUploadView>)Session[sessionName];
  447. var file = fileList.Where(x => x.FileID == fileid).FirstOrDefault();
  448. if (file != null)
  449. {
  450. fileList.Remove(file);
  451. FileUploadHelper.DeleteFile(file.FileUrl);
  452. }
  453. else
  454. {
  455. result = "删除文件失败!";
  456. }
  457. }
  458. else
  459. {
  460. result = "文件ID为空,删除文件失败!";
  461. }
  462. return Content(result);
  463. }
  464. /// <summary>
  465. ///
  466. /// </summary>
  467. /// <param name="UserID"></param>
  468. /// <param name="Code"></param>
  469. /// <returns></returns>
  470. public ActionResult UserVerify(Guid UserID, string Code)
  471. {
  472. if (MailVerifyServices.Verify(UserID, Code))
  473. {
  474. return View();
  475. }
  476. else
  477. {
  478. return RedirectToAction("MsgShow", "Common", new
  479. {
  480. msg = "邮件连接已失效或不正确,请重新申请。",
  481. url = Url.Content("~/Account/Login")
  482. });
  483. }
  484. }
  485. /// <summary>
  486. ///
  487. /// </summary>
  488. /// <param name="changeView"></param>
  489. /// <returns></returns>
  490. [HttpPost]
  491. public ActionResult UserVerify(ChangePasswordView changeView)
  492. {
  493. var userID = new Guid(Request["UserID"]);
  494. UserServices.ChangePassword(changeView, userID);
  495. return RedirectToAction("MsgShow", "Common", new
  496. {
  497. msg = "密码已经修改,请重新登录验证修改结果。",
  498. url = Url.Content("~/Account/Login")
  499. });
  500. }
  501. /// <summary>
  502. /// 添加教师
  503. /// </summary>
  504. /// <returns></returns>
  505. public ActionResult TeacherSelect()
  506. {
  507. return View();
  508. }
  509. /// <summary>
  510. /// 添加专业
  511. /// </summary>
  512. /// <returns></returns>
  513. public ActionResult SpecialtySelect()
  514. {
  515. return View();
  516. }
  517. /// <summary>
  518. /// 添加班级
  519. /// </summary>
  520. /// <returns></returns>
  521. public ActionResult ClassmajorSelect()
  522. {
  523. ViewBag.GrademajorID = Request.Params["GrademajorID"];
  524. return View();
  525. }
  526. /// <summary>
  527. /// 添加班级
  528. /// </summary>
  529. /// <returns></returns>
  530. public ActionResult ClassmajorViewSelect()
  531. {
  532. ViewBag.CollegeID = Request.Params["CollegeID"];
  533. ViewBag.GradeYearID = Request.Params["GradeYearID"];
  534. ViewBag.StandardID = Request.Params["StandardID"];
  535. return View();
  536. }
  537. /// <summary>
  538. /// 添加学生(学生发放专用)
  539. /// </summary>
  540. /// <returns></returns>
  541. public ActionResult StudentSelect()
  542. {
  543. ViewBag.studentDistributeID = Request.Params["studentDistributeID"];
  544. ViewBag.GrademajorID = Request.Params["GrademajorID"];
  545. return View();
  546. }
  547. /// <summary>
  548. ///
  549. /// </summary>
  550. /// <param name="classmajorID"></param>
  551. /// <param name="educationMissionClassID"></param>
  552. /// <returns></returns>
  553. public ActionResult StudentViewSelect(Guid? classmajorID, Guid? educationMissionClassID)
  554. {
  555. educationMissionClassID = Request["educationMissionClassID"].ParseStrTo<Guid>();
  556. if (classmajorID.HasValue)
  557. {
  558. var classmajor = ClassmajorServices.GetClassmajorView(classmajorID);
  559. ViewBag.ClassmajorID = classmajor.ClassmajorID;
  560. ViewBag.GrademajorID = classmajor.GrademajorID;
  561. ViewBag.CollegeID = classmajor.CollegeID;
  562. }
  563. else if (educationMissionClassID.HasValue)
  564. {
  565. var classmajor = EducationMissionClassServices.GetClassmajorByEducationClassID(educationMissionClassID);
  566. ViewBag.InSchool = 1;
  567. ViewBag.ClassmajorID = classmajor.ClassmajorID;
  568. ViewBag.GrademajorID = classmajor.GrademajorID;
  569. ViewBag.CollegeID = classmajor.CollegeID;
  570. }
  571. else
  572. {
  573. ViewBag.ClassmajorID = "-1";
  574. ViewBag.GrademajorID = "-1";
  575. ViewBag.CollegeID = "-1";
  576. }
  577. return View();
  578. }
  579. /// <summary>
  580. ///
  581. /// </summary>
  582. /// <returns></returns>
  583. public ActionResult ClassroomSelect()
  584. {
  585. return View();
  586. }
  587. /// <summary>
  588. ///
  589. /// </summary>
  590. /// <returns></returns>
  591. public ActionResult CoursematerialSelect()
  592. {
  593. return View();
  594. }
  595. /// <summary>
  596. ///
  597. /// </summary>
  598. /// <returns></returns>
  599. public ActionResult StudentBatchSelect()
  600. {
  601. return View();
  602. }
  603. /// <summary>
  604. ///
  605. /// </summary>
  606. /// <param name="formClass"></param>
  607. /// <param name="mnu"></param>
  608. /// <returns></returns>
  609. [HttpPost]
  610. public JsonResult GetContextMenuList(string formClass, string mnu)
  611. {
  612. var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
  613. //以后好好想想怎么控制按钮
  614. //var controlContextMenuList = ControlItemServices.GetNeedControlContextMenuNo().Where(x => x.MenuNo == mnu).ToList();
  615. var contextMenuList = ContextMenuServices.GetContextMenuListByUserAndRoleID((mnu == "" ? null : mnu), formClass, user.UserID, user.RoleID);
  616. var result = contextMenuList.OrderBy(x => x.SeqNo).Select(x => new
  617. {
  618. Name = x.ContextMnuNo,
  619. Text = x.Title,
  620. Icon = x.IconName,
  621. OnClick = x.Scripts
  622. })
  623. .ToList();
  624. return Json(result, JsonRequestBehavior.AllowGet);
  625. }
  626. /// <summary>
  627. /// 审核历史页面
  628. /// </summary>
  629. /// <returns></returns>
  630. public ActionResult ApproveStatus()
  631. {
  632. return View();
  633. }
  634. /// <summary>
  635. /// 审核历史页面
  636. /// </summary>
  637. /// <param name="pararms"></param>
  638. /// <returns></returns>
  639. [HttpPost]
  640. public ActionResult ApproveStatus(QueryParamsModel pararms)
  641. {
  642. string tableName = pararms.getExtraString("tableName");
  643. Guid formID = pararms.getExtraGuid("formID").Value;
  644. var approveHistoryList = WorkflowServices.GetApproveHistoryViewList(tableName, formID)
  645. .OrderBy(x => x.ApproveTime).ToList();
  646. return Json(new GridResultSet<WorkflowApproveHistoryView> { rows = approveHistoryList.ToList(), total = approveHistoryList.Count });
  647. }
  648. /// <summary>
  649. /// 获取工作流程环节所有状态(根据对应的bindType、tableName)
  650. /// </summary>
  651. /// <param name="bindType"></param>
  652. /// <param name="tableName"></param>
  653. /// <returns></returns>
  654. [HttpPost]
  655. public ActionResult ApproveStatusDropDown(DropdownListBindType? bindType, string tableName)
  656. {
  657. var statusList = WorkflowServices.GetStatusViewList(tableName).OrderBy(x => x.ID)
  658. .Select(x => new DropdownListItem()
  659. {
  660. Text = x.Name,
  661. Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
  662. }).ToList();
  663. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  664. DropdownList.FormatDropdownItemList(dbt, statusList);
  665. return base.Json(statusList);
  666. }
  667. /// <summary>
  668. /// 查询对应的工作流程表中审核流程环节状态(WorkflowStatusView,不包含开始、结束、非正常[BP]结束环节)
  669. /// </summary>
  670. /// <param name="bindType"></param>
  671. /// <param name="tableName"></param>
  672. /// <returns></returns>
  673. [HttpPost]
  674. public ActionResult ApproveStatusNotStartEndDropDown(DropdownListBindType? bindType, string tableName)
  675. {
  676. var statusList = WorkflowServices.GetApproveStatusViewList(tableName).OrderBy(x => x.ID)
  677. .Select(x => new DropdownListItem()
  678. {
  679. Text = x.Name,
  680. Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
  681. }).ToList();
  682. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  683. DropdownList.FormatDropdownItemList(dbt, statusList);
  684. return base.Json(statusList);
  685. }
  686. /// <summary>
  687. /// 查询对应的工作流程表中全部非开始流程环节状态(WorkflowStatusView,不包含开始环节)
  688. /// </summary>
  689. /// <param name="bindType"></param>
  690. /// <param name="tableName"></param>
  691. /// <returns></returns>
  692. [HttpPost]
  693. public ActionResult ApproveStatusNotStartDropDown(DropdownListBindType? bindType, string tableName)
  694. {
  695. var statusList = WorkflowServices.GetNoStartStatusViewList(tableName).OrderBy(x => x.ID)
  696. .Select(x => new DropdownListItem()
  697. {
  698. Text = x.Name,
  699. Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
  700. }).ToList();
  701. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  702. DropdownList.FormatDropdownItemList(dbt, statusList);
  703. return base.Json(statusList);
  704. }
  705. /// <summary>
  706. /// 查询对应的工作流程表中全部非结束流程环节状态(WorkflowStatusView,不包含结束状态)
  707. /// </summary>
  708. /// <param name="bindType"></param>
  709. /// <param name="tableName"></param>
  710. /// <returns></returns>
  711. [HttpPost]
  712. public ActionResult ApproveStatusNoEndDropDown(DropdownListBindType? bindType, string tableName)
  713. {
  714. //结束流程环节ID
  715. var endStatusID = WorkflowServices.GetCorrectEndStatus(tableName);
  716. var statusList = WorkflowServices.GetStatusViewList(tableName).Where(x => x.ID != endStatusID).OrderBy(x => x.ID)
  717. .Select(x => new DropdownListItem()
  718. {
  719. Text = x.Name,
  720. Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
  721. }).ToList();
  722. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  723. DropdownList.FormatDropdownItemList(dbt, statusList);
  724. return base.Json(statusList);
  725. }
  726. /// <summary>
  727. /// 查询对应的工作流程表中全部可提交流程环节状态(WorkflowStatusView,不包含审批、结束、非正常[BP]结束状态)
  728. /// 如:未提交(开始环节)、已退回[BP]状态
  729. /// </summary>
  730. /// <param name="bindType"></param>
  731. /// <param name="tableName"></param>
  732. /// <returns></returns>
  733. [HttpPost]
  734. public ActionResult ApproveStatusApplyDropDown(DropdownListBindType? bindType, string tableName)
  735. {
  736. //结束流程环节ID
  737. var endStatusID = WorkflowServices.GetCorrectEndStatus(tableName);
  738. //审核流程状态IDList
  739. var approveStatusIDList = WorkflowServices.GetApproveStatusViewList(tableName).Select(x => x.ID).ToList();
  740. var statusList = WorkflowServices.GetStatusViewList(tableName).Where(x => x.ID != endStatusID && !approveStatusIDList.Contains(x.ID)).OrderBy(x => x.ID)
  741. .Select(x => new DropdownListItem()
  742. {
  743. Text = x.Name,
  744. Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
  745. }).ToList();
  746. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  747. DropdownList.FormatDropdownItemList(dbt, statusList);
  748. return base.Json(statusList);
  749. }
  750. /// <summary>
  751. /// 查询对应的工作流程表中全部结束流程环节状态
  752. /// </summary>
  753. /// <param name="bindType"></param>
  754. /// <param name="tableName"></param>
  755. /// <returns></returns>
  756. [HttpPost]
  757. public ActionResult ApproveStatusEndDropDown(DropdownListBindType? bindType, string tableName)
  758. {
  759. var statusList = WorkflowServices.GetEndStatusViewList(tableName).OrderBy(x => x.ID)
  760. .Select(x => new DropdownListItem()
  761. {
  762. Text = x.Name,
  763. Value = x.ID.HasValue ? x.ID.Value.ToString() : ""
  764. }).ToList();
  765. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  766. DropdownList.FormatDropdownItemList(dbt, statusList);
  767. return base.Json(statusList);
  768. }
  769. /// <summary>
  770. /// 审批页面
  771. /// </summary>
  772. /// <returns></returns>
  773. public ActionResult ApproveHandler()
  774. {
  775. return View();
  776. }
  777. /// <summary>
  778. /// 流程环节动作
  779. /// </summary>
  780. /// <param name="bindType"></param>
  781. /// <param name="tableName"></param>
  782. /// <param name="formID"></param>
  783. /// <returns></returns>
  784. [HttpPost]
  785. public ActionResult ApproveActionDropDown(DropdownListBindType? bindType, string tableName, Guid formID)
  786. {
  787. var user = HttpContext.User as EMIS.Utility.FormValidate.CustomPrincipal;
  788. List<DropdownListItem> actionList;
  789. try
  790. {
  791. actionList = WorkflowServices.GetActionView(tableName, formID, user.UserID)
  792. .Select(x => new DropdownListItem { Text = x.ActionName, Value = x.ActionID.ToString() }).ToList();
  793. }
  794. catch (Exception)
  795. {
  796. actionList = new List<DropdownListItem>();
  797. }
  798. DropdownListBindType dbt = bindType == null ? DropdownListBindType.SelectAll : bindType.Value;
  799. DropdownList.FormatDropdownItemList(dbt, actionList);
  800. return base.Json(actionList);
  801. }
  802. /// <summary>
  803. ///
  804. /// </summary>
  805. /// <returns></returns>
  806. [AllowAnonymous]
  807. public ActionResult ReportViewer()
  808. {
  809. return View();
  810. }
  811. /// <summary>
  812. ///
  813. /// </summary>
  814. /// <param name="key"></param>
  815. /// <returns></returns>
  816. [AllowAnonymous]
  817. public ActionResult ResImage(string key)
  818. {
  819. var context = this.HttpContext;
  820. var image = RSI.Get(key);
  821. context.Response.Buffer = true;
  822. context.Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
  823. context.Response.Expires = 0;
  824. context.Response.CacheControl = "no-cache";
  825. context.Response.AppendHeader("Pragma", "No-Cache");
  826. image.Save(context.Response.OutputStream, image.RawFormat);
  827. Type imageFormatType = typeof(ImageFormat);
  828. System.Reflection.PropertyInfo[] _ImageFormatList = imageFormatType.GetProperties(BindingFlags.Static | BindingFlags.Public);
  829. for (int i = 0; i != _ImageFormatList.Length; i++)
  830. {
  831. ImageFormat _FormatClass = (ImageFormat)_ImageFormatList[i].GetValue(null, null);
  832. if (_FormatClass.Guid.Equals(image.RawFormat.Guid))
  833. {
  834. context.Response.ContentType = "image/" + _ImageFormatList[i].Name.ToLower();
  835. }
  836. }
  837. context.Response.End();
  838. return new EmptyResult();
  839. }
  840. }
  841. }