public ActionResult cadPaciente(modelPaciente pac)
        {
            acPac.inserirPaciente(pac);

            ViewBag.confCadastro = "Cadastro Realizado com sucesso";
            return(View());
        }
 public ActionResult AtualizaPaciente(modelPaciente pac)
 {
     acPac.consultaBuscaPaciente(pac);
     cod          = pac.CodPac;
     ViewBag.nome = pac.NomePac;
     ViewBag.tel  = pac.Telpac;
     return(View());
 }
Esempio n. 3
0
        public void excluirPaciente(modelPaciente pac)
        {
            MySqlCommand cmd = new MySqlCommand("delete from tbPaciente where codPac=@codPac", con.MyConectarBD());

            cmd.Parameters.Add("@codPac", MySqlDbType.VarChar).Value = pac.CodPac;
            cmd.ExecuteNonQuery();
            con.MyDesconectarBD();
        }
Esempio n. 4
0
        public void atualizarPaciente(modelPaciente pac)
        {
            MySqlCommand cmd = new MySqlCommand("update tbPaciente set nomePac=@nomePac, telPac=@telPac where codPac=@codPac", con.MyConectarBD());

            cmd.Parameters.Add("@codPac", MySqlDbType.VarChar).Value  = pac.CodPac;
            cmd.Parameters.Add("@nomePac", MySqlDbType.VarChar).Value = pac.NomePac;
            cmd.Parameters.Add("@telPac", MySqlDbType.VarChar).Value  = pac.Telpac;

            cmd.ExecuteNonQuery();
            con.MyDesconectarBD();
        }
Esempio n. 5
0
        public void inserirPaciente(modelPaciente cm)
        {
            MySqlCommand cmd = new MySqlCommand("insert into tbPaciente values(@codPac, @nomePac, @telPac)", con.MyConectarBD());

            cmd.Parameters.Add("@codPac", MySqlDbType.VarChar).Value  = cm.CodPac;
            cmd.Parameters.Add("@nomePac", MySqlDbType.VarChar).Value = cm.NomePac;
            cmd.Parameters.Add("@telPac", MySqlDbType.VarChar).Value  = cm.Telpac;

            cmd.ExecuteNonQuery();
            con.MyDesconectarBD();
        }
Esempio n. 6
0
        public DataTable buscaPaciente(modelPaciente pac)
        {
            MySqlCommand cmd = new MySqlCommand("select * from tbPaciente where codPac=@cod", con.MyConectarBD());

            cmd.Parameters.AddWithValue("@cod", pac.CodPac);
            MySqlDataAdapter da         = new MySqlDataAdapter(cmd);
            DataTable        agendaClin = new DataTable();

            da.Fill(agendaClin);
            con.MyDesconectarBD();
            return(agendaClin);
        }
        public ActionResult buscaPaciente(modelPaciente pac)
        {
            GridView dgv = new GridView();               // Instância para a tabela

            dgv.DataSource = acPac.buscaPaciente(pac);   //Atribuir ao grid o resultado da consulta
            dgv.DataBind();                              //Confirmação do Grid
            StringWriter   sw  = new StringWriter();     //Comando para construção do Grid na tela
            HtmlTextWriter htw = new HtmlTextWriter(sw); //Comando para construção do Grid na tela

            dgv.RenderControl(htw);                      //Comando para construção do Grid na tela
            ViewBag.GridViewString = sw.ToString();      //Comando para construção do Grid na tela
            return(View());
        }
Esempio n. 8
0
        public void consultaBuscaPaciente(modelPaciente pac)
        {
            MySqlCommand cmd = new MySqlCommand("select * from tbPaciente where codPac=@codPac", con.MyConectarBD());

            cmd.Parameters.AddWithValue("@codPac", pac.CodPac);
            MySqlDataAdapter da = new MySqlDataAdapter(cmd);

            dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                pac.CodPac = dr[0].ToString();

                pac.NomePac = dr[1].ToString();

                pac.Telpac = dr[2].ToString();
            }
            con.MyDesconectarBD();
        }
 public ActionResult confExcluirPaciente(modelPaciente pac)
 {
     pac.CodPac = cod;
     acPac.excluirPaciente(pac);
     return(View());
 }
 public ActionResult confAtualizaPaciente(modelPaciente pac)
 {
     pac.CodPac = cod;
     acPac.atualizarPaciente(pac);
     return(View());
 }