private void button5_Click(object sender, EventArgs e)
        {
            AnimalesCAD animalCAD = null;
            int i;
            if (dataGridView2.Visible == true)
            {
                i = dataGridView2.CurrentCell.RowIndex;
                tbCliente.Text = dataGridView2.Rows[i].Cells[1].Value.ToString();// aqui cojo el nombre del cliente
                Cliente_OID = dataGridView2.Rows[i].Cells[0].Value.ToString();// aqui cojo el id del cliente.
            }
            else
            {
                animalCAD = new AnimalesCAD();
                i = dataGridView1.CurrentCell.RowIndex;
                tbID.Enabled = false;
                if (animalCAD.ReadOID(dataGridView1.Rows[i].Cells[0].Value.ToString()) != null)
                {
                    tbRaza.Text = dataGridView1.Rows[i].Cells[3].Value.ToString();
                    tbNombre.Text = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    tbCategoria.Text = dataGridView1.Rows[i].Cells[2].Value.ToString();
                    tbColor.Text = dataGridView1.Rows[i].Cells[5].Value.ToString();
                    tbSexo.Text = dataGridView1.Rows[i].Cells[4].Value.ToString();
                    tbObservaciones.Text = dataGridView1.Rows[i].Cells[6].Value.ToString();
                    tbID.Text = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    tbEdad.Text = dataGridView1.Rows[i].Cells[7].Value.ToString();

                }
                else
                {
                    MessageBox.Show("El cliente no existe");
                }
            }
        }
 private void button1_Click(object sender, EventArgs e)
 {
     btInsertarDueño.Enabled = true;
     AnimalesCAD animalCAD = new AnimalesCAD();
     AnimalesCEN animalCEN = null;
     tbID.Enabled = true;
     btInsertarDueño.Text = "Insertar";
     if (animalCAD.ReadOID(tbID.Text) == null)
     {
         if (tbNombre.Text != "" && tbColor.Text != "" && tbRaza.Text != "" && tbSexo.Text != "" && tbEdad.Text != "" && tbID.Text != "" && tbCategoria.Text != "" && tbObservaciones.Text != "")
         {
             animalCEN = new AnimalesCEN();
             animalCEN.Nuevo_animal(tbNombre.Text, tbID.Text, tbCategoria.Text, tbRaza.Text, tbSexo.Text, tbColor.Text, tbObservaciones.Text, Convert.ToInt16(tbEdad.Text));
             MessageBox.Show("Animal insertado correctamente");
             dataGridView2.Visible = true;
             label12.Visible = true;
             button6.Enabled = false;
             if (dataGridView2.Visible == true)
             {
                 dataGridView1.Visible = false;
                 button1.Enabled = false;
                 button2.Enabled = false;
                 button3.Enabled = false;
                 groupBox1.Enabled = false;
             }
            Dame_Todos();
         }
         else
         {
             MessageBox.Show("Tienes que rellenar todos los datos");
         }
     }
     else
     {
         MessageBox.Show("El animal ya existe");
         Limpiar();
     }
 }
 private void button2_Click(object sender, EventArgs e)
 {
     if (tbNombre.Text != "" && tbColor.Text != "" && tbRaza.Text != "" && tbSexo.Text != "" && tbEdad.Text != "" && tbID.Text != "" && tbCategoria.Text != "" && tbObservaciones.Text != "")
     {
         tbID.Enabled = true;
         AnimalesCAD animalCAD = new AnimalesCAD();
         AnimalesCEN animalCEN = new AnimalesCEN();
         int i;
         i = dataGridView1.CurrentCell.RowIndex;
         animalCEN.Modify(tbID.Text, tbNombre.Text, tbCategoria.Text, tbRaza.Text, tbSexo.Text, tbColor.Text, tbObservaciones.Text, Convert.ToInt32(tbEdad.Text));
         MessageBox.Show("Modificación correcta");
      //   this.animalesTableAdapter1.Fill(this.veterinaryManagerGenNHibernateDataSet22.Animales);
         Dame_Todos();
         Limpiar();
     }
     else
     {
         MessageBox.Show("Tienes que introducir todos los campos");
     }
 }