private void button2_Click(object sender, EventArgs e)
{
bool huboError = this.hacerValidacionesDeTipo();
if (!this.encontroCliente)
{
if (txtDni.Text.Length > 0 && txtApe.Text.Length > 0)
{
SqlDataReader varCli = this.tieneDocumento(txtDni.Text);
varCli.Read();
if (varCli.HasRows)
{
MessageBox.Show("Dni inválido. Ya existe un Cliente con ese DNI", "Error cliente", MessageBoxButtons.OK);
huboError = true;
}
}
}
if (!huboError)
{
if (sePuedeEfectuarLaCompra())
{
string codigoPNR = CreatePNR(10);
cargarDatosDeCompra(codigoPNR);
this.Close();
}
else
{
MessageBox.Show("Los datos ingresados de la tarjeta no coinciden con los datos registrados", "Compra de pasajes y/o encomiendas", MessageBoxButtons.OK);
}
}
}