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 btn_guardar_Click(object sender, EventArgs e) { if (img_plato.Image != null && txt_nomPlato.Text != "" && txt_precioPlato.Text != "") { ObjetoCN.InsertarPlato(txt_nomPlato.Text, txt_precioPlato.Text, img_plato); MessageBox.Show("Se guardo correctamente"); Mostrar(); } else { MessageBox.Show("Todos los campos deben estar llenos"); } }