SOCDocController.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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.DQPSystem;
  8. using EMIS.ViewModel;
  9. using EMIS.Web.Controls;
  10. using Bowin.Web.Controls.Mvc;
  11. using EMIS.Entities;
  12. using EMIS.Utility.FormValidate;
  13. namespace EMIS.Web.Controllers.DQPSystem
  14. {
  15. [Authorization]
  16. public class SOCDocController : Controller
  17. {
  18. public ISOCDocServices SOCDocServices { get; set; }
  19. public ActionResult DispPOC()
  20. {
  21. return View();
  22. }
  23. public ActionResult AdminList()
  24. {
  25. return View();
  26. }
  27. public ActionResult UserList()
  28. {
  29. return View();
  30. }
  31. public ActionResult Edit(Guid? documentID)
  32. {
  33. var documentView = new SOCDocView();
  34. if (documentID.HasValue)
  35. {
  36. documentView = this.SOCDocServices.GetSOCDocView(documentID.Value);
  37. }
  38. else
  39. {
  40. documentView.IsShow = true;
  41. }
  42. return View(documentView);
  43. }
  44. public ActionResult View(Guid documentID)
  45. {
  46. var documentView = this.SOCDocServices.GetSOCDocView(documentID);
  47. return View(documentView);
  48. }
  49. [HttpPost]
  50. public ActionResult AdminList(QueryParamsModel pararms)
  51. {
  52. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  53. var socDocTypeID = pararms.getExtraInt("ddlSOCDocType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSOCDocType");
  54. var collegeID = pararms.getExtraGuid("cgbCreateCollege");
  55. var targetRoleID = pararms.getExtraGuid("cbgRole");
  56. var targetCollegeID = pararms.getExtraGuid("cgbTargetCollege");
  57. return base.Json(SOCDocServices.GetSOCDocViewList(configuretView, socDocTypeID, collegeID, targetRoleID, targetCollegeID, (int)pararms.page, (int)pararms.rows));
  58. }
  59. [HttpPost]
  60. public ActionResult Delete(string documentIDs)
  61. {
  62. try
  63. {
  64. var documentIDList = documentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
  65. SOCDocServices.Delete(documentIDList);
  66. return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" });
  67. }
  68. catch (Exception ex)
  69. {
  70. return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message + "!" });
  71. }
  72. }
  73. [HttpPost]
  74. public ActionResult Edit(SOCDocView docView)
  75. {
  76. try
  77. {
  78. var roleList = DataGrid.GetTableData<Sys_Role>("dgRoleList");
  79. var departmentList = DataGrid.GetTableData<CF_Department>("dgDepartmentList");
  80. docView.Content = HttpContext.Server.HtmlDecode(docView.Content);
  81. SOCDocServices.Save(docView, roleList.Select(x => (Guid?)x.RoleID).ToList(), departmentList.Select(x => (Guid?)x.DepartmentID).ToList());
  82. return Json(new ReturnMessage()
  83. {
  84. IsSuccess = true,
  85. Message = "保存成功。"
  86. });
  87. }
  88. catch (Exception ex)
  89. {
  90. return Json(new ReturnMessage()
  91. {
  92. IsSuccess = false,
  93. Message = "保存失败:" + ex.Message
  94. });
  95. }
  96. }
  97. [HttpPost]
  98. public ActionResult UserList(QueryParamsModel pararms)
  99. {
  100. var roleID = CustomPrincipal.Current.RoleID;
  101. ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
  102. var socDocTypeID = pararms.getExtraInt("ddlSOCDocType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSOCDocType");
  103. var collegeID = pararms.getExtraGuid("cgbCreateCollege");
  104. var targetRoleID = pararms.getExtraGuid("cbgRole");
  105. var targetCollegeID = pararms.getExtraGuid("cgbTargetCollege");
  106. return base.Json(SOCDocServices.GetUserSOCDocViewList(configuretView, roleID ?? Guid.Empty, socDocTypeID, collegeID, targetRoleID, targetCollegeID, (int)pararms.page, (int)pararms.rows));
  107. }
  108. }
  109. }