private void ActivateIncident(Guid?incidentId, string selectionType) { if (incidentId == null || incidentId.Value == Guid.Empty) { return; } var incident = _incidentXrmRepository.FindEntityById((Guid)incidentId); if (incident?.StateCode == null || (incident.StateCode != null && incident.StateCode.Value != IncidentState.Active)) { return; } var zSupport = _systemUserService.GetZSupportSystemUser(); var commentIncidentModel = new CommentIncidentModel { IncidentId = incidentId, CommentString = "Обращение активировано по истечению срока актуальности комментариев.", NoteTextAnnotation = "Обращение активировано по истечению срока актуальности комментариев.", SubjectAnnotation = $"*service* *IncidentActivationService* *{selectionType}* *{zSupport?.FullName}* *Support:{zSupport?.NickName}*", StateInternalOptionSetValue = new OptionSetValue((int)StateInternalIncidentType.Awaiting), }; _incidentService.AddComment(commentIncidentModel); }