Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

110 rader
3.3 KiB

  1. using Learun.Application.Base.SystemModule;
  2. using Learun.Application.TwoDevelopment.EducationalAdministration;
  3. using Learun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers
  10. {
  11. public class EmpInfoEnternalController : Controller
  12. {
  13. // GET: EducationalAdministration/EmpInfoEnternal
  14. DataSourceIBLL dataSourceIBLL = new DataSourceBLL();
  15. EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
  16. AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL();
  17. public ActionResult FormAdd()
  18. {
  19. return View();
  20. }
  21. /// <summary>
  22. /// 获取数据源数据
  23. /// </summary>
  24. /// <param name="code">数据源编号</param>
  25. /// <param name="strWhere">sql查询条件语句</param>
  26. /// <param name="queryJson">数据源请求条件字串</param>
  27. /// <returns></returns>
  28. [HttpGet]
  29. [AjaxOnly]
  30. public ActionResult GetMap(string code, string ver, string where)
  31. {
  32. var data = dataSourceIBLL.GetDataTable(code, where);
  33. string md5 = Md5Helper.Encrypt(data.ToJson(), 32);
  34. if (md5 == ver)
  35. {
  36. return Success("no update");
  37. }
  38. else
  39. {
  40. var jsondata = new
  41. {
  42. data = data,
  43. ver = md5
  44. };
  45. return JsonResult(jsondata);
  46. }
  47. }
  48. public ActionResult UploadImg(HttpPostedFileBase Filedata)
  49. {
  50. //没有文件上传,直接返回
  51. if (Filedata == null || string.IsNullOrEmpty(Filedata.FileName) || Filedata.ContentLength == 0)
  52. {
  53. if (Request.Files.Count > 0)
  54. {
  55. return Success(new { folderId = annexesFileIBLL.SaveAnnexesInfo(Request.Files[0]) });
  56. }
  57. else
  58. {
  59. return HttpNotFound();
  60. }
  61. }
  62. return Success("保存成功");
  63. }
  64. protected virtual ActionResult Success(string info)
  65. {
  66. return Content(new ResParameter { code = ResponseCode.success, info = info, data = new object { } }.ToJson());
  67. }
  68. protected virtual ActionResult Success(object data)
  69. {
  70. return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
  71. }
  72. protected virtual ActionResult JsonResult(object data)
  73. {
  74. return Content(new ResParameter { code = ResponseCode.success, info = "响应成功", data = data }.ToJson());
  75. }
  76. /// <summary>
  77. /// 保存实体数据(新增、修改)
  78. /// <param name="keyValue">主键</param>
  79. /// <summary>
  80. /// <returns></returns>
  81. [HttpPost]
  82. [AjaxOnly]
  83. public ActionResult SaveForm(string keyValue, string strEntity)
  84. {
  85. EmpInfoEntity entity = strEntity.ToObject<EmpInfoEntity>();
  86. entity.EmpId = Guid.NewGuid().ToString();
  87. empInfoIBLL.SaveEntity(keyValue, entity);
  88. return Success("保存成功!");
  89. }
  90. }
  91. }