/// <summary> /// 读取错误日志列表 /// </summary> /// <param name="pageNo"></param> /// <param name="pageSize"></param> /// <returns></returns> public PageOf <Log.ErrorLog> GetErrorLogList(int pageNo, int pageSize) { var QUERY_SQL = @"( select Id,CreateTime,Thread,Level,Logger,Message,Exception,Name from J_ErrorLog WHERE DATEDIFF(dd,CreateTime,GETDATE())<=30"; QUERY_SQL += ") pp "; string SQL = string.Format(@" SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY pp.CreateTime DESC) AS RowNum,* FROM {0} ) as A WHERE A.RowNum BETWEEN (@PageIndex-1)* @PageSize+1 AND @PageIndex*@PageSize ORDER BY RowNum;" , QUERY_SQL); SQL += string.Format(@" SELECT COUNT(1) FROM {0};", QUERY_SQL); object param = new { pageIndex = pageNo, pageSize = pageSize }; DataSet ds = SQLHelper.FillDataSet(SQL, param); return(new PageOf <Log.ErrorLog>() { PageIndex = pageNo, PageSize = pageSize, Total = Convert.ToInt32(ds.Tables[1].Rows[0][0]), Items = DataMapHelper.DataSetToList <Log.ErrorLog>(ds) }); }
/// <summary> /// 读取运行日志列表 /// </summary> /// <param name="pageNo"></param> /// <param name="pageSize"></param> /// <returns></returns> public PageOf <Log.RunLog> GetRunLogList(int pageNo, int pageSize) { var QUERY_SQL = @"( SELECT r.Id,r.Remark,r.Description,r.CreateTime,j.JobName,j.ClassName FROM J_RunningLog r INNER JOIN J_Jobs j on r.JobID = j.JobID WHERE DATEDIFF(dd,r.CreateTime,GETDATE())<=30"; QUERY_SQL += ") pp "; string SQL = string.Format(@" SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY pp.CreateTime DESC) AS RowNum,* FROM {0} ) AS A WHERE A.RowNum BETWEEN (@PageIndex-1)* @PageSize+1 AND @PageIndex*@PageSize ORDER BY RowNum;" , QUERY_SQL); SQL += string.Format(@" SELECT COUNT(1) FROM {0};", QUERY_SQL); object param = new { pageIndex = pageNo, pageSize = pageSize }; DataSet ds = SQLHelper.FillDataSet(SQL, param); return(new PageOf <Log.RunLog>() { PageIndex = pageNo, PageSize = pageSize, Total = Convert.ToInt32(ds.Tables[1].Rows[0][0]), Items = DataMapHelper.DataSetToList <Log.RunLog>(ds) }); }
/// <summary> /// 获取用户列表 /// </summary> /// <param name="pageNo"></param> /// <param name="pageSize"></param> /// <returns></returns> public PageOf <User> GetUserList(int pageNo, int pageSize) { var QUERY_SQL = @"( SELECT UserId,UserName,PassWord,RealName,Email,Mobile,IsAdmin,Status,CreateTime,LastLoginTime FROM U_User"; QUERY_SQL += ") pp "; string SQL = string.Format(@" SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY pp.CreateTime desc) AS RowNum,* FROM {0} ) AS A WHERE A.RowNum BETWEEN (@PageIndex-1)* @PageSize+1 AND @PageIndex*@PageSize ORDER BY RowNum;" , QUERY_SQL); SQL += string.Format(@" SELECT COUNT(1) FROM {0};", QUERY_SQL); object param = new { pageIndex = pageNo, pageSize = pageSize }; DataSet ds = SQLHelper.FillDataSet(SQL, param); return(new PageOf <User>() { PageIndex = pageNo, PageSize = pageSize, Total = Convert.ToInt32(ds.Tables[1].Rows[0][0]), Items = DataMapHelper.DataSetToList <User>(ds) }); }
/// <summary> /// 获取任务列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public PageOf <Job> GetTaskList(int pageIndex, int pageSize) { var QUERY_SQL = @"( SELECT JobID,JobName,JobParams,CronExpression,AssemblyName,ClassName,Status,CreatedTime,ModifyTime,RecentRunTime,NextFireTime,CronRemark,Remark FROM J_Jobs WHERE Status <> -1" ; QUERY_SQL += ") pp "; string SQL = string.Format(@" SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY pp.ModifyTime desc) AS RowNum,* FROM {0} ) as A WHERE A.RowNum BETWEEN (@PageIndex-1)* @PageSize+1 AND @PageIndex*@PageSize ORDER BY RowNum;" , QUERY_SQL); SQL += string.Format(@" SELECT COUNT(1) FROM {0};", QUERY_SQL); object param = new { pageIndex = pageIndex, pageSize = pageSize }; DataSet ds = SQLHelper.FillDataSet(SQL, param); return(new PageOf <Job>() { PageIndex = pageIndex, PageSize = pageSize, Total = Convert.ToInt32(ds.Tables[1].Rows[0][0]), Items = DataMapHelper.DataSetToList <Job>(ds) }); }