using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using EMIS.CommonLogic.DQPSystem; using EMIS.ViewModel.DQPSystem; using EMIS.ViewModel; using EMIS.Web.Controls; using Bowin.Web.Controls.Mvc; using EMIS.Entities; using EMIS.Utility.FormValidate; namespace EMIS.Web.Controllers.DQPSystem { [Authorization] public class SOCDocController : Controller { public ISOCDocServices SOCDocServices { get; set; } public ActionResult DispPOC() { return View(); } public ActionResult AdminList() { return View(); } public ActionResult UserList() { return View(); } public ActionResult Edit(Guid? documentID) { var documentView = new SOCDocView(); if (documentID.HasValue) { documentView = this.SOCDocServices.GetSOCDocView(documentID.Value); } else { documentView.IsShow = true; } return View(documentView); } public ActionResult View(Guid documentID) { var documentView = this.SOCDocServices.GetSOCDocView(documentID); return View(documentView); } [HttpPost] public ActionResult AdminList(QueryParamsModel pararms) { ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var socDocTypeID = pararms.getExtraInt("ddlSOCDocType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSOCDocType"); var collegeID = pararms.getExtraGuid("cgbCreateCollege"); var targetRoleID = pararms.getExtraGuid("cbgRole"); var targetCollegeID = pararms.getExtraGuid("cgbTargetCollege"); return base.Json(SOCDocServices.GetSOCDocViewList(configuretView, socDocTypeID, collegeID, targetRoleID, targetCollegeID, (int)pararms.page, (int)pararms.rows)); } [HttpPost] public ActionResult Delete(string documentIDs) { try { var documentIDList = documentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList(); SOCDocServices.Delete(documentIDList); return base.Json(new ReturnMessage { IsSuccess = true, Message = "删除成功" }); } catch (Exception ex) { return base.Json(new ReturnMessage { IsSuccess = false, Message = "删除失败,原因:" + ex.Message + "!" }); } } [HttpPost] public ActionResult Edit(SOCDocView docView) { try { var roleList = DataGrid.GetTableData("dgRoleList"); var departmentList = DataGrid.GetTableData("dgDepartmentList"); docView.Content = HttpContext.Server.HtmlDecode(docView.Content); SOCDocServices.Save(docView, roleList.Select(x => (Guid?)x.RoleID).ToList(), departmentList.Select(x => (Guid?)x.DepartmentID).ToList()); return Json(new ReturnMessage() { IsSuccess = true, Message = "保存成功。" }); } catch (Exception ex) { return Json(new ReturnMessage() { IsSuccess = false, Message = "保存失败:" + ex.Message }); } } [HttpPost] public ActionResult UserList(QueryParamsModel pararms) { var roleID = CustomPrincipal.Current.RoleID; ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms); var socDocTypeID = pararms.getExtraInt("ddlSOCDocType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSOCDocType"); var collegeID = pararms.getExtraGuid("cgbCreateCollege"); var targetRoleID = pararms.getExtraGuid("cbgRole"); var targetCollegeID = pararms.getExtraGuid("cgbTargetCollege"); return base.Json(SOCDocServices.GetUserSOCDocViewList(configuretView, roleID ?? Guid.Empty, socDocTypeID, collegeID, targetRoleID, targetCollegeID, (int)pararms.page, (int)pararms.rows)); } } }