地铁二期项目正式开始

LogActionController.cs 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 Table = "", string id = "", int page = 0, 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. DataTable dt = busLogAction.GetListByPage(strWhere, " atime desc ", (page - 1) * limit, page*limit).Tables[0];
  55. int count = busLogAction.GetRecordCount(strWhere);
  56. return Success("成功", dt, count);
  57. }
  58. [ActionName("GetData")]
  59. public string GettData(string id)
  60. {
  61. if (string.IsNullOrEmpty(id))
  62. return Error("请输入ID");
  63. Model.T_Com_LogAction model = busLogAction.GetModel(id);
  64. return Success("成功", model, 1);
  65. }
  66. [ActionName("deletedata")]
  67. public string DeleteData(string id)
  68. {
  69. if (string.IsNullOrEmpty(id))
  70. return Error("请输入ID");
  71. Model.T_Com_LogAction model = busLogAction.GetModel(id);
  72. if (busLogAction.Delete(id))
  73. {//JsonConvert.SerializeObject(model)
  74. AddAction("t_com_logaction", id, "删除操作日志" );
  75. AddAction("t_com_logaction", id.ToMyString(), "删除操作日志", JsonConvert.SerializeObject(model), "敏感信息");
  76. return Success("删除成功");
  77. }
  78. else
  79. return Error("失败");
  80. }
  81. }
  82. }