示例#1
0
        private void btnRemover_Click(object sender, EventArgs e)
        {
            Exame aux = DgvExames.CurrentRow?.DataBoundItem as Exame;

            if (aux != null)
            {
                Exame aux2;
                BindingList <Exame> aux3 = new BindingList <Exame>();

                for (int i = 0; i < listaex.Count; i++)
                {
                    aux2 = listaex[i];
                    if (aux.Id == aux2.Id)
                    {
                        listaex.Remove(aux2);
                    }
                    else
                    {
                        aux3.Add(aux2);
                    }
                }
                DgvExames.ClearSelection();
                DgvExames.DataSource = aux3;
                listaex = aux3;
            }
        }
示例#2
0
        public IList <Exame> BuscarTodos()
        {
            IList <Exame> exames = new List <Exame>();

            var comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "SELECT * FROM Exame";
            Conexao       con = new Conexao();
            SqlDataReader dr  = con.Selecionar(comando);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Exame objExame = new Exame();
                    objExame.Id        = (int)dr["exameID"];
                    objExame.Descricao = (string)dr["descricao"];
                    objExame.Valor     = (decimal)dr["valor"];
                    exames.Add(objExame);
                } //fim while
            }     //fim if
            else
            {
                exames = null;
            }//fim else
            return(exames);
        }
示例#3
0
        public void RegistrarColeta(Models.Doacao.Coleta coleta)
        {
            using (var ctx = new POCContext())
            {
                var coletaDB = new Coleta
                {
                    Doador      = ctx.Doadores.Find(coleta.IDDoador),
                    DataHora    = coleta.DataHora,
                    LocalDoacao = ctx.LocaisDoacao.Find(coleta.IDLocalDoacao)
                };

                if (coleta.Exames != null)
                {
                    foreach (var exame in coleta.Exames)
                    {
                        var e = new Exame
                        {
                            Arquivo        = Convert.FromBase64String(exame.Arquivo),
                            Descricao      = "Exame",
                            FormatoArquivo = "pdf"
                        };

                        coletaDB.Exames.Add(e);
                    }
                }

                ctx.Coletas.Add(coletaDB);
                ctx.SaveChanges();
            }
        }
 public IActionResult Cadastrar(Exame exame)
 {
     _exameRepository.Cadastrar(exame);
     _exameRepository.Salvar();
     TempData["msg"] = "Exame Registrado";
     return(RedirectToAction("Index"));
 }
示例#5
0
        public Exame SelecionaPorID(int exameId)
        {
            SqlCommand comando = new SqlCommand();

            comando.CommandType = CommandType.Text;
            comando.CommandText = "Select * From Exame Where exameID=@id";
            comando.Parameters.AddWithValue("@id", exameId);
            Conexao       con      = new Conexao();
            SqlDataReader dr       = con.Selecionar(comando);
            Exame         objExame = new Exame();

            if (dr.HasRows)
            {
                dr.Read();
                //preenche o objeto
                objExame.Id        = (int)dr["exameID"];
                objExame.Descricao = (string)dr["descricao"];
                objExame.Valor     = (decimal)dr["valor"];
            }
            else
            {
                objExame = null;
            }
            return(objExame);
        }
示例#6
0
 // GET: Exames/Edit/5
 public ActionResult Edit(int?id)
 {
     ViewBag.UsuarioLogado = Utils.User.GetCookieUsuarioLogado(Request, Session);
     if (!string.IsNullOrEmpty(ViewBag.UsuarioLogado))
     {
         Utils.User.UsuarioLogado usuariologado = Utils.User.GetDadosUsuarioLogado(ViewBag.UsuarioLogado);
         ViewBag.ModuloFinanceiro = usuariologado.moduloFinanceiro;
         ViewBag.RuleAdmin        = usuariologado.admin;
         ViewBag.RuleFinanceiro   = usuariologado.RuleFinanceiro;
         ViewBag.RuleMovimentacao = usuariologado.RuleMovimentacao;
         ViewBag.RuleCadastro     = usuariologado.RuleCadastro;
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         Exame exame = db.Exames.Find(id, usuariologado.empresaId);
         if (exame == null)
         {
             return(HttpNotFound());
         }
         return(View(exame));
     }
     else
     {
         TempData["MensagemRetorno"] = "Faça Login para continuar.";
         return(Redirect("~/Login"));
     }
 }
