using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YTSoft.BaseCallCenter.Model;
using YTSoft.BaseCallCenter.MVCWeb.Models;
///
/// 客服快捷回复
///
namespace YTSoft.BaseCallCenter.MVCWeb.Controllers
{
public class LogActionController : BaseController
{
BLL.T_Com_LogAction busLogAction = new BLL.T_Com_LogAction();
#region 纯视图
///
/// 回复列表
///
///
public ActionResult GetList()
{
return View();
}
#endregion
//操作记录 敏感信息 主要设置
[ActionName("GetListData")]
public string GetListData( string dateParty, string username,string Table = "", string id = "", int page = 1, int limit = 20,string actionname= "")
{
string strWhere = "";
if (Table == "kf_quick_msgs")
{
strWhere += " 1=1 ";
}
else if (string.IsNullOrEmpty(actionname))
{
strWhere += "TableName!='kf_quick_msgs ' ";
}
else
{
strWhere += string.Format(" convert(nvarchar(1500),ContentNew)='{0}' ", actionname);
}
if (!string.IsNullOrEmpty(Table))
{
strWhere += string.Format(" and TableName = '{0}'", Table);
}
if (!string.IsNullOrEmpty(id))
{
strWhere += string.Format(" and TableId ='{0}'", id);
}
if (!string.IsNullOrEmpty(username)) {
strWhere += string.Format(" and AddUser ='{0}'", username);
}
if (!string.IsNullOrEmpty(dateParty))
{
string startDate = dateParty.Substring(0, 10);
string endDate = dateParty.Substring(12);
strWhere += " and Atime>= '" + startDate + " 00:00:00" + "'";
strWhere += " and Atime<= '" + endDate + " 23:59:59" + "'";
}
DataTable dt = busLogAction.GetListByPage(strWhere, " atime desc ", (page - 1) * limit, page*limit).Tables[0];
int count = busLogAction.GetRecordCount(strWhere);
return Success("成功", dt, count);
}
[ActionName("GetData")]
public string GettData(string id)
{
if (string.IsNullOrEmpty(id))
return Error("请输入ID");
Model.T_Com_LogAction model = busLogAction.GetModel(id);
return Success("成功", model, 1);
}
[ActionName("deletedata")]
public string DeleteData(string id)
{
if (string.IsNullOrEmpty(id))
return Error("请输入ID");
Model.T_Com_LogAction model = busLogAction.GetModel(id);
if (busLogAction.Delete(id))
{//JsonConvert.SerializeObject(model)
AddAction("t_com_logaction", id, "删除操作日志" );
AddAction("t_com_logaction", id.ToMyString(), "删除操作日志", JsonConvert.SerializeObject(model), "敏感信息");
return Success("删除成功");
}
else
return Error("失败");
}
}
}