private async Task <bool> ShouldWriteAuditLogAsync( IAbpMethodInvocation invocation, AuditLogInfo auditLogInfo, AbpAuditingOptions options, ICurrentUser currentUser, bool hasError) { foreach (var selector in options.AlwaysLogSelectors) { if (await selector(auditLogInfo)) { return(true); } } if (options.AlwaysLogOnException && hasError) { return(true); } if (!options.IsEnabledForAnonymousUsers && !currentUser.IsAuthenticated) { return(false); } if (!options.IsEnabledForGetRequests && invocation.Method.Name.StartsWith("Get", StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
private async Task <bool> ShouldWriteAuditLogAsync(AuditLogInfo auditLogInfo, HttpContext httpContext, bool hasError) { foreach (var selector in AuditingOptions.AlwaysLogSelectors) { if (await selector(auditLogInfo)) { return(true); } } if (AuditingOptions.AlwaysLogOnException && hasError) { return(true); } if (!AuditingOptions.IsEnabledForAnonymousUsers && !CurrentUser.IsAuthenticated) { return(false); } if (!AuditingOptions.IsEnabledForGetRequests && string.Equals(httpContext.Request.Method, HttpMethods.Get, StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
/// <summary> /// 合并实体变化 /// </summary> /// <param name="auditLog"></param> protected virtual void MergeEntityChanges(AuditLogInfo auditLog) { var changeGroups = auditLog.EntityChanges .Where(e => e.ChangeType == EntityChangeType.Updated) .GroupBy(e => new { e.EntityTypeFullName, e.EntityId }) .ToList(); foreach (var changeGroup in changeGroups) { if (changeGroup.Count() <= 1) { continue; } var firstEntityChange = changeGroup.First(); foreach (var entityChangeInfo in changeGroup) { if (entityChangeInfo == firstEntityChange) { continue; } firstEntityChange.Merge(entityChangeInfo); auditLog.EntityChanges.Remove(entityChangeInfo); } } }
public AuditLog(IGuidGenerator guidGenerator, AuditLogInfo auditInfo) { Id = guidGenerator.Create(); ApplicationName = auditInfo.ApplicationName; TenantId = auditInfo.TenantId; UserId = auditInfo.UserId; UserName = auditInfo.UserName.Truncate(AuditLogConsts.MaxUserNameLength); ExecutionTime = auditInfo.ExecutionTime; ExecutionDuration = auditInfo.ExecutionDuration; ClientIpAddress = auditInfo.ClientIpAddress.Truncate(AuditLogConsts.MaxClientIpAddressLength); ClientName = auditInfo.ClientName.Truncate(AuditLogConsts.MaxClientNameLength); ClientId = auditInfo.ClientId.Truncate(AuditLogConsts.MaxClientIdLength); CorrelationId = auditInfo.CorrelationId.Truncate(AuditLogConsts.MaxCorrelationIdLength); BrowserInfo = auditInfo.BrowserInfo.Truncate(AuditLogConsts.MaxBrowserInfoLength); HttpMethod = auditInfo.HttpMethod.Truncate(AuditLogConsts.MaxHttpMethodLength); Url = auditInfo.Url.Truncate(AuditLogConsts.MaxUrlLength); HttpStatusCode = auditInfo.HttpStatusCode; ImpersonatorUserId = auditInfo.ImpersonatorUserId; ImpersonatorTenantId = auditInfo.ImpersonatorTenantId; ExtraProperties = auditInfo.ExtraProperties.ToDictionary(pair => pair.Key, pair => pair.Value); EntityChanges = auditInfo.EntityChanges.Select(e => new EntityChange(guidGenerator, Id, e)).ToList(); Actions = auditInfo.Actions.Select(e => new AuditLogAction(guidGenerator.Create(), Id, e)).ToList(); Exceptions = auditInfo.Exceptions.JoinAsString(Environment.NewLine).Truncate(AuditLogConsts.MaxExceptionsLength); Comments = auditInfo.Comments.JoinAsString(Environment.NewLine).Truncate(AuditLogConsts.MaxCommentsLength); }
private async Task <bool> ShouldWriteAuditLogAsync(AuditLogInfo auditLogInfo, IServiceProvider serviceProvider, bool hasError) { var options = serviceProvider.GetRequiredService <IOptions <AbpAuditingOptions> >().Value; foreach (var selector in options.AlwaysLogSelectors) { if (await selector(auditLogInfo)) { return(true); } } if (options.AlwaysLogOnException && hasError) { return(true); } if (!options.IsEnabledForAnonymousUsers && !serviceProvider.GetRequiredService <ICurrentUser>().IsAuthenticated) { return(false); } var auditingManager = serviceProvider.GetRequiredService <IAuditingManager>(); if (auditingManager.Current == null || auditingManager.Current.Log.Actions.IsNullOrEmpty()) { return(false); } return(true); }
protected virtual async Task SaveLogAsync(AuditLogInfo auditInfo) { using var uow = UnitOfWorkManager.Begin(true); await AuditLogRepository.InsertAsync(await Converter.ConvertAsync(auditInfo)); await uow.CompleteAsync(); }
public virtual AuditLogActionInfo CreateAuditLogAction( AuditLogInfo auditLog, Type type, MethodInfo method, object[] arguments) { return(CreateAuditLogAction(auditLog, type, method, CreateArgumentsDictionary(method, arguments))); }
protected virtual async Task SaveLogAsync(AuditLogInfo auditInfo) { //using (var uow = UnitOfWorkManager.Begin(true)) //{ // await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, auditInfo)); // await uow.SaveChangesAsync(); //} }
protected virtual void SaveLog(AuditLogInfo auditInfo) { using (var uow = _unitOfWorkManager.Begin(true)) { _auditLogRepository.Insert(new AuditLog(_guidGenerator, auditInfo)); uow.SaveChanges(); } }
public async Task Should_Save_An_Audit_Log() { //Arrange var userId = new Guid("4456fb0d-74cc-4807-9eee-23e551e6cb06"); var ipAddress = "153.1.7.61"; var firstComment = "first Comment"; var auditLog = new AuditLogInfo { UserId = userId, ImpersonatorUserId = Guid.NewGuid(), ImpersonatorTenantId = Guid.NewGuid(), ImpersonatorTenantName = "default", ImpersonatorUserName = "******", ExecutionTime = DateTime.Today, ExecutionDuration = 42, ClientIpAddress = ipAddress, ClientName = "MyDesktop", BrowserInfo = "Chrome", Comments = new List <string> { firstComment, "Second Comment" }, EntityChanges = { new EntityChangeInfo { EntityId = Guid.NewGuid().ToString(), EntityTypeFullName = "Volo.Abp.AuditLogging.TestEntity", ChangeType = EntityChangeType.Created, ChangeTime = DateTime.Now, PropertyChanges = new List <EntityPropertyChangeInfo> { new EntityPropertyChangeInfo { PropertyTypeFullName = typeof(string).FullName, PropertyName = "Name", NewValue = "New value", OriginalValue = null } } } } }; //Act await _auditingStore.SaveAsync(auditLog); //Assert var insertedLog = (await _auditLogRepository.GetListAsync(true)) .FirstOrDefault(al => al.UserId == userId); insertedLog.ShouldNotBeNull(); insertedLog.ClientIpAddress.ShouldBe(ipAddress); insertedLog.Comments.ShouldStartWith(firstComment); insertedLog.EntityChanges.Count.ShouldBeGreaterThan(0); insertedLog.EntityChanges.First().PropertyChanges.Count.ShouldBeGreaterThan(0); }
protected virtual async Task SaveLogAsync(AuditLogInfo auditInfo) { using (var uow = UnitOfWorkManager.Begin(true)) { await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, auditInfo)); await uow.CompleteAsync(); } }
protected virtual async Task SaveLogAsync(AuditLogInfo auditInfo) { using (var uow = _unitOfWorkManager.Begin(true)) { await _auditLogRepository.InsertAsync(new AuditLog(_guidGenerator, auditInfo)).ConfigureAwait(false); await uow.SaveChangesAsync().ConfigureAwait(false); } }
private async Task SaveLogAsync(AuditLogInfo auditInfo) { using (var uow = _unitOfWorkManager.Begin(requiresNew: true)) { var auditLog = new AuditLog(_guidGenerator, auditInfo); await _auditLogRepository.InsertAsync(auditLog); await uow.SaveChangesAsync(); } }
public DisposableSaveHandle( AuditingManager auditingManager, IDisposable scope, AuditLogInfo auditLog, Stopwatch stopWatch) { _auditingManager = auditingManager; _scope = scope; AuditLog = auditLog; StopWatch = stopWatch; }
public AuditLog(IGuidGenerator guidGenerator, AuditLogInfo auditInfo) : base(guidGenerator.Create()) { ApplicationName = auditInfo.ApplicationName.Truncate(AuditLogConsts.MaxApplicationNameLength); TenantId = auditInfo.TenantId; TenantName = auditInfo.TenantName.Truncate(AuditLogConsts.MaxTenantNameLength); UserId = auditInfo.UserId; UserName = auditInfo.UserName.Truncate(AuditLogConsts.MaxUserNameLength); ExecutionTime = auditInfo.ExecutionTime; ExecutionDuration = auditInfo.ExecutionDuration; ClientIpAddress = auditInfo.ClientIpAddress.Truncate(AuditLogConsts.MaxClientIpAddressLength); ClientName = auditInfo.ClientName.Truncate(AuditLogConsts.MaxClientNameLength); ClientId = auditInfo.ClientId.Truncate(AuditLogConsts.MaxClientIdLength); CorrelationId = auditInfo.CorrelationId.Truncate(AuditLogConsts.MaxCorrelationIdLength); BrowserInfo = auditInfo.BrowserInfo.Truncate(AuditLogConsts.MaxBrowserInfoLength); HttpMethod = auditInfo.HttpMethod.Truncate(AuditLogConsts.MaxHttpMethodLength); Url = auditInfo.Url.Truncate(AuditLogConsts.MaxUrlLength); HttpStatusCode = auditInfo.HttpStatusCode; ImpersonatorUserId = auditInfo.ImpersonatorUserId; ImpersonatorTenantId = auditInfo.ImpersonatorTenantId; ExtraProperties = new ExtraPropertyDictionary(); if (auditInfo.ExtraProperties != null) { foreach (var pair in auditInfo.ExtraProperties) { ExtraProperties.Add(pair.Key, pair.Value); } } EntityChanges = auditInfo .EntityChanges? .Select(entityChangeInfo => new EntityChange(guidGenerator, Id, entityChangeInfo, tenantId: auditInfo.TenantId)) .ToList() ?? new List <EntityChange>(); Actions = auditInfo .Actions? .Select(auditLogActionInfo => new AuditLogAction(guidGenerator.Create(), Id, auditLogActionInfo, tenantId: auditInfo.TenantId)) .ToList() ?? new List <AuditLogAction>(); Exceptions = auditInfo .Exceptions? .JoinAsString(Environment.NewLine) .Truncate(AuditLogConsts.MaxExceptionsLengthValue); Comments = auditInfo .Comments? .JoinAsString(Environment.NewLine) .Truncate(AuditLogConsts.MaxCommentsLength); }
protected async override Task SaveLogAsync(AuditLogInfo auditInfo) { //去除DisableAuditing的请求,带DisableAuditing的Actionos都是空的 if (auditInfo.Actions.Count == 0) { return; } //去除没有必要的数据存储 if (auditInfo.Url.StartsWith("/api/") && auditInfo.Actions.Where(a => a.Parameters != "{}").Any()) { await base.SaveLogAsync(auditInfo); } }
public AuditLog(AuditLogInfo auditInfo) { //Id = guidGenerator.Create(); //ApplicationName = auditInfo.ApplicationName.Truncate(AuditLogConsts.MaxApplicationNameLength); TenantId = auditInfo.TenantId; //TenantName = auditInfo.TenantName.Truncate(AuditLogConsts.MaxTenantNameLength); UserId = auditInfo.UserId; //UserName = auditInfo.UserName.Truncate(AuditLogConsts.MaxUserNameLength); ExecutionTime = auditInfo.ExecutionTime; ExecutionDuration = auditInfo.ExecutionDuration; //ClientIpAddress = auditInfo.ClientIpAddress.Truncate(AuditLogConsts.MaxClientIpAddressLength); //ClientName = auditInfo.ClientName.Truncate(AuditLogConsts.MaxClientNameLength); //ClientId = auditInfo.ClientId.Truncate(AuditLogConsts.MaxClientIdLength); //CorrelationId = auditInfo.CorrelationId.Truncate(AuditLogConsts.MaxCorrelationIdLength); //BrowserInfo = auditInfo.BrowserInfo.Truncate(AuditLogConsts.MaxBrowserInfoLength); //HttpMethod = auditInfo.HttpMethod.Truncate(AuditLogConsts.MaxHttpMethodLength); //Url = auditInfo.Url.Truncate(AuditLogConsts.MaxUrlLength); HttpStatusCode = auditInfo.HttpStatusCode; ImpersonatorUserId = auditInfo.ImpersonatorUserId; ImpersonatorTenantId = auditInfo.ImpersonatorTenantId; //ExtraProperties = auditInfo // .ExtraProperties? // .ToDictionary(pair => pair.Key, pair => pair.Value) // ?? new Dictionary<string, object>(); //EntityChanges = auditInfo // .EntityChanges? // .Select(entityChangeInfo => new EntityChange(guidGenerator, Id, entityChangeInfo, tenantId: auditInfo.TenantId)) // .ToList() // ?? new List<EntityChange>(); //Actions = auditInfo // .Actions? // .Select(auditLogActionInfo => new AuditLogAction(guidGenerator.Create(), Id, auditLogActionInfo, tenantId: auditInfo.TenantId)) // .ToList() // ?? new List<AuditLogAction>(); //Exceptions = auditInfo // .Exceptions? // .JoinAsString(Environment.NewLine) // .Truncate(AuditLogConsts.MaxExceptionsLengthValue); //Comments = auditInfo // .Comments? // .JoinAsString(Environment.NewLine) // .Truncate(AuditLogConsts.MaxCommentsLength); }
public virtual async Task SaveAsync(AuditLogInfo auditInfo) { if (!Options.HideErrors) { await SaveLogAsync(auditInfo); return; } try { await SaveLogAsync(auditInfo); } catch (Exception ex) { Logger.LogWarning("Could not save the audit log object: " + Environment.NewLine + auditInfo.ToString()); Logger.LogException(ex, LogLevel.Error); } }
private bool ShouldSaveAudit(ActionExecutingContext context, out AuditLogInfo auditLog, out AuditLogActionInfo auditLogAction) { auditLog = null; auditLogAction = null; var method = context.HttpContext.Request.Method; if (method.Equals(HttpMethod.Options.Method, StringComparison.OrdinalIgnoreCase)) { return(false); } if (!Options.IsEnabled) { return(false); } if (!context.ActionDescriptor.IsControllerAction()) { return(false); } var auditLogScope = _auditingManager.Current; if (auditLogScope == null) { return(false); } if (!_auditingHelper.ShouldSaveAudit(context.ActionDescriptor.GetMethodInfo(), true)) { return(false); } auditLog = auditLogScope.Log; auditLog.UserId = _currentUser?.Id; auditLog.UserName = _currentUser?.UserName; auditLogAction = _auditingHelper.CreateAuditLogAction( auditLog, context.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.AsType(), context.ActionDescriptor.AsControllerActionDescriptor().MethodInfo, context.ActionArguments ); return(true); }
public void Save(AuditLogInfo auditInfo) { if (!Options.HideErrors) { SaveLog(auditInfo); return; } try { SaveLog(auditInfo); } catch (Exception ex) { Logger.LogException(ex, LogLevel.Error); } }
public async Task SaveAsync(AuditLogInfo auditInfo) { try { using (var uow = _unitOfWorkManager.Begin(requiresNew: true)) { var auditLog = new AuditLog(_guidGenerator, auditInfo); await _auditLogRepository.InsertAsync(auditLog); await uow.SaveChangesAsync(); } } catch (Exception ex) { Logger.LogException(ex, LogLevel.Error); } }
/// <summary> /// 执行审计贡献者 /// </summary> /// <param name="auditLogInfo">审计信息</param> protected virtual void ExecutePostContributors(AuditLogInfo auditLogInfo) { using var scope = ServiceProvider.CreateScope(); var context = new AuditLogContributionContext(scope.ServiceProvider, auditLogInfo); foreach (var contributor in Options.Contributors) { try { contributor.PostContribute(context); } catch (Exception ex) { Logger.LogException(ex, LogLevel.Warning); } } }
public async Task SaveAsync(AuditLogInfo auditInfo) { if (!Options.HideErrors) { await SaveLogAsync(auditInfo).ConfigureAwait(false); return; } try { await SaveLogAsync(auditInfo).ConfigureAwait(false); } catch (Exception ex) { Logger.LogException(ex, LogLevel.Error); } }
public virtual async Task SaveAsync(AuditLogInfo auditInfo) { //if (!Options.HideErrors) //{ // await SaveLogAsync(auditInfo); // return; //} //try //{ // await SaveLogAsync(auditInfo); //} //catch (Exception ex) //{ // Logger.LogWarning("Could not save the audit log object: " + Environment.NewLine + auditInfo.ToString()); // Logger.LogException(ex, LogLevel.Error); //} }
public async Task SaveAsync(AuditLogInfo auditInfo) { if (!Options.IsEnabled) { await SaveLogAsync(auditInfo); return; } try { await SaveLogAsync(auditInfo); } catch (Exception ex) { Logger.LogException(ex, LogLevel.Error); } }
private bool ShouldSaveAudit(ActionExecutingContext context, out AuditLogInfo auditLog, out AuditLogActionInfo auditLogAction) { auditLog = null; auditLogAction = null; if (!Options.IsEnabled) { return(false); } if (!context.ActionDescriptor.IsControllerAction()) { return(false); } var auditLogScope = _auditingManager.Current; if (auditLogScope == null) { return(false); } if (!_auditingHelper.ShouldSaveAudit(context.ActionDescriptor.GetMethodInfo(), true)) { return(false); } //TODO: This is partially duplication of AuditHelper.ShouldSaveAudit method. Check why it does not work for controllers if (!AuditingInterceptorRegistrar.ShouldAuditTypeByDefault(context.Controller.GetType())) { return(false); } auditLog = auditLogScope.Log; auditLogAction = _auditingHelper.CreateAuditLogAction( auditLog, context.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.AsType(), context.ActionDescriptor.AsControllerActionDescriptor().MethodInfo, context.ActionArguments ); return(true); }
public virtual AuditLogInfo CreateAuditLogInfo() { var auditInfo = new AuditLogInfo { ApplicationName = Options.ApplicationName, TenantId = CurrentTenant.Id, TenantName = CurrentTenant.Name, UserId = CurrentUser.Id, UserName = CurrentUser.UserName, ClientId = CurrentClient.Id, CorrelationId = CorrelationIdProvider.Get(), ImpersonatorUserId = CurrentUser.FindImpersonatorUserId(), ImpersonatorTenantId = CurrentUser.FindImpersonatorTenantId(), ExecutionTime = Clock.Now }; ExecutePreContributors(auditInfo); return(auditInfo); }
public virtual AuditLogActionInfo CreateAuditLogAction( AuditLogInfo auditLog, Type type, MethodInfo method, IDictionary <string, object> arguments) { var actionInfo = new AuditLogActionInfo { ServiceName = type != null ? type.FullName : "", MethodName = method.Name, Parameters = SerializeConvertArguments(arguments), ExecutionTime = Clock.Now }; //TODO Execute contributors return(actionInfo); }
private bool ShouldSaveAudit(PageHandlerExecutingContext context, out AuditLogInfo auditLog, out AuditLogActionInfo auditLogAction) { auditLog = null; auditLogAction = null; var options = context.GetRequiredService <IOptions <AbpAuditingOptions> >().Value; if (!options.IsEnabled) { return(false); } if (!context.ActionDescriptor.IsPageAction()) { return(false); } var auditLogScope = context.GetRequiredService <IAuditingManager>().Current; if (auditLogScope == null) { return(false); } var auditingHelper = context.GetRequiredService <IAuditingHelper>(); if (!auditingHelper.ShouldSaveAudit(context.HandlerMethod.MethodInfo, true)) { return(false); } auditLog = auditLogScope.Log; auditLogAction = auditingHelper.CreateAuditLogAction( auditLog, context.HandlerMethod.MethodInfo.DeclaringType, context.HandlerMethod.MethodInfo, context.HandlerArguments ); return(true); }
/// <summary> /// 判断是否写日志 /// </summary> /// <param name="context"></param> /// <param name="auditLog"></param> /// <param name="auditLogAction"></param> /// <returns></returns> private bool ShouldSaveAudit(ActionExecutingContext context, out AuditLogInfo auditLog, out AuditLogActionInfo auditLogAction) { auditLog = null; auditLogAction = null; var options = context.GetRequiredService <IOptions <AuditingOptions> >().Value; if (!options.IsEnabled) { return(false); } if (!context.ActionDescriptor.IsControllerAction()) { return(false); } var auditLogScope = context.GetService <IAuditingManager>()?.Current; if (auditLogScope == null) { return(false); } var auditingFactory = context.GetRequiredService <IAuditingFactory>(); if (!auditingFactory.ShouldSaveAudit(context.ActionDescriptor.GetMethodInfo(), true)) { return(false); } auditLog = auditLogScope.Log; auditLogAction = auditingFactory.CreateAuditLogAction( auditLog, context.ActionDescriptor.AsControllerActionDescriptor().ControllerTypeInfo.AsType(), context.ActionDescriptor.AsControllerActionDescriptor().MethodInfo, context.ActionArguments ); return(true); }
/// <summary> /// Inserts the audit log. /// </summary> /// <param name="item">The editable root item.</param> private void InsertAuditLog(IEditableRoot item) { if (AuditLogger != null) { // insert record in [audit].[current table] var obj = new AuditLogInfo { LogType = 'U', ItemId = item.Id, FieldName = Constants.Action, OldValue = GroupName, NewValue = Name }; AuditLogger(obj); } }
public void ExportStart(string processSystemName, GridViewDataControl gridView, string accessDeniedProperties) { TheWindowManager.Value.ShowStatus(new Status { IsBusy = true, Text = LanguageService.Translate("Msg_Exporting") }); var processType = TheDynamicTypeManager.Value.GetCustomType(processSystemName, "AuditLogCommand", false); var auditInfo = new AuditLogInfo { LogType = 'U', ItemId = -1, FieldName = string.Format(CultureInfo.InvariantCulture, "Exported by: {0}", Utils.CurrentUserAccountId == -1 ? "admin" : Utils.CurrentUserFullName), OldValue = string.Format(CultureInfo.InvariantCulture, "Exported process: {0}", processSystemName), NewValue = string.Format(CultureInfo.InvariantCulture, "Exported format: {0}", GetExtension(TheExportOptionsViewModel.Value.ExportFileType)) }; MethodCaller.CallFactoryMethod(processType, "BeginInsertEmailLog", new object[] { auditInfo, null }); var isDataExported = Export(gridView, accessDeniedProperties); TheWindowManager.Value.HideBusy(); if (isDataExported) { ThePopupFactory.Value.NotifySuccess(LanguageService.Translate("Msg_ProcessExported")); } else { ThePopupFactory.Value.NotifyFailure(LanguageService.Translate("Msg_ExportError")); } }
private IHttpActionResult Acknowledge(int actionId) { try { var actions = DynamicTypeManager.GetInfoListById<IInfoList>(Constants.ActionItemsProcessName, actionId); var action = actions.Cast<IActionItemInfo>().FirstOrDefault(); if (action == null) { return Ok(new { Success = false, Message = "Action Not Found." }); } var type = DynamicTypeManager.GetCustomTypeWebApi(action.Process, "AuditLogCommand", false); if (action.ItemId != null) { var obj = new AuditLogInfo { LogType = 'U', ItemId = action.ItemId.Value, NewValue = "Acknowledged by " + Utils.CurrentUserName }; Csla.Reflection.MethodCaller.CallFactoryMethod(type, "InsertAuditLog", obj); } RemoveItemCommand.Execute(Constants.ActionItemsProcessName, actionId); return Ok(new { Success = true, ActionId = actionId }); } catch (Exception ex) { Logger.Log(LogSeverity.Error, "Acknowledge", ex.ToString()); return Ok(new { Success = false, Message = "There was an error with this action, please try to refresh and repeat." }); } }
public static void BeginInsertEmailLog(AuditLogInfo obj1, EventHandler<DataPortalResult<ReflectionStub>> cb) { }
/// <summary> /// Creates the audit record. /// </summary> /// <param name="processName">Name of the process.</param> /// <param name="itemId">The item identifier.</param> /// <param name="receiverEmail">The receiver email.</param> /// <param name="subject">The subject.</param> private void CreateAuditRecord(string processName, int itemId, string receiverEmail, string subject, string sender) { if (string.IsNullOrEmpty(processName) || itemId == 0) return; var logCommandType = TheDynamicManager.GetTypeByName(processName, string.Format(CultureInfo.InvariantCulture, "Dynamic{0}.AuditLogCommand", processName)); var sentByAction = !string.IsNullOrEmpty(sender) && sender.Equals(Constants.Action); var obj = new AuditLogInfo { LogType = 'U', ItemId = itemId, FieldName = "Email", OldValue = sentByAction ? "Action Emailed" : "Email sent", NewValue = string.Format(CultureInfo.InvariantCulture, "Subject: {0}\n{1}", subject, receiverEmail) }; Csla.Reflection.MethodCaller.CallFactoryMethod(logCommandType, "InsertEmailLog", new object[] { obj }); }