示例#7
0
 public ActionResult Edit([Bind(Include = "ID,EmpresaID,Nome,ValorExame,ValorRepasse")] Exame exame)
 {
     ViewBag.UsuarioLogado = Utils.User.GetCookieUsuarioLogado(Request, Session);
     if (!string.IsNullOrEmpty(ViewBag.UsuarioLogado))
     {
         Utils.User.UsuarioLogado usuariologado = Utils.User.GetDadosUsuarioLogado(ViewBag.UsuarioLogado);
         ViewBag.ModuloFinanceiro = usuariologado.moduloFinanceiro;
         ViewBag.RuleAdmin        = usuariologado.admin;
         ViewBag.RuleFinanceiro   = usuariologado.RuleFinanceiro;
         ViewBag.RuleMovimentacao = usuariologado.RuleMovimentacao;
         ViewBag.RuleCadastro     = usuariologado.RuleCadastro;
         if (ModelState.IsValid)
         {
             exame.Nome            = LibProdusys.FS(exame.Nome);
             db.Entry(exame).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(exame));
     }
     else
     {
         TempData["MensagemRetorno"] = "Faça Login para continuar.";
         return(Redirect("~/Login"));
     }
 }
示例#8
0
 private void CheckIsNull(Exame entity)
 {
     if (entity is null)
     {
         throw new ServiceException("Exame não encontrado");
     }
 }
示例#9
0
 private void CheckNotContains(Exame entity)
 {
     if (_repository.Find(entity.ExameId) is null)
     {
         throw new ServiceException("Exame não cadastrado");
     }
 }
 private void CbClassificacao_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbTipo.Text == "Exame")
         {
             ExameServico _exameServico = new ExameServico();
             Exame        exame         = _exameServico.Buscar(x => x.ExameID == Convert.ToInt64(cbClassificacao.Text.Split(' ')[0])).FirstOrDefault();
             txtPreco.Text = Convert.ToString(exame.Preco);
         }
         else if (cbTipo.Text == "Vacina")
         {
             VacinaServico _vacinaServico = new VacinaServico();
             Vacina        vacina         = _vacinaServico.Buscar(x => x.VacinaID == Convert.ToInt64(cbClassificacao.Text.Split(' ')[0])).FirstOrDefault();
             txtPreco.Text = Convert.ToString(vacina.Preco);
         }
         else if (cbTipo.Text == "Consulta")
         {
             txtPreco.Text = "";
         }
         else
         {
             CirurgiaServico _cirurgiaServico = new CirurgiaServico();
             Cirurgia        cirurgia         = _cirurgiaServico.Buscar(x => x.CirurgiaID == Convert.ToInt64(cbClassificacao.Text.Split(' ')[0])).FirstOrDefault();
             txtPreco.Text = Convert.ToString(cirurgia.Preco);
         }
     }
     catch (Exception)
     { }
 }
