private void Guardarbutton_Click(object sender, EventArgs e) { Estudios estudios = new Estudios(); if(EstudioIdtextBox.TextLength == 0) { estudios.Nombre = NombreEstudiotextBox.Text; if (estudios.Insertar()) { MessageBox.Show("Estudio guardado","Mensaje",MessageBoxButtons.OK,MessageBoxIcon.Information); } else { MessageBox.Show("no se guardo el estudio","Alerta",MessageBoxButtons.OK,MessageBoxIcon.Error); } Limpiar(); } else { estudios.EstudioId = Convert.ToInt32(EstudioIdtextBox.Text); estudios.Nombre = NombreEstudiotextBox.Text; if (estudios.Editar()) { MessageBox.Show("Se edito correctamente","Mensaje",MessageBoxButtons.OK,MessageBoxIcon.Information); } else { MessageBox.Show("No se edito","Alerta",MessageBoxButtons.OK,MessageBoxIcon.Error); } Limpiar(); } }
private void GuardarEstudio_Click(object sender, EventArgs e) { Estudios cine = new Estudios(); if(estudioIdtextBox.Text.Length == 0) { cine.NombreEstudio = nombreEstudiotextBox.Text; if (cine.Insertar()) { MessageBox.Show("Estudio no se agrego"); } else { MessageBox.Show("Estudio se agrego "); } } else { cine.EstudioId = Convert.ToInt32(estudioIdtextBox.Text); cine.NombreEstudio = nombreEstudiotextBox.Text; if (cine.Editar()) { MessageBox.Show("Estudio no editado"); } else { MessageBox.Show("Estudio editado"); } } }