/// <summary> /// 创建一个日志 /// </summary> /// <param name="validationErrors">返回的错误信息</param> /// <param name="db">数据库上下文</param> /// <param name="entity">一个日志</param> /// <returns></returns> public bool Create(ref ValidationErrors validationErrors, SysLog entity) { try { return(repository.Create(entity) == 1); } catch (Exception ex) { validationErrors.Add(ex.Message); ExceptionsHander.WriteExceptions(ex); } return(false); }
/// <summary> /// 写入日志 /// </summary> /// <param name="oper">操作人</param> /// <param name="mes">操作信息</param> /// <param name="result">结果</param> /// <param name="type">类型</param> /// <param name="module">操作模块</param> public static void WriteServiceLog(string oper, string mes, string result, string type, string module) { SysConfigModel siteConfig = new SysConfigBLL().loadConfig(Utils.GetXmlMapPath("Configpath")); //后台管理日志开启 if (siteConfig.logstatus == 1) { ValidationErrors errors = new ValidationErrors(); SysLog entity = new SysLog(); entity.Id = ResultHelper.NewId; entity.Operator = oper; entity.Message = mes; entity.Result = result; entity.Type = type; entity.Module = module; entity.CreateTime = ResultHelper.NowTime; using (SysLogRepository logRepository = new SysLogRepository(new DBContainer())) { logRepository.Create(entity); } } else { return; } }
/// <summary> /// 写入操作日志 /// </summary> /// <param name="entity"></param> public static void WriteServiceLog(SysLog entity) { try { entity.ID = ResultHelper.NewId; entity.CreateTime = ResultHelper.NowTime; SysLogRepository log = new SysLogRepository(); log.Create(entity); } catch (Exception ex) { } }
/// <summary> /// 写入日志 /// </summary> /// <param name="oper">操作人</param> /// <param name="mes">操作信息</param> /// <param name="result">结果</param> /// <param name="type">类型</param> /// <param name="module">操作模块</param> public static void WriteServiceLog(string oper, string mes, string result, string type, string module) { SysLog entity = new SysLog(); SysLogRepository Rep = new SysLogRepository(new DBContainer()); entity.Id = ResultHelper.NewId; entity.Operator = oper; entity.Message = mes; entity.Result = result; entity.Type = type; entity.Module = module; entity.CreateTime = ResultHelper.NowTime; Rep.Create(entity); }
/// <summary> /// 写入日志 /// </summary> /// <param name="oper">操作人</param> /// <param name="msg">操作信息</param> /// <param name="result">结构</param> /// <param name="type">类型</param> /// <param name="module">操作模块</param> public static void WriteServiceLog(string oper, string msg, string result, string type, string module) { SysLog entity = new SysLog(); entity.Id = ResultHelper.NewId; entity.Operator = oper; entity.Message = msg; entity.Result = result; entity.Type = type; entity.Module = module; entity.CreateTime = ResultHelper.NowTime; using (SysLogRepository logRepository = new SysLogRepository()) { logRepository.Create(entity); } }
public static void Write(string jobName, string message, string Result) { try { SysLog entity = new SysLog(); entity.Id = ResultHelper.NewId; entity.Operator = "Scheduler"; entity.Message = "jobName:" + jobName + "message" + message; entity.Result = Result; entity.Type = "调度"; entity.Module = "任务调度"; entity.CreateTime = ResultHelper.NowTime; using (SysLogRepository logRepository = new SysLogRepository(new DBContainer())) { logRepository.Create(entity); } } catch (Exception ep) { ExceptionHander.WriteException(ep); } }