예제 #1
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            if (Validado())
            {
                try
                {
                    String Sexo = "";
                    if (radioButtonHembra.Checked)
                    {
                        Sexo = "HEMBRA";
                    }
                    if (radioButtonMacho.Checked)
                    {
                        Sexo = "MACHO";
                    }
                    if (radioButtonHermafrodita.Checked)
                    {
                        Sexo = "HERMAFRODITA";
                    }
                    ClaseMascota mascota = new ClaseMascota(Convert.ToInt32(this.txtIdMascota.Text), this.txtNombreMascota.Text,
                                                            Convert.ToInt32(this.txtIdRaza.Text), this.dateTimeFechaNacimiento.Value,
                                                            Sexo, this.txtIDColor.Text, Convert.ToInt32(this.txtIdDueño.Text));

                    MessageBox.Show("Registro Ingresado");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Registro no ingresado. Datos no validados");
            }
        }
예제 #2
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("¿Esta seguro de que desea eliminar este registro?", "Eliminar",
                             MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
         {
             MessageBox.Show("Resultado: " + ClaseMascota.Eliminar(Convert.ToInt32(this.txtIdMascota.Text)));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }