using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QMFrameWork.WebUI.Attribute;
using QMAPP.Web.Models.Sys;
using QMFrameWork.Data;
using QMAPP.Entity.Sys;
using QMAPP.Common.Web.Controllers;
using QMFrameWork.WebUI.DataSource;
namespace QMAPP.Web.Controllers
{
///
/// 系统操作记录
///
public class SystemLogController : QController
{
#region 记录列表
///
/// 记录列表
///
/// 结果
[HandleException]
public ActionResult SystemOperateLogList(bool? callBack)
{
SystemOperateLogModel seachModel = new SystemOperateLogModel();
if (callBack == true)
{
TryGetSelectBuffer(out seachModel);
}
seachModel.rownumbers = false;
seachModel.url = "/SystemOperateLog/GetList";
return View("SystemOperateLogList", seachModel);
}
///
/// 获取用户信息列表
///
/// 是否回调
/// 用户信息列表
[HandleException]
public ActionResult GetList(bool? callBack)
{
List log = new List();
SystemOperateLogModel seachModel = new SystemOperateLogModel();
DataPage page = new DataPage();
//SystemOperateLogBLL logBll = null;
SystemOperateLog condition = null;
try
{
//获取查询对象
seachModel = GetModel(seachModel);
#region 获取缓存值
if (callBack != null)
{
TryGetSelectBuffer(out seachModel);
}
else
{
//保存搜索条件
SetSelectBuffer(seachModel);
}
#endregion
//获取前台分页控件的分页大小
page = this.GetDataPage(seachModel);
//获取数据
condition = CopyToModel(seachModel);
//logBll = BLLFactory.CreateBLL();
////控制层得到用户的IP地址
////设置到实体的父类属性中..
//page = logBll.GetList(condition, page);
#region 调用服务
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
page = agent.InvokeServiceFunction("SystemOperateLogBLL_GetList", condition, page);
#endregion
DateGridResult result = new DateGridResult();
result.Total = page.RecordCount;
result.Rows = (List)page.Result;
return Content(result.GetJsonSource());
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 导出excel
///
/// 导出excel
///
/// 结果
[HttpPost]
public ActionResult ExportExcel()
{
SystemOperateLogModel seachModel = null;
SystemOperateLog condition = null;
DataTable exportDt = new DataTable();
try
{
//获取查询对象
seachModel = GetModel();
condition = CopyToModel(seachModel);
//获取数据
//SystemOperateLogBLL logBll = null;
//logBll = BLLFactory.CreateBLL();
//exportDt = logBll.GetExportData(condition);
#region 调用服务
QMAPP.ServicesAgent.ServiceAgent agent = this.GetServiceAgent();
exportDt = agent.InvokeServiceFunction("SystemOperateLogBLL_GetExportData", condition);
#endregion
//导出
QMFrameWork.WebUI.Util.IEFileTool efTool = new QMFrameWork.WebUI.Util.IEFileTool();
return efTool.GetExcelFileResult("SystemOperateLog", "SystemOperateLog.xls", exportDt);
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}