Esempio n. 1
0
        public CommandResult GetExam(Guid idExam)
        {
            //return _repository.GetExamAsQueryResult(idExam);
            var command = new GetExamCommand
            {
                IdExam = idExam
            };

            var result = (CommandResult)_handler.Handle(command);

            return(result);
        }
Esempio n. 2
0
        public ICommandResult Handle(GetExamCommand command)
        {
            var exam = _repository.GetExam(command.IdExam);

            if (exam == null)
            {
                return(new CommandResult(false, "Exame não encontrado", Notifications));
            }

            var frames = exam.Frames;

            exam.ClearFrames();

            foreach (var frame in frames)
            {
                var framesAdc = frame.Analog[exam.Channel];
                var realValue = SensorService.GetTransferFunction(Convert.ToDouble(framesAdc), exam.Type);
                frame.Analog[exam.Channel] = realValue;

                exam.AddFrame(frame);
            }

            return(new CommandResult(true, "Exame obtido com sucesso", exam));
        }