示例#1
0
 protected void btnObtenerEmisores_Click(object sender, EventArgs e)
 {
     using (ServicioTarjetas.EmisorClient cliente = new ServicioTarjetas.EmisorClient())
     {
         dgvEmisores.DataSource = cliente.ConsultarEmisor();
         dgvEmisores.DataBind();
     }
 }
示例#2
0
        protected void btnConsultar_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtNumeroTarjeta.Text) && txtNumeroTarjeta.Text.Length > 12)
            {
                using (ServicioTarjetas.EmisorClient cliente = new ServicioTarjetas.EmisorClient())
                {
                    lblResultado.Text = "";

                    int index = cbxOpciones.SelectedIndex;

                    if (index == 0)
                    {
                        lblResultado.Text = "El emisor de la tarjeta es: " + cliente.ObtenerEmisorTarjeta(txtNumeroTarjeta.Text);
                    }

                    if (index == 1)
                    {
                        var tarjeta = cliente.ObtenerInformacionTarjeta(txtNumeroTarjeta.Text);

                        if (tarjeta != null)
                        {
                            var infoTarjeta = new[] { tarjeta };

                            dgvTarjeta.DataSource = infoTarjeta;
                            dgvTarjeta.DataBind();
                        }
                        else
                        {
                            lblResultado.Text = "Tarjeta no se encuentra registrada";
                        }
                    }

                    if (index == 2)
                    {
                        lblResultado.Text = cliente.ValidarTarjeta(txtNumeroTarjeta.Text);
                    }
                }
            }
            else
            {
                lblResultado.Text = "Por favor ingrese un número de tarjeta válido que sea mayor a 13 para continuar";
            }
        }