地铁二期项目正式开始

LogActionController.cs 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using Newtonsoft.Json;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Web;
  8. using System.Web.Mvc;
  9. using YTSoft.BaseCallCenter.Model;
  10. using YTSoft.BaseCallCenter.MVCWeb.Models;
  11. /// <summary>
  12. /// 客服快捷回复
  13. /// </summary>
  14. namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
  15. {
  16. public class LogActionController : BaseController
  17. {
  18. BLL.T_Com_LogAction busLogAction = new BLL.T_Com_LogAction();
  19. #region 纯视图
  20. /// <summary>
  21. /// 回复列表
  22. /// </summary>
  23. /// <returns></returns>
  24. public ActionResult GetList()
  25. {
  26. return View();
  27. }
  28. #endregion
  29. //操作记录 敏感信息 主要设置
  30. [ActionName("GetListData")]
  31. public string GetListData( string dateParty, string username,string Table = "", string id = "", int page = 1, int limit = 20,string actionname= "")
  32. {
  33. string strWhere = "";
  34. if (Table == "kf_quick_msgs")
  35. {
  36. strWhere += " 1=1 ";
  37. }
  38. else if (string.IsNullOrEmpty(actionname))
  39. {
  40. strWhere += "TableName!='kf_quick_msgs ' ";
  41. }
  42. else
  43. {
  44. strWhere += string.Format(" convert(nvarchar(1500),ContentNew)='{0}' ", actionname);
  45. }
  46. if (!string.IsNullOrEmpty(Table))
  47. {
  48. strWhere += string.Format(" and TableName = '{0}'", Table);
  49. }
  50. if (!string.IsNullOrEmpty(id))
  51. {
  52. strWhere += string.Format(" and TableId ='{0}'", id);
  53. }
  54. if (!string.IsNullOrEmpty(username)) {
  55. strWhere += string.Format(" and AddUser ='{0}'", username);
  56. }
  57. if (!string.IsNullOrEmpty(dateParty))
  58. {
  59. string startDate = dateParty.Substring(0, 10);
  60. string endDate = dateParty.Substring(12);
  61. strWhere += " and Atime>= '" + startDate + " 00:00:00" + "'";
  62. strWhere += " and Atime<= '" + endDate + " 23:59:59" + "'";
  63. }
  64. DataTable dt = busLogAction.GetListByPage(strWhere, " atime desc ", (page - 1) * limit, page*limit).Tables[0];
  65. int count = busLogAction.GetRecordCount(strWhere);
  66. return Success("成功", dt, count);
  67. }
  68. [ActionName("GetData")]
  69. public string GettData(string id)
  70. {
  71. if (string.IsNullOrEmpty(id))
  72. return Error("请输入ID");
  73. Model.T_Com_LogAction model = busLogAction.GetModel(id);
  74. return Success("成功", model, 1);
  75. }
  76. [ActionName("deletedata")]
  77. public string DeleteData(string id)
  78. {
  79. if (string.IsNullOrEmpty(id))
  80. return Error("请输入ID");
  81. Model.T_Com_LogAction model = busLogAction.GetModel(id);
  82. if (busLogAction.Delete(id))
  83. {//JsonConvert.SerializeObject(model)
  84. AddAction("t_com_logaction", id, "删除操作日志" );
  85. AddAction("t_com_logaction", id.ToMyString(), "删除操作日志", JsonConvert.SerializeObject(model), "敏感信息");
  86. return Success("删除成功");
  87. }
  88. else
  89. return Error("失败");
  90. }
  91. }
  92. }