NBCommandHisController.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using LeaRun.Data;
  7. using System.Data;
  8. using Newtonsoft.Json;
  9. using LeaRun.Util.WebControl;
  10. using LeaRun.Util;
  11. namespace LeaRun.Application.Web.Areas.NBManage.Controllers
  12. {
  13. public class NBCommandHisController : Controller
  14. {
  15. SqlHelper helper = new SqlHelper("NBDB");
  16. //
  17. // GET: /NBManage/NBCommandHis/
  18. public ActionResult Index(string id, string cmdType)
  19. {
  20. ViewBag.id = id;
  21. ViewBag.cmdType = cmdType;
  22. return View();
  23. }
  24. public ActionResult GetCmdHis(string id, string cmdType, Pagination pagination)
  25. {
  26. string selSql = "select * from dbo.RMRS_SendCmdRecord where MeterId = " + id + " and CmdType = " + cmdType ;
  27. var watch = CommonHelper.TimerStart();
  28. //DataTable dtResult = helper.ExecuteDataTable(selSql, CommandType.Text, null);
  29. int total = pagination.records;
  30. DataTable dtResult = helper.ExecuteDataTable(selSql, "RecvTime", false, pagination.rows, pagination.page, out total, null);
  31. pagination.records = total;
  32. var JsonData = new
  33. {
  34. rows = dtResult,
  35. total = pagination.total,
  36. page = pagination.page,
  37. records = pagination.records,
  38. costtime = CommonHelper.TimerEnd(watch)
  39. };
  40. return Content(JsonData.ToJson());
  41. }
  42. }
  43. }