public ActionResult cadDentista(modelDentista dent) { acDent.inserirDentista(dent); ViewBag.confCadastro = "Cadastro Realizado com sucesso"; return(View()); }
public void excluirDentista(modelDentista dent) { MySqlCommand cmd = new MySqlCommand("delete from tbDentista where codDentista=@codDentista", con.MyConectarBD()); cmd.Parameters.Add("@codDentista", MySqlDbType.VarChar).Value = dent.CodDentista; cmd.ExecuteNonQuery(); con.MyDesconectarBD(); }
public ActionResult AtualizaDentista(modelDentista dent) { acDent.consultaBuscaDentista(dent); cod = dent.CodDentista; ViewBag.nome = dent.NomeDentista; ViewBag.tel = dent.TelDentista; ViewBag.email = dent.EmailDentista; return(View()); }
public void atualizarDentista(modelDentista dent) { MySqlCommand cmd = new MySqlCommand("update tbDentista set nomeDentista=@nomeDentista, telDentista=@telDentista, emailDentista=@emailDentista where codDentista=@codDentista", con.MyConectarBD()); cmd.Parameters.Add("@codDentista", MySqlDbType.VarChar).Value = dent.CodDentista; cmd.Parameters.Add("@nomeDentista", MySqlDbType.VarChar).Value = dent.NomeDentista; cmd.Parameters.Add("@telDentista", MySqlDbType.VarChar).Value = dent.TelDentista; cmd.Parameters.Add("@emailDentista", MySqlDbType.VarChar).Value = dent.EmailDentista; cmd.ExecuteNonQuery(); con.MyDesconectarBD(); }
public DataTable buscaDentista(modelDentista dent) { MySqlCommand cmd = new MySqlCommand("select * from tbDentista where codDentista=@codDentista", con.MyConectarBD()); cmd.Parameters.AddWithValue("@codDentista", dent.CodDentista); MySqlDataAdapter da = new MySqlDataAdapter(cmd); DataTable agendaClin = new DataTable(); da.Fill(agendaClin); con.MyDesconectarBD(); return(agendaClin); }
public void inserirDentista(modelDentista cm) { MySqlCommand cmd = new MySqlCommand("insert into tbDentista values(@codDentista, @nomeDentista, @telDentista, @emailDentista)", con.MyConectarBD()); cmd.Parameters.Add("@codDentista", MySqlDbType.VarChar).Value = cm.CodDentista; cmd.Parameters.Add("@nomeDentista", MySqlDbType.VarChar).Value = cm.NomeDentista; cmd.Parameters.Add("@telDentista", MySqlDbType.VarChar).Value = cm.TelDentista; cmd.Parameters.Add("@EmailDentista", MySqlDbType.VarChar).Value = cm.EmailDentista; cmd.ExecuteNonQuery(); con.MyDesconectarBD(); }
public ActionResult buscaDentista(modelDentista dent) { GridView dgv = new GridView(); // Instância para a tabela dgv.DataSource = acDent.buscaDentista(dent); //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()); }
public void consultaBuscaDentista(modelDentista dent) { MySqlCommand cmd = new MySqlCommand("select * from tbDentista where codDentista=@codDentista", con.MyConectarBD()); cmd.Parameters.AddWithValue("@codDentista", dent.CodDentista); MySqlDataAdapter da = new MySqlDataAdapter(cmd); dr = cmd.ExecuteReader(); while (dr.Read()) { dent.CodDentista = dr[0].ToString(); dent.NomeDentista = dr[1].ToString(); dent.TelDentista = dr[2].ToString(); dent.EmailDentista = dr[3].ToString(); } con.MyDesconectarBD(); }
public ActionResult confExcluirDentista(modelDentista dent) { dent.CodDentista = cod; acDent.excluirDentista(dent); return(View()); }
public ActionResult confAtualizaDentista(modelDentista dent) { dent.CodDentista = cod; acDent.atualizarDentista(dent); return(View()); }