|
|
@@ -3,8 +3,6 @@ using System.Data; |
|
|
|
using Learun.Application.TwoDevelopment.LR_Desktop; |
|
|
|
using System.Web.Mvc; |
|
|
|
using System.Collections.Generic; |
|
|
|
using Learun.Application.OA.File.FilePreview; |
|
|
|
using Learun.Application.Base.SystemModule; |
|
|
|
|
|
|
|
namespace Learun.Application.Web.Areas.LR_Desktop.Controllers |
|
|
|
{ |
|
|
@@ -18,8 +16,6 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers |
|
|
|
public class EnrollDataController : MvcControllerBase |
|
|
|
{ |
|
|
|
private EnrollDataIBLL enrollDataIBLL = new EnrollDataBLL(); |
|
|
|
private FilePreviewIBLL filePreviewIBLL = new FilePreviewBLL(); |
|
|
|
private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); |
|
|
|
|
|
|
|
#region 视图功能 |
|
|
|
|
|
|
@@ -30,7 +26,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers |
|
|
|
[HttpGet] |
|
|
|
public ActionResult Index() |
|
|
|
{ |
|
|
|
return View(); |
|
|
|
return View(); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 表单页 |
|
|
@@ -39,18 +35,8 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers |
|
|
|
[HttpGet] |
|
|
|
public ActionResult Form() |
|
|
|
{ |
|
|
|
return View(); |
|
|
|
return View(); |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// |
|
|
|
/// <summary> |
|
|
|
/// <returns></returns> |
|
|
|
[HttpGet] |
|
|
|
public ActionResult IndexPersonnel() |
|
|
|
{ |
|
|
|
return View(); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 获取数据 |
|
|
@@ -85,9 +71,8 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers |
|
|
|
[AjaxOnly] |
|
|
|
public ActionResult GetFormData(string keyValue) |
|
|
|
{ |
|
|
|
var EnrollDataData = enrollDataIBLL.GetEnrollDataEntity(keyValue); |
|
|
|
var jsonData = new |
|
|
|
{ |
|
|
|
var EnrollDataData = enrollDataIBLL.GetEnrollDataEntity( keyValue ); |
|
|
|
var jsonData = new { |
|
|
|
EnrollData = EnrollDataData, |
|
|
|
}; |
|
|
|
return Success(jsonData); |
|
|
@@ -120,7 +105,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers |
|
|
|
public ActionResult SaveForm(string keyValue, string strEntity) |
|
|
|
{ |
|
|
|
EnrollDataEntity entity = strEntity.ToObject<EnrollDataEntity>(); |
|
|
|
enrollDataIBLL.SaveEntity(keyValue, entity); |
|
|
|
enrollDataIBLL.SaveEntity(keyValue,entity); |
|
|
|
if (string.IsNullOrEmpty(keyValue)) |
|
|
|
{ |
|
|
|
} |
|
|
@@ -128,127 +113,5 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
#region MyRegion |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 下载文件 |
|
|
|
/// </summary> |
|
|
|
/// <param name="keyValue">主键</param> |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost] |
|
|
|
public void DownloadFile(string folderid) |
|
|
|
{ |
|
|
|
var data = annexesFileIBLL.GetEntityByFolderId(folderid); |
|
|
|
string filename = Server.UrlDecode(data.F_FileName);//返回客户端文件名称 |
|
|
|
string filepath = data.F_FilePath;//this.Server.MapPath(data.F_FilePath); |
|
|
|
if (FileDownHelper.FileExists(filepath)) |
|
|
|
{ |
|
|
|
FileDownHelper.DownLoadold(filepath, filename); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 文件预览 |
|
|
|
/// </summary> |
|
|
|
/// <param name="fileId">文件ID</param> |
|
|
|
/// <returns></returns> |
|
|
|
public void PreviewFile(string folderid) |
|
|
|
{ |
|
|
|
var data = annexesFileIBLL.GetEntityByFolderId(folderid); |
|
|
|
if (data == null) |
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
string filename = Server.UrlDecode(data.F_FileName);//客户端保存的文件名 |
|
|
|
string filepath = data.F_FilePath;// DirFileHelper.GetAbsolutePath(data.F_FilePath);//路径 |
|
|
|
if (data.F_FileType == "xlsx" || data.F_FileType == "xls") |
|
|
|
{ |
|
|
|
filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 |
|
|
|
if (!DirFileHelper.IsExistFile(filepath)) |
|
|
|
{ |
|
|
|
filePreviewIBLL.GetExcelData(DirFileHelper.GetAbsolutePath(data.F_FilePath)); |
|
|
|
} |
|
|
|
} |
|
|
|
if (data.F_FileType == "docx" || data.F_FileType == "doc") |
|
|
|
{ |
|
|
|
filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 |
|
|
|
if (!DirFileHelper.IsExistFile(filepath)) |
|
|
|
{ |
|
|
|
filePreviewIBLL.GetWordData(DirFileHelper.GetAbsolutePath(data.F_FilePath)); |
|
|
|
} |
|
|
|
} |
|
|
|
if (data.F_FileType == "ppt" || data.F_FileType == "pptx") |
|
|
|
{ |
|
|
|
filepath = filepath.Substring(0, filepath.LastIndexOf(".")) + ".pdf";//文件名 |
|
|
|
if (!DirFileHelper.IsExistFile(filepath)) |
|
|
|
{ |
|
|
|
filePreviewIBLL.GetPptData(DirFileHelper.GetAbsolutePath(data.F_FilePath)); |
|
|
|
} |
|
|
|
} |
|
|
|
//FileDownHelper.DownLoadold(filepath, filename); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//FileStream files = new FileStream(filepath, FileMode.Open); |
|
|
|
//byte[] fileByte = new byte[files.Length]; |
|
|
|
//files.Read(fileByte, 0, fileByte.Length); |
|
|
|
//files.Close(); |
|
|
|
//System.IO.MemoryStream ms = new MemoryStream(fileByte, 0, fileByte.Length); |
|
|
|
Response.ClearContent(); |
|
|
|
switch (data.F_FileType) |
|
|
|
{ |
|
|
|
case "jpg": |
|
|
|
Response.ContentType = "image/jpeg"; |
|
|
|
break; |
|
|
|
case "gif": |
|
|
|
Response.ContentType = "image/gif"; |
|
|
|
break; |
|
|
|
case "png": |
|
|
|
Response.ContentType = "image/png"; |
|
|
|
break; |
|
|
|
case "bmp": |
|
|
|
Response.ContentType = "application/x-bmp"; |
|
|
|
break; |
|
|
|
case "jpeg": |
|
|
|
Response.ContentType = "image/jpeg"; |
|
|
|
break; |
|
|
|
case "doc": |
|
|
|
Response.ContentType = "application/pdf"; |
|
|
|
break; |
|
|
|
case "docx": |
|
|
|
Response.ContentType = "application/pdf"; |
|
|
|
break; |
|
|
|
case "ppt": |
|
|
|
Response.ContentType = "application/x-ppt"; |
|
|
|
break; |
|
|
|
case "pptx": |
|
|
|
Response.ContentType = "application/x-ppt"; |
|
|
|
break; |
|
|
|
case "xls": |
|
|
|
Response.ContentType = "application/pdf"; |
|
|
|
break; |
|
|
|
case "xlsx": |
|
|
|
Response.ContentType = "application/pdf"; |
|
|
|
break; |
|
|
|
case "pdf": |
|
|
|
Response.ContentType = "application/pdf"; |
|
|
|
break; |
|
|
|
case "txt": |
|
|
|
Response.ContentType = "text/plain"; |
|
|
|
break; |
|
|
|
case "csv": |
|
|
|
Response.ContentType = ""; |
|
|
|
break; |
|
|
|
default: |
|
|
|
Response.ContentType = "application/pdf"; |
|
|
|
break; |
|
|
|
} |
|
|
|
Response.Charset = "GB2312"; |
|
|
|
Response.WriteFile(filepath); |
|
|
|
//Response.BinaryWrite(ms.ToArray()); |
|
|
|
} |
|
|
|
|
|
|
|
#endregion |
|
|
|
|
|
|
|
} |
|
|
|
} |