TrailRecordController.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using LeaRun.Application.Busines.CustomerManage;
  2. using LeaRun.Application.Code;
  3. using LeaRun.Application.Entity.CustomerManage;
  4. using LeaRun.Util;
  5. using LeaRun.Util.Extension;
  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.CustomerManage.Controllers
  12. {
  13. /// <summary>
  14. /// 版 本 6.1
  15. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  16. /// 创 建:佘赐雄
  17. /// 日 期:2016-03-32 16:51
  18. /// 描 述:跟进记录
  19. /// </summary>
  20. public class TrailRecordController : MvcControllerBase
  21. {
  22. private TrailRecordBLL chancetrailbll = new TrailRecordBLL();
  23. #region 视图功能
  24. /// <summary>
  25. /// 列表页面
  26. /// </summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. [HandlerAuthorize(PermissionMode.Enforce)]
  30. public ActionResult Index()
  31. {
  32. return View();
  33. }
  34. #endregion
  35. #region 获取数据
  36. /// <summary>
  37. /// 获取列表
  38. /// </summary>
  39. /// <param name="objectId">Id</param>
  40. /// <returns>返回列表Json</returns>
  41. [HttpGet]
  42. public ActionResult GetListJson(string objectId)
  43. {
  44. var data = chancetrailbll.GetList(objectId);
  45. Dictionary<string, string> dictionaryDate = new Dictionary<string, string>();
  46. foreach (TrailRecordEntity item in data)
  47. {
  48. string key = item.CreateDate.ToDate().ToString("yyyy-MM-dd");
  49. string currentTime = DateTime.Now.ToString("yyyy-MM-dd");
  50. if (item.CreateDate.ToDate().ToString("yyyy-MM-dd") == currentTime)
  51. {
  52. key = "今天";
  53. }
  54. if (!dictionaryDate.ContainsKey(key))
  55. {
  56. dictionaryDate.Add(key, item.CreateDate.ToDate().ToString("yyyy-MM-dd"));
  57. }
  58. }
  59. var jsonData = new
  60. {
  61. timeline = dictionaryDate,
  62. rows = data,
  63. };
  64. return ToJsonResult(jsonData);
  65. }
  66. #endregion
  67. #region 提交数据
  68. /// <summary>
  69. /// 保存表单(新增、修改)
  70. /// </summary>
  71. /// <param name="keyValue">主键值</param>
  72. /// <param name="entity">实体对象</param>
  73. /// <returns></returns>
  74. [HttpPost]
  75. [ValidateAntiForgeryToken]
  76. [AjaxOnly]
  77. public ActionResult SaveForm(string keyValue, TrailRecordEntity entity)
  78. {
  79. chancetrailbll.SaveForm(keyValue, entity);
  80. return Success("操作成功。");
  81. }
  82. #endregion
  83. }
  84. }