public bool Handles(AuditEvent auditEvent)
        {
            MSTeamsAuditEventSettings auditEventSettings = _msTeamsAuditEventSettingsList == null ? null : _msTeamsAuditEventSettingsList.Find(s => s.EventTypeId == auditEvent.EventTypeID && s.MessageCreatorId == this.Id);

            if (auditEventSettings == null || auditEventSettings.PostMessageSettings == null || !auditEventSettings.PostMessageSettings.Enabled)
            {
                return(false);
            }
            return(true);
        }
Example #2
0
        public void Insert(AuditEvent auditEvent)
        {
            if (Handles(auditEvent))
            {
                MSTeamsAuditEventSettings auditEventSettings = _msTeamsAuditEventSettings.Find(aes => aes.EventTypeId == auditEvent.EventTypeID);

                //AuditEventTypeRepository auditEventTypeRepository = new AuditEventTypeRepository();

                // Get event type
                AuditEventType auditEventType = _auditEventTypeRepository.GetByID(auditEvent.EventTypeID);

                // Perform action(s)
                if (auditEventSettings.PostMessageSettings != null && auditEventSettings.PostMessageSettings.Enabled)
                {
                    IMSTeamsMessageCreator messageCreator = _msTeamsMessageCreators.Where(ec => ec.Handles(auditEvent)).FirstOrDefault();
                    messageCreator.PostMessage(auditEvent, auditEventType, auditEventSettings.PostMessageSettings);
                }
            }
        }
Example #3
0
        private bool Handles(AuditEvent auditEvent)
        {
            MSTeamsAuditEventSettings auditEventSettings = _msTeamsAuditEventSettings.Find(aes => aes.EventTypeId == auditEvent.EventTypeID);

            return(auditEventSettings != null && auditEventSettings.PostMessageSettings != null && auditEventSettings.PostMessageSettings.Enabled);
        }