123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- using EMIS.ViewModel;
- using EMIS.Web.Controls;
- using Bowin.Web.Controls.Mvc;
- using EMIS.CommonLogic.SupervisionManage;
- using EMIS.Utility.FormValidate;
- using EMIS.ViewModel.SupervisionManage;
- using EMIS.Utility;
- namespace EMIS.Web.Controllers.SupervisionManage
- {
- [Authorization]
- public class SupDocumentController : Controller
- {
- //
- // GET: /SupDocument/
- public ISupDocumentServices supDocumentServices { get; set; }
- public ActionResult List()
- {
- return View();
- }
- [HttpPost]
- public ActionResult List(QueryParamsModel pararms)
- {
- ConfiguretView configuretView = ConfiguretExtensions.GetConfiguretermsView(pararms);
- var collegeID = pararms.getExtraGuid("cgbCreateCollege");
- var documentType = pararms.getExtraInt("DocumentType") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("DocumentType");
- return base.Json(supDocumentServices.GetSupDocumentViewGrid(configuretView, documentType, collegeID, (int)pararms.page, (int)pararms.rows));
- }
- public ActionResult Edit(Guid? documentID)
- {
- var supDocumentView = new SupDocumentView();
- if (documentID.HasValue)
- {
- supDocumentView = supDocumentServices.GetSupDocumentView(documentID.Value);
- }
- else
- {
- supDocumentView.DocumentID = Guid.NewGuid();
- }
- return View(supDocumentView);
- }
- [HttpPost]
- public ActionResult Edit(SupDocumentView supDocumentView)
- {
- var sessionName = FileUploadHelper.GetFileUploadSessionName(supDocumentView.DocumentID);
- var fileList = (List<FileUploadView>)Session[sessionName];
- try
- {
- supDocumentServices.Save(supDocumentView, fileList);
- return Json(new ReturnMessage()
- {
- IsSuccess = true,
- Message = "保存成功。"
- });
- }
- catch (Exception ex)
- {
- return Json(new ReturnMessage()
- {
- IsSuccess = false,
- Message = "保存失败:" + ex.Message
- });
- }
- }
- [HttpPost]
- public ActionResult Delete(string documentIDs)
- {
- try
- {
- var documentIDList = documentIDs.Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => (Guid?)new Guid(x)).ToList();
- supDocumentServices.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 Download(Guid? documentID)
- {
- //List<FileUploadView> filelist = new List<FileUploadView>();
- var file = supDocumentServices.GetFileUploadViewByDocumentID(documentID);
- FileUploadHelper.RemoteFileInfo fileInfo = new FileUploadHelper.RemoteFileInfo();
- if (file != null)
- {
- fileInfo.FileName = file.FileName;
- fileInfo.RemotePath = (file.FileUrl.Trim().StartsWith("http://") ? file.FileUrl.Trim() : Url.Content(file.FileUrl.Trim()));
- }
- return base.Json(fileInfo);
- }
- }
- }
|