/// <summary> /// 注册业务日志 /// </summary> /// <param name="info">日志对象</param> public void RegisterBusiness(NGPBusinessLog info) { _sendBusinessHandler.Post(info); }
/// <summary> /// 插入业务日志 /// </summary> /// <param name="context">日志对象</param> public void InsertBusinessLog(NGPBusinessLog context) { try { //{ // using (var unitRepository = UnityContainerFactory.Resolve<IUnitRepository>()) // { // var addInfoList = new List<ZM_SYS_BusinessLog>(); // var detailList = new List<ZM_SYS_BusinessLogDetail>(); // foreach (var info in context.LogInfos) // { // var logItem = new ZM_SYS_BusinessLog // { // ApiPostParameter = context.ApiPostParameter, // ApiUrl = context.ApiUrl, // AppKey = info.AppKey, // BusinessMethod = context.BusinessMethod, // Content = info.Content, // CreatedBy = context.OperateBy, // CreatedDept = context.OperateDept, // CreatedTime = DateTime.Now, // FormKey = info.FormKey, // Id = GuidExtend.NewGuid(), // IsDelete = false, // NameValue = info.NameValue, // OperateBy = context.OperateBy, // OperateDept = context.OperateDept, // OperateType = context.OperateType, // PrimaryKeyValue = info.PrimaryKeyValue, // StatisticsDay = DateTime.Now.Day, // StatisticsMonth = DateTime.Now.Month, // StatisticsYear = DateTime.Now.Year, // TableName = info.FormKey, // UpdatedBy = context.OperateBy, // UpdatedDept = context.OperateDept, // UpdatedTime = DateTime.Now // }; // addInfoList.Add(logItem); // var currentDetialList = info.LogDetails.Select(s => new ZM_SYS_BusinessLogDetail // { // AppKey = logItem.AppKey, // ColumnName = s.ColumnName, // CreatedBy = context.OperateBy, // CreatedDept = context.OperateDept, // CreatedTime = DateTime.Now, // UpdatedBy = context.OperateBy, // UpdatedDept = context.OperateDept, // UpdatedTime = DateTime.Now, // CurrentText = s.CurrentText, // CurrentValue = s.CurrentValue, // FieldKey = s.FieldKey, // FormKey = logItem.FormKey, // Id = GuidExtend.NewGuid(), // LogId = logItem.Id, // OriginalText = s.OriginalText, // OriginalValue = s.OriginalValue, // PrimaryKeyValue = logItem.PrimaryKeyValue, // TableName = logItem.TableName, // IsDelete = false // }); // detailList.AddRange(currentDetialList); // } // unitRepository.BulkInsert(addInfoList); // unitRepository.BulkInsert(detailList); // } } catch { } }
/// <summary> /// 业务日志数据处理 /// </summary> /// <param name="context">上下文</param> private static void SendBusinessHandler(NGPBusinessLog context) { Singleton <IEngine> .Instance.Resolve <ILogProvider>().InsertBusinessLog(context); }