using Epost.Common; using Epost.DAL; using Epost.Model; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using static Epost.DAL.Enum.SqlLogType; namespace Epost.BLL { public class ErrorLogBLL { ErrorLogDAL dal = new ErrorLogDAL(); #region 添加日志 public bool InsertErrorLog(ErrorLogModel model) { try { return dal.InsertErrorLog(model); } catch (Exception ex) { LogHelper.WriteLogInfo("添加错误日志异常:" + ex.Message); return false; } } #endregion #region 获取错误日志信息 public DataTable ErrorLogList(sqlLogType type) { try { return dal.ErrorLogList(type); } catch (Exception ex) { LogHelper.WriteLogInfo("查询错误日志异常:" + ex.Message); return null; } } #endregion #region 获取当前操作人员 public void GetUserName() { } #endregion #region 查询日志根据类型 #region /// /// 分页获取数据列表 /// public List GetLog4NetDetailListByPage(string strWhere, string orderby, int pageSize, int pageIndex, out int recordCount) { int startIndex = 0; int endIndex = 0; if (pageIndex <= 0) pageIndex = 1; //计算查询的开始行数与结束行数 startIndex = (pageIndex - 1) * pageSize + 1; endIndex = pageIndex * pageSize; return dal.GetLog4NetDetailListByPage(strWhere, orderby, startIndex, endIndex, out recordCount); } #endregion #endregion public void SaveSysytemError(string caozuo, string error) { ErrorLogBLL logBLL = new ErrorLogBLL(); ErrorLogModel error_model = new ErrorLogModel(); error_model.Type = "2"; error_model.Remark = caozuo + "" + error; logBLL.InsertErrorLog(error_model); } public void SaveOperateError(string caozuo, string error) { ErrorLogBLL logBLL = new ErrorLogBLL(); ErrorLogModel error_model = new ErrorLogModel(); error_model.Type = "3"; error_model.Remark = caozuo + "操作" + error; logBLL.InsertErrorLog(error_model); } } }