static void Main(string[] args) { BusinessLog user = new BusinessLog() { Data = "张三", CreateTime = DateTime.Now }; IMongoDBRepository<BusinessLog> mongoDbRepository = new MongoDBRepository<BusinessLog>(); mongoDbRepository.Insert(user); Console.Read(); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(BusinessLog model) { using (DBHelper db = DBHelper.Create()) { db.Insert <BusinessLog>(model); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(BusinessLog model) { using (DBHelper db = DBHelper.Create()) { db.Update <BusinessLog>(model); return(true); } }
/// <summary> /// 是否存在该记录 /// </summary> public bool Exists(string ID) { using (DBHelper db = DBHelper.Create()) { BusinessLog businessLog = db.GetById <BusinessLog>(ID); return(businessLog != null && businessLog.ID != null); } }
public CommonLogHandler(BusinessLog _logWriter, string _logTitle, string _logMessage, List <LogAttributeHelper.LogAttribute> _logAttribute, int _eventCode, int _order) { this.LogWriter = _logWriter; this.LogTitle = _logTitle; this.LogMessage = _logMessage; this.Order = _order; this.LogAttribute = _logAttribute; this.EventCode = _eventCode; }
public void Create(ModuleCode moduleCode, string businessID, string operate, string opinion, string userid) { BusinessLog log = new BusinessLog(); log.SystemName = SubSystem.苏州市园林绿化企业动态管理系统.ToString(); log.CategoryName = ""; log.PostStatus = ""; log.PriorStatus = ""; log.ModuleName = moduleCode.ToString(); log.KeyString = businessID.ToString(); log.Operation = operate; log.MessageInfo = opinion; log.OperatorID = userid; log.OperatorName = ""; logManager.AppendLog(log); }
public static void Log(string systemName, string moduleName, string fileName, string messageInfo) { ConnectionStringSettings connstr = ConfigurationManager.ConnectionStrings["SparkServiceDesk_LogManagerConnectionString"]; DBOperator db = DBOperatorFactory.GetDBOperator(connstr); ILogManager logManager = LogManagerFactory.CreateLogManager("DEFAULT"); logManager.DB = db; BusinessLog bizLog = new BusinessLog(); bizLog.SystemName = systemName; bizLog.ModuleName = moduleName; bizLog.CategoryName = "上传文件"; bizLog.KeyString = fileName; bizLog.Operation = "上传文件"; bizLog.PriorStatus = "操作前"; bizLog.PostStatus = "操作后"; bizLog.MessageInfo = messageInfo; bizLog.OperatorID = "-1"; bizLog.OperatorName = "无名氏"; logManager.AppendLog(bizLog); }
static void Main(string[] args) { if (args.Length != 2) { Console.WriteLine("Cannot start application with wrong number of arguments."); Console.WriteLine("Example: .\\TurtleChallangeCSharp.exe game-settings moves"); } else { var logger = new BusinessLog(); var gir = new GameInputReader(logger); gir.TableConfigPath = args[0]; gir.MovesConfigPath = args[1]; var gameManager = new GameManager(gir, new MovesConfigParser(logger), new TableConfigParser(logger), new TurtleStateMachine(logger), logger); var results = gameManager.RunGame(); foreach (var result in results) { Console.WriteLine(result.ResultString); } } }
/// <summary> /// 根据sql获取当前业务操作记录对象 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="sql"></param> /// <param name="param"></param> /// <returns></returns> private static IEnumerable <BusinessLog> GetBusinessLog <TEntity>(string sql, IEnumerable <TEntity> param, string ip) where TEntity : BaseEntity { var action = Configuration.BusinessLog; if (action == null) { yield return(null); } var entityType = typeof(TEntity); foreach (var entity in param) { EntityInfo entityInfo; BusinessLog log = new BusinessLog() { BusinessId = entity.Id, BusinessSql = sql, BusinessParameter = JsonConvert.SerializeObject(param), ModifyIp = ip, ModifyBy = entity.ModifyBy }; if (entityType == typeof(BaseEntity)) { var newSql = sql.Replace("\r\n", ""); var matches = Regex.Matches(newSql, @"(?<=UPDATE).*?(?=SET)|(?<=INTO).*?(?=\()"); foreach (var v in matches) { log.TableName = v.ToString().Trim(); if (!SqlBuilder.Configuration.TableInfos.TryGetValue(log.TableName, out entityInfo)) { continue; } if (entityInfo.IsLog) { yield return(log); } } } if (!SqlBuilder.Configuration.EntityInfos.TryGetValue(entityType.FullName, out entityInfo)) { continue;//不需要执行 } if (entityInfo == null || !entityInfo.IsLog) { continue;//不需要执行 } log.TableName = entityInfo.TableName; yield return(log); } }
public void Log(BusinessLog input) { _businessLogRepository.Add(input); }