Exemplo n.º 1
0
 private void btnCrear_Click_1(object sender, EventArgs e)
 {
     tarjeta.fecha_emision     = dateEmision.Value.Date;
     tarjeta.fecha_vencimiento = dateVencimiento.Value.Date;
     tarjeta.cod_seguridad     = (int?)Convert.ToInt32(txtCodigo.Text);
     tarjeta.emisor            = ((Emisor)cmbEmisor.SelectedItem).id;
     tarjeta.tEmisor           = (Emisor)daoEmisor.retrieveBy_id(((Emisor)cmbEmisor.SelectedItem).id);
     if (update)
     {
         if (daoTarjeta.update(tarjeta))
         {
             MessageBox.Show("Tarjeta actualizada correctamente");
             this.Close();
             return;
         }
         else
         {
             throw new Exception("Datos no se cargaron correctamente");
         }
     }
     else
     {
         tarjeta.numero = (long)Convert.ToInt64(txtNumero.Text);
         if (daoTarjeta.create(tarjeta))
         {
             MessageBox.Show("Tarjeta actualizada correctamente");
             this.Close();
             return;
         }
         else
         {
             throw new Exception("Datos no se cargaron correctamente");
         }
     }
 }