/// <summary> /// 查询系统日志 /// </summary> /// <param name="condtion"></param> /// <returns></returns> internal static GetSysErrorLogReplayModel SearchSysLog(GetSysLogRequestModel condtion) { GetSysErrorLogReplayModel result = BaseSysTemDataBaseManager.SysSearchSysLog(condtion); return(result); }
public ActionResult SysLog(GetSysLogRequestModel condtion) { ViewBag.PageId = Guid.NewGuid().ToString(); ViewBag.condtion = condtion; return(View()); }
public GetSysErrorLogReplayModel SearchSysLog(GetSysLogRequestModel condtion) { GetSysErrorLogReplayModel result = SysManagerService.SearchSysLog(condtion); return(result); }
public string ExcelSysLog(GetSysLogRequestModel condtion) { condtion.PageSize = 1000; GetSysErrorLogReplayModel result = SysManagerService.SearchSysLog(condtion); string dirPath = "/upload/Excel/" + DateTime.Now.ToString("yyMMdd") + "/"; string FileName = Helps.GetTimeId() + ".xls"; string SavePath = Server.MapPath(dirPath); if (!Directory.Exists(SavePath)) { Directory.CreateDirectory(SavePath); } SavePath = SavePath + FileName; dirPath = dirPath + FileName; Workbook wb = new Workbook(); Worksheet ws = wb.Worksheets[0]; Cells cell = ws.Cells; //合并第一行单元格 Range range = cell.CreateRange(0, 0, 1, 5); range.Merge(); cell["A1"].PutValue("系统运行日志导出"); //设置行高 cell.SetRowHeight(0, 20); //设置字体样式 Style style1 = wb.Styles[wb.Styles.Add()]; style1.HorizontalAlignment = TextAlignmentType.Center; //文字居中 style1.Font.Name = "宋体"; style1.Font.IsBold = true; //设置粗体 style1.Font.Size = 12; //设置字体大小 Style style2 = wb.Styles[wb.Styles.Add()]; style2.HorizontalAlignment = TextAlignmentType.Left; style2.Font.Size = 10; //给单元格关联样式 cell["A1"].SetStyle(style1); //设置列标题 cell[1, 0].PutValue("序号"); cell[1, 1].PutValue("类型"); cell[1, 2].PutValue("时间"); cell[1, 3].PutValue("内容"); cell[1, 4].PutValue("请求参数"); int i = 2; foreach (SysErrorLogModel row in result.rows) { cell[i, 0].PutValue(i - 1); cell[i, 1].PutValue(row.LogTypeText); cell[i, 2].PutValue(row.CreatedOn.ToString("yyyy-MM-dd")); cell[i, 3].PutValue(row.Errormsg); cell[i, 4].PutValue(row.Condtion); cell.SetColumnWidth(0, 10); cell.SetColumnWidth(1, 10); cell.SetColumnWidth(2, 10); cell.SetColumnWidth(3, 40); cell.SetColumnWidth(4, 40); i++; } wb.Save(SavePath); return(dirPath); }