protected void Button2_Click(object sender, EventArgs e) { try { string Id = TextBoxId.Text; string NombreMascota = TextBoxNomMasc.Text; string Raza = TextBoxRaza.Text; string FechaNac = TextBoxFechaNac.Text; string Genero = DropDownListGenero.SelectedValue.ToString(); string Foto = TextBoxFoto.Text; string RutDueno = TextBoxRutDueno.Text; string NombreDueno = TextBoxNomDueno.Text; if (!Id.Equals("") && !NombreMascota.Equals("") && !Raza.Equals("") && !FechaNac.Equals("") && !Genero.Equals("") && !Foto.Equals("") && !RutDueno.Equals("") && !NombreDueno.Equals("")) { Paciente paciente = new Paciente(int.Parse(Id), NombreMascota, Raza, DateTime.Parse(FechaNac), Genero, Foto, RutDueno, NombreDueno); if (PacienteDAO.Agregar(paciente) == true) { LabelError.Text = ""; LabelOk.Text = "Bien, paciente creado"; } else { LabelOk.Text = ""; LabelError.Text = "Error, paciente ya existe"; } } else { LabelOk.Text = ""; LabelError.Text = "Error, hay campos vacios"; } } catch (Exception ex) { LabelOk.Text = ""; LabelError.Text = "Error, hay campos vacios"; } }