Esempio n. 1
0
 private void buttBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         string titulo   = Microsoft.VisualBasic.Interaction.InputBox("Ingrese el titulo el cual desea buscar: ");
         int    posicion = servicio.buscarPorTitulo(titulo);
         txtLeerPosicion.Text = posicion.ToString();
         Juego jj = servicio.leerEnPosicion(posicion);
         llenarCampos(jj);
         txtTitulo.ReadOnly       = true;
         dateTimePicker1.Enabled  = false;
         listBoxGenero.Enabled    = false;
         txtLeerPosicion.ReadOnly = true;
         txtPrecio.ReadOnly       = true;
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }
Esempio n. 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string   titulo = txtTitulo.Text;
         string   genero = listBoxGenero.Text;
         int      precio = Convert.ToInt32(txtPrecio.Text);
         DateTime dt     = DateTime.Parse(dateTimePicker1.Text);
         Juego    juego  = new Juego(precio, titulo, genero, dt, Juego.ACTIVO);
         servicio.escribirAlFinal(juego);
         MessageBox.Show("Se ha guardado el registro");
         reiniciarCampos();
     }
     catch (FormatException fe)
     {
         MessageBox.Show("En el precio solo se puede ingresar enteros");
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }
Esempio n. 3
0
 private void butEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         int   posicion = Convert.ToInt32(txtLeerPosicion.Text);
         Juego jj       = servicio.leerEnPosicion(posicion);
         llenarCampos(jj);
         if (MessageBox.Show("Esta seguro de elimnar le juego: " + jj.darTitulo(), "Atencion", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             servicio.eliminar(posicion);
             MessageBox.Show("se ha eliminado");
             reiniciarCampos();
         }
         else
         {
             return;
         }
     }
     catch (Exception ee)
     {
         MessageBox.Show(ee.Message);
     }
 }