示例#11
0
        public void UpdateExame(Exame Exame)
        {
            try
            {
                SqlConnection con = new SqlConnection(connectionString);
                con.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "[dbo].[Update-Exame]";
                cmd.Parameters.AddWithValue("@TipoExame", Exame.TipoExame);
                cmd.Parameters.AddWithValue("@Exame", Exame.Exame);
                cmd.Parameters.AddWithValue("@HrDt", Exame.HrDt);
                cmd.Parameters.AddWithValue("@MedicoId", Exame.IdMedico);
                cmd.Parameters.AddWithValue("@PacienteId", Exame.IdPaciente);

                cmd.ExecuteNonQuery();

                con.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#12
0
        public void SelectExame(Exame Exame)
        {
            try
            {
                SqlConnection con = new SqlConnection(connectionString);
                con.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "[dbo].[Select-Exame]";

                cmd.Parameters.AddWithValue("@Exame", Exame.Exame);

                SqlDataReader rdr = null;
                rdr = cmd.ExecuteReader();

                string TipoExame  = rdr["TipoExame"].ToString();
                string NomeExame  = rdr["Exame"].ToString();
                string HrDt       = rdr["HrDt"].ToString();
                string MedicoId   = rdr["fk_MedicoId"].ToString();
                string PacienteId = rdr["fk_PacienteId"].ToString();


                con.Close();
            }
            catch (Exception)
            {
                throw;
            }
        }
        public IActionResult DeleteConfirmed(int Id)
        {
            Exame exame = exam.GetExame(Id);

            exam.DeleteExame(Id);
            return(RedirectToAction("Index", new { pacienteId = exame.PacienteId }));
        }
示例#14
0
        public List <Exame> BuscarExames(string cpf)
        {
            dao = new ConexaoDAO();

            List <Exame> exames = new List <Exame>();

            try
            {
                string readCommand = "SELECT * FROM Exames where Id_Paciente = @cpf";

                MySqlCommand m = new MySqlCommand(readCommand, dao.conexao);
                m.Parameters.AddWithValue("@cpf", cpf);

                var resultado = m.ExecuteReader();

                Exame exame = new Exame();

                while (resultado.Read())
                {
                    exame.id_exame  = Convert.ToString(resultado["Id_Exame"]);
                    exame.cpf       = Convert.ToString(resultado["Id_Paciente"]);
                    exame.crm       = Convert.ToString(resultado["Id_Medico"]);
                    exame.descricao = Convert.ToString(resultado["Descricao"]);

                    exames.Add(exame);
                }

                return(exames);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
示例#15
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Exame exame = db.Exames.Find(id);

            if (exame == null)
            {
                return(HttpNotFound());
            }

            ExameViewModel tipoExameViewModel = new ExameViewModel();
            var            tipoExames         = db.TiposExames.ToList();

            foreach (var item in tipoExames)
            {
                tipoExameViewModel.ListarTiposExamesViewModel.Add(new SelectListItem()
                {
                    Text  = Convert.ToString(item.TipoExameID) + " - " + item.NomeTipoExame,
                    Value = Convert.ToString(item.TipoExameID),
                });
            }

            tipoExameViewModel.ExameID         = exame.ExameID;
            tipoExameViewModel.TipoExameID     = exame.TipoExameID;
            tipoExameViewModel.NomeExame       = exame.NomeExame;
            tipoExameViewModel.ObservacaoExame = exame.ObservacaoExame;

            return(View(tipoExameViewModel));
        }
示例#16
0
        public Exame DetalhesExame(int COD_EXAME)
        {
            MySqlConnection msc = new MySqlConnection("server=localhost; uid=root; pwd=123456789; database=bd_clinicare");

            msc.Open();

            MySqlDataAdapter msda = new MySqlDataAdapter("select * from tb_exame where COD_EXAME = " + COD_EXAME, msc);

            DataSet ds = new DataSet();

            msda.Fill(ds);

            msc.Close();

            List <Exame> lista = new List <Exame>();

            Exame item = new Exame();

            if (ds.Tables[0].Rows.Count > 0)
            {
                item.COD_EXAME  = int.Parse(ds.Tables[0].Rows[0]["COD_EXAME"].ToString());
                item.COD_PAC    = int.Parse(ds.Tables[0].Rows[0]["COD_PAC"].ToString());
                item.NOME_EXAME = ds.Tables[0].Rows[0]["NOME_EXAME"].ToString();
                item.DATA_EXAME = DateTime.Parse(ds.Tables[0].Rows[0]["DATA_EXAME"].ToString());
                item.NOME_LAB   = ds.Tables[0].Rows[0]["NOME_LAB"].ToString();
                item.HORA_EXAME = DateTime.Parse(ds.Tables[0].Rows[0]["HORA_EXAME"].ToString());
                //item.ARQ_EXAME = ds.Tables[0].Rows[0]["ARQ_EXAME"].ToString();
                item.COD_MED   = int.Parse(ds.Tables[0].Rows[0]["COD_MED"].ToString());
                item.OBS_EXAME = ds.Tables[0].Rows[0]["OBS_EXAME"].ToString();
            }

            return(item);
        }
        public async Task <IActionResult> PutExame([FromRoute] int id, [FromBody] Exame exame)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != exame.Id)
            {
                return(BadRequest());
            }

            _context.Entry(exame).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ExameExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
示例#18
0
        public string PersistExame(Exame Exame)
        {
            try
            {
                SqlConnection con = new SqlConnection(connectionString);
                con.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = con;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "[dbo].[Insert-Exame]";
                cmd.Parameters.AddWithValue("@TipoExame", Exame.TipoExame);
                cmd.Parameters.AddWithValue("@HrDt", Exame.HrDt);
                cmd.Parameters.AddWithValue("@MedicoId", Exame.IdMedico);
                cmd.Parameters.AddWithValue("@PacienteId", Exame.IdPaciente);
                cmd.ExecuteNonQuery();

                con.Close();
                return("Sucesso");
            }
            catch (Exception)
            {
                return("Erro!");
                //throw;
            }
        }
示例#19
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nomeexame,Observacao,TipoExameId")] Exame exame)
        {
            if (id != exame.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exame);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExameExists(exame.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TipoExameId"] = new SelectList(_context.tipoExames, "Id", "Nometipo", exame.TipoExameId);
            return(View(exame));
        }
示例#20
0
        public ActionResult FazerExame(string IdCandidatura)
        {
            var candidatura  = CandidaturaRepositorio.BuscarPeloId(IdCandidatura);
            var questionario = QuestionarioRepositorio.BuscarTodos().Where(q => q.AreaCandidaturaId == candidatura.AreaCandidaturaId).FirstOrDefault();

            Exame exame;

            exame = new Exame
            {
                Ativo          = true,
                CandidaturaId  = candidatura.Id,
                QuestionarioId = questionario.Id,
                Pontos         = 0,
            };

            db.Exames.Add(exame);
            db.SaveChanges();


            ViewBag.ExameId = exame.Id;


            if (questionario == null)
            {
                ViewBag.Mensagem = "Erro ao realizar exame, verifique o estado da sua candidatura!";

                return(View());
            }

            return(View(questionario));
        }
示例#21
0
    protected void btnAlterar_Click(object sender, EventArgs e)
    {
        Paciente        paciente        = this.obterPaciente();
        Exame           exame           = this.obterExame();
        RequisicaoExame requisicaoExame = (RequisicaoExame)Session["requisicaoExame"];

        if (exame.ListaConvenio.Contains(paciente.NomeConvenio))
        {
            requisicaoExame.NomeConvenio      = paciente.NomeConvenio;
            requisicaoExame.NomeExame.Nome    = ddlExame.Text;
            requisicaoExame.NomePaciente.Nome = ddlPaciente.Text;
            requisicaoExame.Observacoes       = rdbObservacoes.SelectedValue;
            requisicaoExame.Valor             = Convert.ToDouble(txtBoxValor.Text);
            ddlPaciente.SelectedIndex         = -1;
            ddlExame.SelectedIndex            = -1;
            rdbObservacoes.SelectedIndex      = -1;
            txtBoxValor.Text = "";
            this.ExibirMensagem("Alteração Realizado com Sucesso !!!");
        }
        else
        {
            this.ExibirMensagem("Este Exame Não É Feito Pelo Convenio !!!");
            return;
        }
    }
示例#22
0
        public async Task <IActionResult> Edit(int id, [Bind("IDExame,DiagnosticoExame,Descricao")] Exame exame)
        {
            if (id != exame.IDExame)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exame);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExameExists(exame.IDExame))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(exame));
        }
