InstallSurveyController.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using LeaRun.Application.Busines.InstallManage;
  2. using LeaRun.Application.Entity.InstallManage;
  3. using LeaRun.Util;
  4. using LeaRun.Util.WebControl;
  5. using Newtonsoft.Json;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Web;
  10. using System.Web.Mvc;
  11. namespace LeaRun.Application.Web.Areas.InstallManage.Controllers
  12. {
  13. public class InstallSurveyController : MvcControllerBase
  14. {
  15. private InstallApplyBLL InstallApplybll = new InstallApplyBLL();
  16. //
  17. // GET: /InstallManage/InstallSurvey/
  18. public ActionResult Index()
  19. {
  20. return View();
  21. }
  22. public ActionResult Form()
  23. {
  24. return View();
  25. }
  26. #region 获取数据
  27. [HttpGet]
  28. public ActionResult GetListJson(string startTime, string endTime,String type, Pagination pagination)
  29. {
  30. InstallApplyEntity entity = new InstallApplyEntity();
  31. if (type == null)
  32. {
  33. entity.SurveyType = 0;
  34. }
  35. else
  36. {
  37. entity.SurveyType = int.Parse(type);
  38. }
  39. if (!string.IsNullOrEmpty(startTime) && !string.IsNullOrEmpty(endTime))
  40. {
  41. var data = InstallApplybll.getInstallApplyList(startTime, endTime, pagination,entity);
  42. var watch = CommonHelper.TimerStart();
  43. var JsonData = new
  44. {
  45. rows = JsonConvert.DeserializeObject(data),
  46. total = pagination.total,
  47. page = pagination.page,
  48. records = pagination.records,
  49. costtime = CommonHelper.TimerEnd(watch)
  50. };
  51. return Content(JsonData.ToJson());
  52. }
  53. else
  54. {
  55. entity.SurveyType = 0;
  56. var data = InstallApplybll.getInstallApplyList(startTime, endTime, pagination, entity);
  57. var watch = CommonHelper.TimerStart();
  58. var JsonData = new
  59. {
  60. rows = JsonConvert.DeserializeObject(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. return Content("");
  69. }
  70. public ActionResult GetFormJson(String keyValue)
  71. {
  72. var data = InstallApplybll.GetFormJson(keyValue);
  73. return ToJsonResult(data);
  74. }
  75. [HttpPost]
  76. [AjaxOnly]
  77. public ActionResult SaveSurvey(String SurveySugget, int Apply_ID)
  78. {
  79. InstallApplybll.SaveSurvey(SurveySugget, Apply_ID);
  80. return Success("操作成功。");
  81. }
  82. #endregion
  83. }
  84. }