private void SetStateInternalToClosed(Guid?incidentId) { 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(); const string comment = "Подтверждения от клиента об актуальности обращения не было получено в течение 5ти рабочих дней."; var commentIncidentModel = new CommentIncidentModel { IncidentId = incidentId, CommentString = comment, NoteTextAnnotation = $"*WEB* {comment} Обращению присвоен статус \"Закрыто\".", SubjectAnnotation = $"*WEB* *IncidentActivationService* *{zSupport?.FullName}* *Support:{zSupport?.NickName}*", StateInternalOptionSetValue = new OptionSetValue((int)StateInternalIncidentType.Closed), }; _incidentService.AddComment(commentIncidentModel); }
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); }