示例#23
0
    protected void btnCadastrar_Click(object sender, EventArgs e)
    {
        Paciente paciente = this.obterPaciente();
        Exame    exame    = this.obterExame();
        int      contador = 0;

        if (exame.ListaConvenio.Contains(paciente.NomeConvenio))
        {
            contador = Convert.ToInt32(Application["contadorRequisicao"]) + 1;
            Application["contadorRequisicao"] = contador;
            RequisicaoExame requisicaoExame = new RequisicaoExame(paciente, exame, CalendarioConsulta.SelectedDate,
                                                                  rdbObservacoes.Text, Convert.ToDouble(txtBoxValor.Text), paciente.NomeConvenio, contador);

            List <RequisicaoExame> lista = (List <RequisicaoExame>)Session["listaRequisicao"];
            lista.Add(requisicaoExame);
            ddlPaciente.SelectedIndex    = -1;
            ddlExame.SelectedIndex       = -1;
            rdbObservacoes.SelectedIndex = -1;
            txtBoxValor.Text             = "";
            this.ExibirMensagem("Cadastramento Realizado com Sucesso");
            return;
        }
        else
        {
            this.ExibirMensagem("Convênio do paciente não permite a realização deste exame !!!");
            return;
        }
    }
 private void GetDependeny(Exame entity)
 {
     if (!(entity is null))
     {
         _dbContext.Entry(entity).Reference(b => b.TipoExame).Load();
     }
 }
 public void ValidateDependency(Exame entity)
 {
     if (_dbContext.TipoExames.Find(entity.TipoExameId) is null)
     {
         throw new RepositoryException("Tipo Exame não cadastrado");
     }
 }
