/// <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; } }
public void Insert() { for (int i = 0; i < 100; i++) { Random random = new Random(); var srcId = random.Next(100); var desc = "插入数据 - " + srcId; var id = SysLogRepository.Insert(TableSource.None, OperationType.Insert, srcId); Assert.AreNotEqual(id, 0); } }
/// <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) { } }
public void GetPagedList() { var search = new PageSearchModel() { Limit = 20, Offset = 0, Order = "Desc", Sort = "Id" }; var list = SysLogRepository.GetPager(search, "og", "211", TableSource.Users, null, "", "", null, null); Assert.IsNotNull(list); }
/// <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); }
public void Delete() { Random random = new Random(); var srcId = random.Next(100); var desc = "插入数据 - " + srcId; var id = SysLogRepository.Insert(TableSource.None, OperationType.Insert, srcId); var log = SysLogRepository.Get(id); Assert.IsNotNull(log); SysLogRepository.Delete(log); log = SysLogRepository.Get(id); Assert.IsNull(log); }
public void Update() { Random random = new Random(); var srcId = random.Next(100); var desc = "插入数据 - " + srcId; var id = SysLogRepository.Insert(TableSource.None, OperationType.Insert, srcId); var log = SysLogRepository.Get(id); var oldTime = log.UpdateTime; var save = SysLogRepository.Update(log); log = SysLogRepository.Get(id); Assert.AreNotEqual(oldTime, log.UpdateTime); }
/// <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); } }
public SysLogBLL() { _SysLogRepository = new SysLogRepository(); }
public SysLogService() { this.dal_SysLog = Singleton <SysLogRepository> .Instance; }