Beispiel #1
0
        protected void BtnPay_Click(object sender, EventArgs e)
        {
            labelValidateData.CssClass = "alert alert-danger";

            // validate captcha:
            if (Request["g-recaptcha-response"] == null)
            {
                labelValidateData.Text = "Error no Captcha field form.";
                return;
            }
            var Recaptcha1 = new Recaptcha2VerificationHelper();
            RecaptchaVerificationResult captchaResult;

            if (string.IsNullOrEmpty(Request["g-recaptcha-response"].ToString()))
            {
                labelValidateData.Text = "El Captcha no puede estar vacio.";
                return;
            }
            else
            {
                string secretkey = Global.Configuration.Security.GetRecaptchaSecretKey();

                captchaResult = Recaptcha1.VerifyRecaptchaResponse(secretkey, Request["g-recaptcha-response"].ToString());

                if (captchaResult == RecaptchaVerificationResult.Success)
                {
                    //Response.Redirect( "Welcome.aspx" );
                    //labelValidateData.Text = "Captcha OK :D";

                    string s = @"
if (window.addEventListener) {
      window.addEventListener('load', go, false);
} else {
      window.attachEvent('onload', go);
}                     
function go(){
    document.getElementById('frm_ePaycoCheckoutOpen').submit();
}
                        ";
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "formpost", s, true);

                    imagenePayco.Visible = true; // if autosubmit dont work, show button.
                }
                else if (captchaResult == RecaptchaVerificationResult.IncorrectCaptchaSolution)
                {
                    labelValidateData.Text = "Valor de Captcha NO Valido.";
                    return;
                }
                else
                {
                    labelValidateData.Text = "Existe un problema para validar el captcha, intente mas tarde o por favor contacte a soporte.";
                    return;
                }
            }
        }
Beispiel #2
0
        protected void BtnValidateData_Click(object sender, EventArgs e)
        {
            labelValidateData.CssClass = "alert alert-danger";

            // validate captcha:
            if (Request["g-recaptcha-response"] == null)
            {
                labelValidateData.Text = "Error no Captcha field form.";
                return;
            }

            if (txtCodCliente.Value == null || txtCodPago.Value == null)
            {
                labelValidateData.Text = "Parametros no pueden estar en blanco.";
                return;
            }

            var Recaptcha1 = new Recaptcha2VerificationHelper();
            RecaptchaVerificationResult captchaResult;

            if (string.IsNullOrEmpty(Request["g-recaptcha-response"].ToString()))
            {
                labelValidateData.Text = "El Captcha no puede estar vacio.";
                return;
            }
            else
            {
                string secretkey = Global.Configuration.Security.GetRecaptchaSecretKey();

                captchaResult = Recaptcha1.VerifyRecaptchaResponse(secretkey, Request["g-recaptcha-response"].ToString());

                if (captchaResult == RecaptchaVerificationResult.Success)
                {
                    //Response.Redirect( "Welcome.aspx" );
                    //labelValidateData.Text = "Captcha OK :D";
                }
                else if (captchaResult == RecaptchaVerificationResult.IncorrectCaptchaSolution)
                {
                    labelValidateData.Text = "Valor de Captcha NO Valido.";
                    return;
                }
                else
                {
                    labelValidateData.Text = "Existe un problema para validar el captcha, intente mas tarde o por favor contacte a soporte.";
                    return;
                }
            }

            string CodCliente = txtCodCliente.Value.ToString();
            string CodPago    = txtCodPago.Value.ToString();

            /*
             */
            string tsql = @"
EXEC Factura_Get_Total @CodCliente, @Numero;
";

            SqlParameter[] params1 =
            {
                new SqlParameter {
                    ParameterName = "@CodCliente", DbType = DbType.String, Size = 60, Value = CodCliente
                }
                , new SqlParameter{
                    ParameterName = "@Numero", DbType = DbType.String, Size = 30, Value = CodPago
                }
            };

            decimal?result = SqlApiSqlClient.GetNumericRecordValue(tsql, params1, Global.DAL.GetConnectionStringDBMain(), 60);

            if (result == null)
            {
                labelValidateData.Text     = "No se encuentran datos coincidentes para el pago.";
                labelValidateData.CssClass = "alert alert-warning";
            }
            else
            {
                txtMontoPago.Value         = result.Value;
                labelValidateData.Text     = "Comprobante encontrado, seleccione forma de pago...";
                labelValidateData.CssClass = "alert alert-success";
            }
        }