Пример #1
0
        public async Task <Answer <String[][]> > GetReasons(ReasonType reasonType, CancellationToken cancellationToken = default(CancellationToken))
        {
            var urlParameters = new Dictionary <String, String>
            {
                ["type"] = reasonType.ToString()
            };
            var answer = await _apiInstance.RequestPostAsync(this, urlParameters, cancellationToken : cancellationToken);

            JsonSerializerSettings settings = new JsonSerializerSettings()
            {
                ContractResolver = new ApiEntities.Base.EntityContractResolver("reasons")
            };

            return(JsonConvert.DeserializeObject <ApiEntities.Base.Answer <String[][]> >(answer, settings));
        }
Пример #2
0
        public void CannotHandle(Alert alert, Person responsible, ReasonType reason)
        {
            var nextResponsible = _scheduleManager.GetNextPersonInCharge(responsible);

            if (nextResponsible == null)
            {
                JanelObserver.EventManager.Dispatch(new ErrorOccurred($"No one can handle alert {alert.Id}"));
                return;
            }

            alert.Status       = StatusType.Transferring;
            alert.Description += $"\n\n {responsible.Name} cannot take it because {reason.ToString()}";
            alert.UpdatedAt    = _dateTimeManager.GetNow();

            _unitOfWork.AlertRepository.Update(alert);

            JanelObserver.EventManager.Dispatch(new AlertChanged(alert, StatusType.Transferring.ToString(), responsible.Name));
            JanelObserver.EventManager.Dispatch(new AlertReceived(alert, nextResponsible));
        }