public virtual void Modify(ref ValidationErrors errors, Apps.Models.Sys.SysLogModel model, params string[] updateProperties) { SysLog entity = m_Rep.GetById(model.Id); if (entity == null) { errors.Add(Resource.Disable); return; } if (updateProperties.Count() <= 0) { entity.Id = model.Id; entity.Operator = model.Operator; entity.Message = model.Message; entity.Result = model.Result; entity.Type = model.Type; entity.Module = model.Module; entity.CreateTime = model.CreateTime; } else { Type type = typeof(Apps.Models.Sys.SysLogModel); Type typeE = typeof(Apps.Models.SysLog); foreach (var item in updateProperties) { System.Reflection.PropertyInfo pi = type.GetProperty(item); System.Reflection.PropertyInfo piE = typeE.GetProperty(item); piE.SetValue(entity, pi.GetValue(model), null); } } m_Rep.Modify(entity, updateProperties); }
public virtual void Create(ref ValidationErrors errors, Apps.Models.Sys.SysLogModel model) { SysLog entity = m_Rep.GetById(model.Id); if (entity != null) { errors.Add(Resource.PrimaryRepeat); return; } entity = new SysLog(); entity.Id = model.Id; entity.Operator = model.Operator; entity.Message = model.Message; entity.Result = model.Result; entity.Type = model.Type; entity.Module = model.Module; entity.CreateTime = model.CreateTime; m_Rep.Create(entity); }
public virtual Apps.Models.Sys.SysLogModel GetById(string id) { SysLog entity = m_Rep.GetById(id); if (entity != null) { //SysLog entity = m_Rep.GetById(id); Apps.Models.Sys.SysLogModel model = new Apps.Models.Sys.SysLogModel(); model.Id = entity.Id; model.Operator = entity.Operator; model.Message = entity.Message; model.Result = entity.Result; model.Type = entity.Type; model.Module = entity.Module; model.CreateTime = entity.CreateTime; return(model); } else { return(null); } }
/// <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 = OperationContext.Current.ServiceSession.SysConfig.LoadConfig(Utils.GetXmlMapPath("Configpath")); //后台管理日志开启 if (siteConfig.logstatus == 1) { ValidationErrors errors = new ValidationErrors(); Apps.Models.Sys.SysLogModel entity = new Apps.Models.Sys.SysLogModel(); entity.Id = ResultHelper.NewId; entity.Operator = oper; entity.Message = mes; entity.Result = result; entity.Type = type; entity.Module = module; entity.CreateTime = ResultHelper.NowTime; OperationContext.Current.ServiceSession.SysLog.Create(ref errors, entity); } else { return; } }