private void btn_guardarPlato_Click(object sender, EventArgs e) { try { if (txt_nombrePlato.Text != "" && txt_precioPLato.Text != "" && imagen_plato.Image != null) { if (edit == 0) { ObjetoCN.InsertarPlato(txt_nombrePlato.Text, txt_precioPLato.Text, imagen_plato); MessageBox.Show("Se guardo correctamente"); limpiar(); mostrar(); edit = 0; } else { ObjetoCN.EditarPlato(txt_nombrePlato.Text, txt_precioPLato.Text, imagen_plato, tabla_platos.SelectedCells[2].Value.ToString()); MessageBox.Show("Se edito Correctamente"); mostrar(); limpiar(); edit = 0; } } else { MessageBox.Show("No se permite datos vacios"); } } catch (Exception ex) { MessageBox.Show("Error: " + ex); } }
private void button2_Click(object sender, EventArgs e) { ObjetoCN.EditarPlato(txt_nomPlato.Text,txt_precioPlato.Text,img_plato,lbl_idPlato.Text); MessageBox.Show("se edito correctamente"); Mostrar(); }