HistoryController.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using LeaRun.Application.Busines.PipeNetworkManage;
  7. using LeaRun.Util.WebControl;
  8. using LeaRun.Util;
  9. using Newtonsoft.Json;
  10. namespace LeaRun.Application.Web.Areas.PipeNetworkManage.Controllers
  11. {
  12. public class HistoryController : MvcControllerBase
  13. {
  14. private HistoryBLL ipmhistorybll = new HistoryBLL();
  15. #region 视图功能
  16. public ActionResult Index()
  17. {
  18. return View();
  19. }
  20. /// <summary>
  21. /// 表单页面
  22. /// </summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. public ActionResult Form()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 报警
  31. /// </summary>
  32. /// <returns></returns>
  33. [HttpGet]
  34. public ActionResult Alerm()
  35. {
  36. return View();
  37. }
  38. #endregion
  39. #region 获取数据
  40. /// <summary>
  41. /// 单点历史记录
  42. /// </summary>
  43. /// <param name="deviceId"></param>
  44. /// <param name="startT"></param>
  45. /// <param name="endT"></param>
  46. /// <returns></returns>
  47. [HttpGet]
  48. public ActionResult GetListJson(string deviceId, string startT, string endT , Pagination pagination)
  49. {
  50. if (!string.IsNullOrEmpty(deviceId) && !string.IsNullOrEmpty(startT) && !string.IsNullOrEmpty(endT))
  51. {
  52. var data = ipmhistorybll.GetEntityList(deviceId, startT, endT, pagination);
  53. var watch = CommonHelper.TimerStart();
  54. var JsonData = new
  55. {
  56. rows = JsonConvert.DeserializeObject(data),
  57. total = pagination.total,
  58. page = pagination.page,
  59. records = pagination.records,
  60. costtime = CommonHelper.TimerEnd(watch)
  61. };
  62. return Content(JsonData.ToJson());
  63. }
  64. return Content("");
  65. }
  66. #endregion
  67. }
  68. }