Exemplo n.º 1
0
        /// <summary>
        /// 查找指定时段的日志信息
        /// </summary>
        /// <param name="operationLogQueryParam"></param>
        /// <returns></returns>
        public IQueryable <OperationLog> SearchOperationLogPageData(OperationLogQueryParam operationLogQueryParam)
        {
            var firstTime = Convert.ToDateTime(operationLogQueryParam.FirstTime);
            var lastTime  = Convert.ToDateTime(operationLogQueryParam.LastTime);
            var temp      = DbSession.OperationLogDal.GetEntities(u => (u.IsDeleted == false && (u.SubTime > firstTime && u.SubTime < lastTime)));

            //按操作人员筛选
            if (!string.IsNullOrEmpty(operationLogQueryParam.UName))
            {
                temp = temp.Where(o => o.UName.Contains(operationLogQueryParam.UName)).AsQueryable();
            }
            //按操作类型筛选
            if (!string.IsNullOrEmpty(operationLogQueryParam.ActionType))
            {
                temp = temp.Where(o => o.ActionType.Contains(operationLogQueryParam.ActionType)).AsQueryable();
            }
            //按操作名称查找
            if (!string.IsNullOrEmpty(operationLogQueryParam.ActionName))
            {
                temp = temp.Where(o => o.ActionName.Contains(operationLogQueryParam.ActionName)).AsQueryable();
            }

            operationLogQueryParam.Total = temp.Count();
            //分页
            return(temp.OrderByDescending(u => u.SubTime)
                   .Skip(operationLogQueryParam.PageSize * (operationLogQueryParam.PageIndex - 1))
                   .Take(operationLogQueryParam.PageSize).AsQueryable());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取所有操作日志信息
        /// </summary>
        /// <returns></returns>
        public ActionResult GetAllOperationLogs(string limit, string page)
        {
            int pageSize  = int.Parse(limit ?? "10");
            int pageIndex = int.Parse(page ?? "1");


            var queryParam = new OperationLogQueryParam()
            {
                PageSize  = pageSize,
                PageIndex = pageIndex,
                Total     = 0
            };

            var pageData = OperationLogService.LoagOperationLogPageData(queryParam);
            var temp     = pageData.Select(o => new
            {
                o.UName,
                o.ActionType,
                o.ActionName,
                o.OperationObj,
                o.Id,
                o.SubTime
            });
            var data = new { code = 0, msg = "", count = queryParam.Total, data = temp.ToList() };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 多条件查询
        /// </summary>
        /// <param name="userQueryParam">查询条件</param>
        /// <returns>查询结果</returns>
        public IQueryable <OperationLog> LoagOperationLogPageData(OperationLogQueryParam operationLogQueryParam)
        {
            var temp = DbSession.OperationLogDal.GetEntities(u => u.IsDeleted == false);

            operationLogQueryParam.Total = temp.Count();
            //分页
            return(temp.OrderByDescending(u => u.SubTime)
                   .Skip(operationLogQueryParam.PageSize * (operationLogQueryParam.PageIndex - 1))
                   .Take(operationLogQueryParam.PageSize).AsQueryable());
        }
Exemplo n.º 4
0
        /// <summary>
        /// 搜索具体范围时间内的日志
        /// </summary>
        /// <param name="limit"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public ActionResult SearchOperationLogs(string page, string limit, OperationLogQueryParam operationLogQueryParam)
        {
            int pageSize  = int.Parse(limit ?? "10");
            int pageIndex = int.Parse(page ?? "1");

            operationLogQueryParam.PageSize  = pageSize;
            operationLogQueryParam.PageIndex = pageIndex;

            var pageData = OperationLogService.SearchOperationLogPageData(operationLogQueryParam);
            var temp     = pageData.Select(o => new
            {
                o.UName,
                o.ActionType,
                o.ActionName,
                o.OperationObj,
                o.Id,
                o.SubTime
            });
            var data = new { code = 0, msg = "", count = operationLogQueryParam.Total, data = temp.ToList() };

            return(Json(data, JsonRequestBehavior.AllowGet));
        }