public bool validacioncampos() { bool validado = true; if (String.IsNullOrWhiteSpace(txt_Nom_conv.Text)) { EP_convo.SetError(txt_Nom_conv, "No puede ir vacio"); validado = false; } else { EP_convo.SetError(txt_Nom_conv, ""); } if (String.IsNullOrWhiteSpace(dtp_fechainicio.Text)) { EP_convo.SetError(dtp_fechainicio, "No puede ir vacio"); validado = false; } else { EP_convo.SetError(dtp_fechainicio, ""); } if (String.IsNullOrWhiteSpace(dtp_fechafin.Text)) { EP_convo.SetError(dtp_fechafin, "No puede ir vacio"); validado = false; } else { EP_convo.SetError(dtp_fechafin, ""); } if (String.IsNullOrWhiteSpace(cb_tipoconvocatoria.Text)) { EP_convo.SetError(cb_tipoconvocatoria, "No puede ir vacio"); validado = false; } else { EP_convo.SetError(cb_tipoconvocatoria, ""); } return(validado); }
private void btn_registrarpersona_registroconv_Click(object sender, EventArgs e) { bool validacion = validacioncampos(); if (validacion == true) { EP_convo.Clear(); MessageBox.Show("Nombre arbitro" + txt_Nom_conv.Text + "\nFecha inicio" + dtp_fechainicio + " " + "Fecha fin" + dtp_fechafin + "\nTipo convocatoria" + cb_tipoconvocatoria); if (obj_cond.AgregarConvocatoria(RecuperarInformacion()) == 1) { MessageBox.Show("Registro Agregado"); } else { MessageBox.Show("Algo salio Mal"); } } frm_registroTorneo objtorn = new frm_registroTorneo(); this.Hide(); objtorn.ShowDialog(); }