Beispiel #1
0
        private async void Mapear(Resultado reg, IniciaResultadoDto dto)
        {
            var consulta = await _repConsulta.GetConsultaAlunoAsyncById(dto.hashSimulacao);

            if (consulta == null)
            {
                throw new Exception("Erro ao carregar consulta código :" + dto.hashSimulacao);
            }

            reg.DataHora          = DateTime.Now;
            reg.AlunoId           = dto.AlunoId;
            reg.NomeAluno         = _repUser.GetUserById(dto.AlunoId).Result.FullName;
            reg.ProfessorId       = consulta.UserId;
            reg.NomeProfessor     = _repUser.GetUserById(reg.ProfessorId).Result.FullName;
            reg.HashLib           = dto.hashSimulacao;
            reg.PercAcertPergunta = 0;
            reg.PercAcertExame    = 0;
            reg.Finalizado        = false;
            reg.NomePaciente      = consulta.NomePaciente;
            reg.DataNascimento    = consulta.DataNascimento.ToString();
            reg.Sexo            = consulta.Sexo;
            reg.TipoAtendimento = consulta.TipoAtendimento;
            reg.QueixaPrincipal = consulta.QueixaPrincipal;
            reg.InicioSintomas  = consulta.InicioSintomas;
            reg.QtdMaxExame     = consulta.QtdMaxExame;
            reg.QtdMaxPergunta  = consulta.QtdMaxPergunta;

            reg.PerguntaRespostasResultados = new List <PerguntaRespostaResultado>();
            reg.ExameResultados             = new List <ExameResultado>();

            if (consulta.PerguntaRespostas.Any())
            {
                consulta.PerguntaRespostas.ForEach(pergResp =>
                {
                    reg.PerguntaRespostasResultados.Add(new PerguntaRespostaResultado
                    {
                        Pergunta    = pergResp.Pergunta,
                        Resposta    = pergResp.Resposta,
                        Certa       = pergResp.Certa,
                        Selecionada = false
                    });
                });
            }

            if (consulta.Exames.Any())
            {
                consulta.Exames.ForEach(exame =>
                {
                    var exameResult = new ExameResultado
                    {
                        Nome        = exame.Nome,
                        ImgExame    = exame.ImgExame,
                        Certa       = exame.Certa,
                        Selecionada = false
                    };

                    reg.ExameResultados.Add(exameResult);
                });
            }
        }
Beispiel #2
0
 public bool SetExameResultado(AtendeExameViewModel vm)
 {
     try
     {
         foreach (var item in vm.QnAs)
         {
             ExameResultado exameResultado = new ExameResultado();
             exameResultado.EstudanteId = vm.EstudanteId;
             exameResultado.QnAsId      = item.Id;
             exameResultado.ExameId     = item.ExameId;
             exameResultado.Responder   = item.Responder;
             _unitOfWork.GenericRepository <ExameResultado>().AddAsync(exameResultado);
         }
         _unitOfWork.Save();
         return(true);
     }
     catch (Exception ex)
     {
         _ILogger.LogError(ex.Message);
     }
     return(false);
 }