示例#26
0
        public JsonResult Pesquisar(DatatableParm parm, Exame item)
        {
            try
            {
                SalvarPesquisa(item, parm);
                var items = exameService.GetAllByPage(item, parm);

                return(Json(new
                {
                    ok = true,
                    sEcho = parm.sEcho,
                    iTotalRecords = items.Count(),
                    iTotalDisplayRecords = parm.totalRecords,
                    aaData = items.Select(x => new
                    {
                        IdeExame = x.IdeExame,
                        Colaborador = new {
                            NomColaborador = x.Colaborador.NomColaborador
                        },
                        Laboratorio = new {
                            NomRazaoSocial = x.Laboratorio.NomRazaoSocial
                        },
                        DatExame = x.DatExame.ToString("dd/MM/yyyy"),
                        NomMedico = x.NomMedico,
                        NumCRMMedico = x.NumCRMMedico
                    })
                }));
            }
            catch (Exception ex)
            {
                return(Json(CreateMessageDatatable(ex)));
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Descricao,Custo,SexoPaciente,IdadePaciente,Parametro,ValorMinimo,ValorMaximo")] Exame exame)
        {
            if (id != exame.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(exame);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExameExists(exame.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(exame));
        }
示例#28
0
        public IActionResult Adicionar(Exame exame)
        {
            _exameRepository.Cadastrar(exame);
            _exameRepository.Salvar();
            TempData["msg"] = "Exame cadastrado";

            return(RedirectToAction("Adicionar"));
        }
 public ActionResult <Exame> Post(Exame exame)
 {
     _exameRepository.Cadastrar(exame);
     _exameRepository.Salvar();
     //Rretorna o status 201 Created, Link para acessar o produto registrado
     //e o produto registrado
     return(CreatedAtAction("Get", new { id = exame.ExameId }, exame));
 }
示例#30
0
 public virtual void AdicionarExame(Exame exame)
 {
     if (exame == null)
     {
         throw new ArgumentException("Exame está nulo!!!");
     }
     ((IList <Exame>)Exames).Add(exame);
 }
示例#31
0
 public List<Exame> ListExame()
 {
     var list = new List<Exame>();
     var Exame = new Exame { Id = 1, TipoExame = "Laboratorio", Resultado = "Resultado", DataExame = "20/10/2012" };
     var Exame2 = new Exame { Id = 1, TipoExame = "Laboratorio", Resultado = "Resultado", DataExame = "20/10/2012" };
     list.Add(Exame);
     list.Add(Exame2);
     return list;
 }
示例#32
0
 public virtual void AdicionarExame(Exame exame)
 {
     if(exame==null)
             throw new ArgumentException("Exame está nulo!!!");
     ((IList<Exame>) Exames).Add(exame);
 }
示例#33
0
        public override void AdicionarExame(Exame exame)
        {
            if (exame == null)
                throw new ArgumentException("Exame está nulo!!!");

            if (string.IsNullOrEmpty(exame.Procedimento.CBHPM))
                throw new ArgumentException("Exame.Procedimento está nulo ou vazio, verifique !!!");

            ((IList<Exame>)Exames).Add(exame);
        }