using System; using Learun.Util; using System.Data; using Learun.Application.TwoDevelopment.EducationalAdministration; using System.Web.Mvc; using System.Collections.Generic; using System.Linq; using System.Web; using Learun.Application.Web.Controllers; namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { /// /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 /// Copyright (c) 2013-2018 北京泉江科技有限公司 /// 创 建:超级管理员 /// 日 期:2019-04-11 10:31 /// 描 述:公文发送 /// public class Sys_SendFileController : MvcControllerBase { private Sys_SendFileIBLL sys_SendFileIBLL = new Sys_SendFileBLL(); #region 视图功能 /// /// 主页面 /// /// [HttpGet] public ActionResult Index() { return View(); } /// /// 行政公文归档 /// /// [HttpGet] public ActionResult IndexFile() { return View(); } /// /// 党政公文归档 /// /// [HttpGet] public ActionResult IndexPartyFile() { return View(); } [HttpGet] public ActionResult IndexDocument() { return View(); } /// /// 公文下发表单页 /// /// [HttpGet] public ActionResult IssueForm() { return View(); } /// /// 主页面【党政公文下发】 /// /// [HttpGet] public ActionResult IndexParty() { return View(); } [HttpGet] public ActionResult FormDocument() { return View(); } /// /// 表单页 /// /// [HttpGet] public ActionResult Form() { return View(); } /// /// 表单页【党政公文下发】 /// /// [HttpGet] public ActionResult FormParty() { return View(); } [HttpGet] public ActionResult FormView() { return View(); } [HttpGet] public ActionResult FormDocumentView() { return View(); } /// /// 【党政公文下发】 /// /// [HttpGet] public ActionResult FormPartyView() { return View(); } [HttpGet] public ActionResult ReadList() { return View(); } [HttpGet] public ActionResult ReadListDocument() { return View(); } /// /// 【党政公文下发】 /// /// [HttpGet] public ActionResult ReadListParty() { return View(); } #endregion #region 获取数据 /// /// 获取页面显示列表数据 /// /// 查询参数 /// [HttpGet] [AjaxOnly] public ActionResult GetPageList(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = sys_SendFileIBLL.GetPageList(paginationobj, queryJson).Where(m => m.STypeId == 1); foreach (var item in data) { var sql = $"SELECT COUNT(*) FROM dbo.Sys_ReceiveFile where ReadFlag=1 AND SFileId='{item.SFileId}'"; var sendSql = $"SELECT COUNT(*) FROM dbo.Sys_ReceiveFile where SFileId='{item.SFileId}'"; var readdt = sys_SendFileIBLL.Execute(sql); var senddt = sys_SendFileIBLL.Execute(sendSql); var readcount = readdt.Rows[0][0]; var sendcount = senddt.Rows[0][0]; item.NumberPeople = $"{readcount}/{sendcount}"; } var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } [HttpGet] [AjaxOnly] public ActionResult GetPageListDocument(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = sys_SendFileIBLL.GetPageList(paginationobj, queryJson).Where(m => m.STypeId == 2); var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } [HttpGet] [AjaxOnly] public ActionResult GetPageListParty(string pagination, string queryJson) { Pagination paginationobj = pagination.ToObject(); var data = sys_SendFileIBLL.GetPageList(paginationobj, queryJson).Where(m => m.STypeId == 3); foreach (var item in data) { var sql = $"SELECT COUNT(*) FROM dbo.Sys_ReceiveFile where ReadFlag=1 AND SFileId='{item.SFileId}'"; var sendSql = $"SELECT COUNT(*) FROM dbo.Sys_ReceiveFile where SFileId='{item.SFileId}'"; var readdt = sys_SendFileIBLL.Execute(sql); var senddt = sys_SendFileIBLL.Execute(sendSql); var readcount = readdt.Rows[0][0]; var sendcount = senddt.Rows[0][0]; item.NumberPeople = $"{readcount}/{sendcount}"; } var jsonData = new { rows = data, total = paginationobj.total, page = paginationobj.page, records = paginationobj.records }; return Success(jsonData); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormData(string keyValue) { var Sys_SendFileData = sys_SendFileIBLL.GetSys_SendFileEntity(keyValue); Sys_SendFileData.Contents = HttpUtility.HtmlDecode(Sys_SendFileData.Contents); var jsonData = new { Sys_SendFile = Sys_SendFileData, }; return Success(jsonData); } [HttpGet] [AjaxOnly] public ActionResult GetFormDataView(string keyValue) { var Sys_SendFileData = sys_SendFileIBLL.GetSys_SendFileEntity(keyValue); Sys_SendFileData.Contents = HttpUtility.HtmlDecode(Sys_SendFileData.Contents); var jsonData = new { Sys_SendFile = Sys_SendFileData, }; return Success(jsonData); } /// /// 获取表单数据 /// /// [HttpGet] [AjaxOnly] public ActionResult GetFormDataByProcessId(string processId) { var Sys_SendFileData = sys_SendFileIBLL.GetEntityByProcessId(processId); var jsonData = new { Sys_SendFile = Sys_SendFileData, }; return Success(jsonData); } #endregion #region 提交数据 /// /// 删除实体数据 /// 主键 /// /// [HttpPost] [AjaxOnly] public ActionResult DeleteForm(string keyValue) { sys_SendFileIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } /// /// 保存实体数据(新增、修改) /// 主键 /// /// [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] [ValidateInput(false)] public ActionResult SaveForm(string keyValue, string strEntity) { Sys_SendFileEntity entity = strEntity.ToObject(); if (string.IsNullOrEmpty(keyValue)) { entity.STypeId = 1; } sys_SendFileIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] [ValidateInput(false)] public ActionResult SaveFormDocument(string keyValue, string strEntity) { Sys_SendFileEntity entity = strEntity.ToObject(); if (string.IsNullOrEmpty(keyValue)) { entity.STypeId = 2; } sys_SendFileIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] [ValidateInput(false)] public ActionResult SaveFormParty(string keyValue, string strEntity) { Sys_SendFileEntity entity = strEntity.ToObject(); if (string.IsNullOrEmpty(keyValue)) { entity.STypeId = 3; } sys_SendFileIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } /// /// 提交 /// /// /// [HttpPost] [AjaxOnly] public ActionResult ChangeStatusById(string keyValue, string processId) { sys_SendFileIBLL.ChangeStatusById(keyValue, 1, processId); return Success("操作成功!"); } [HttpPost] [AjaxOnly] public ActionResult ChangeStatusByIdDocument(string keyValue) { string guid = Guid.NewGuid().ToString(); sys_SendFileIBLL.ChangeStatusById(keyValue, 2, guid); sys_SendFileIBLL.ChangeStatusByProcessId(guid, 2); return Success("操作成功!"); } /// /// 结束下发 /// /// /// [HttpPost] [AjaxOnly] public ActionResult OverIssue(string keyValue) { string guid = Guid.NewGuid().ToString(); sys_SendFileIBLL.OverIssue(keyValue); return Success("下发成功!"); } /// /// 提交 /// /// /// [HttpPost] [AjaxOnly] public ActionResult IssueList(string keyValue, string CreateUser) { sys_SendFileIBLL.IssueList(keyValue, CreateUser); return Success("操作成功!"); } /// /// 作废 /// /// /// [HttpPost] [AjaxOnly] public ActionResult CancelList(string keyValue) { sys_SendFileIBLL.CancelList(keyValue); return Success("操作成功!"); } #endregion } }