NBWaterUseAbnormalityController.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using LeaRun.Application.Busines.NBManage;
  2. using LeaRun.Application.Entity.NBManage;
  3. using LeaRun.Util;
  4. using LeaRun.Util.WebControl;
  5. using System;
  6. using System.Collections.Generic;
  7. using System.Data;
  8. using System.Linq;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. namespace LeaRun.Application.Web.Areas.NBManage.Controllers
  12. {
  13. /// <summary>
  14. /// 用量异常
  15. /// </summary>
  16. public class NBWaterUseAbnormalityController : MvcControllerBase
  17. {
  18. NBHistoryBLL historyBLL = new NBHistoryBLL();
  19. public ActionResult Index()
  20. {
  21. return View();
  22. }
  23. #region 获取数据
  24. public ActionResult GetRecordJson(Pagination pagination, string areaId, string thisDate, string lastDate,string moreUsed,string lessUsed)
  25. {
  26. var watch = CommonHelper.TimerStart();
  27. List<NBHistoryEntity> data = new List<NBHistoryEntity>();
  28. try
  29. {
  30. if (!string.IsNullOrEmpty(thisDate) && !string.IsNullOrEmpty(lastDate))
  31. {
  32. data = historyBLL.GetExceptionUse(pagination, thisDate, lastDate,moreUsed,lessUsed,areaId);
  33. var JsonData = new
  34. {
  35. rows = data,
  36. total = pagination.total,
  37. page = pagination.page,
  38. records = pagination.records,
  39. costtime = CommonHelper.TimerEnd(watch)
  40. };
  41. return Content(JsonData.ToJson());
  42. }
  43. else
  44. {
  45. var JsonData = new
  46. {
  47. rows = data,
  48. total = pagination.total,
  49. page = pagination.page,
  50. records = pagination.records,
  51. costtime = CommonHelper.TimerEnd(watch)
  52. };
  53. return Content(JsonData.ToJson());
  54. }
  55. }
  56. catch (Exception ex)
  57. {
  58. var JsonData = new
  59. {
  60. rows = data,
  61. total = pagination.total,
  62. page = pagination.page,
  63. records = pagination.records,
  64. costtime = CommonHelper.TimerEnd(watch)
  65. };
  66. return Content(JsonData.ToJson());
  67. }
  68. }
  69. #endregion
  70. }
  71. }