private void buttonAfiliado_Click(object sender, EventArgs e) { if (textBoxNroAoP.Text.Length == 0) { MessageBox.Show("Ingrese el numero de Afiliado o Profesional segun desee"); } else { int result = 0; if (!int.TryParse(textBoxNroAoP.Text, out result)) { textBoxNroAoP.Text = ""; MessageBox.Show("Solo se permiten numeros"); } else { String validacion = "select pa_activo from bugdeveloping.paciente where pa_nafiliado = " + textBoxNroAoP.Text; ConnectorClass con = ConnectorClass.Instance; DataTable validar = new DataTable(); validar = con.executeQuery(validacion); if (validar.Rows.Count == 0) { MessageBox.Show("No existe el afiliado nro: " + textBoxNroAoP.Text); } else { if (Convert.ToInt32(validar.Rows[0][0]) == 1) { nroAfilOProf = Convert.ToInt32(textBoxNroAoP.Text); Cancelar_Atencion.CancelacionAfiliado frmAfil = new CancelacionAfiliado(); this.Close(); frmAfil.Show(); } else { MessageBox.Show("El afiliado " + textBoxNroAoP.Text + " no esta habilitado"); } } } } }
private void buttonAfiliado_Click(object sender, EventArgs e) { if (textBoxNroAoP.Text.Length == 0) { MessageBox.Show("Ingrese el numero de Afiliado o Profesional segun desee"); } else { int result = 0; if (!int.TryParse(textBoxNroAoP.Text, out result)) { textBoxNroAoP.Text = ""; MessageBox.Show("Solo se permiten numeros"); } else { String validacion = "select pa_activo from bugdeveloping.paciente where pa_nafiliado = " + textBoxNroAoP.Text; ConnectorClass con = ConnectorClass.Instance; DataTable validar = new DataTable(); validar = con.executeQuery(validacion); if (validar.Rows.Count == 0) { MessageBox.Show("No existe el afiliado nro: " + textBoxNroAoP.Text); } else { if (Convert.ToInt32(validar.Rows[0][0]) == 1) { nroAfilOProf = Convert.ToInt32(textBoxNroAoP.Text); Cancelar_Atencion.CancelacionAfiliado frmAfil = new CancelacionAfiliado(); this.Close(); frmAfil.Show(); } else { MessageBox.Show("El afiliado " + textBoxNroAoP.Text + " no esta habilitado"); } } } } }