protected void LogAudit(ModelType modelType, dynamic model, string filePath, string requestType, long customerId) { if (!IoC.Resolve <ISettings>().AuditEnabled) { return; } try { if (modelType == ModelType.Edit) { _modelId = _auditLogFilterHelper.GetEditModelIdValue(model); } _activityType = modelType == ModelType.Edit && _modelId > 0 ? Type.Updated : (modelType == ModelType.Edit ? Type.Created : Type.Retrieved); var logModel = _auditLogFilterHelper.GetActivityLogEditModel(filePath, requestType, model, _activityType.ToString()); if (customerId > 0) { logModel.CustomerId = customerId; } _auditLogFilterHelper.LogModel(modelType, logModel, model); } catch (Exception ex) { var logger = IoC.Resolve <ILogManager>().GetLogger("BaseWebService"); logger.Error("Error in BaseWebService LogAudit", ex); } }
protected void LogAudit(ModelType modelType, dynamic model, long customerId) { if (!IoC.Resolve <ISettings>().AuditEnabled) { return; } try { if (modelType == ModelType.Edit) { _modelId = _auditLogFilterHelper.GetEditModelIdValue(model); } _activityType = modelType == ModelType.Edit && _modelId > 0 ? Type.Updated : (modelType == ModelType.Edit ? Type.Created : Type.Retrieved); var logModel = _auditLogFilterHelper.GetActivityLogEditModel(this.Request, model, _activityType.ToString()); if (logModel != null) { if (customerId > 0) { logModel.CustomerId = customerId; } _auditLogFilterHelper.LogModel(modelType, logModel, model); } else { var logger = IoC.Resolve <ILogManager>().GetLogger("BasePage"); logger.Info("Session is null while Saving Audit Data"); } } catch (Exception ex) { var logger = IoC.Resolve <ILogManager>().GetLogger("BasePage"); logger.Error("Error in BasePage LogAudit"); logger.Error("Message: " + ex.Message); logger.Error("Stack Trace: " + ex.StackTrace); } }