Пример #1
0
 private void ProcesarRechazo()
 {
     if (Request["egp_data"] != null && Request.QueryString["IdIventure"] != null)
     {
         Core.Iventure iventure = FacadeDao.GetIventure(Convert.ToInt32(Request.QueryString["IdIventure"]));
         if (iventure != null)
         {
             //string data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], ConfigurationManager.AppSettings["Key"]);
             string   data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], iventure.Proveedor.ClaveEncNPS);
             string[] campos = data.Split("|".ToCharArray());
             string   codigo = "-11111", idIventure = "-11111";
             for (int i = 0; i < campos.Length; i++)
             {
                 if (campos[i].StartsWith("egp_ResponseCode="))
                 {
                     codigo = campos[i].Substring("egp_ResponseCode=".Length);
                 }
                 else if (campos[i].StartsWith("egp_OrderID="))
                 {
                     idIventure = campos[i].Substring("egp_OrderID=".Length);
                 }
             }
             string descripcion = CodigosNPS.GetDescripcion(Convert.ToInt32(codigo));
             lblData.Text = "Nro de Solicitud: " + idIventure + "<br/>Código: " + codigo + "<br/>Descripción: " + descripcion;
         }
     }
     else if (Request["egp_data"] == null)
     {
         lblData.Text = "No se encontraron valores en egp_data";
     }
     else
     {         //(Request.QueryString["IdIventure"]!=null)
         lblData.Text = "No se encontraron valores en IdIventure";
     }
 }
Пример #2
0
 private void CargarIventure()
 {
     if (Request.QueryString["IdIventure"] != null)
     {
         int           idIventure = Convert.ToInt32(Request.QueryString["IdIventure"]);
         Core.Iventure iventure   = FacadeDao.GetIventure(idIventure);
         if (iventure != null)
         {
             txtIdIventure.Text = iventure.Id.ToString();
             //txtIdIventure.Enabled = false;
             txtProveedor.Text         = iventure.Proveedor.RazonSocial;
             txtVencimiento.Text       = ((iventure.Vencimiento.HasValue) ? iventure.Vencimiento.Value.ToShortDateString() : "");
             txtDetalle.Text           = iventure.DetalleAereo;
             cboAereo.SelectedIndex    = cboAereo.Items.IndexOf(cboAereo.Items.FindByValue(iventure.TipoAereo));
             txtImporteAereo.Text      = iventure.ImporteAereo.ToString();
             txtEstadia.Text           = iventure.CiudadEstadia;
             txtPasajeros.Text         = iventure.PasajerosEstadia.ToString();
             txtImporteEstadia.Text    = iventure.ImporteEstadia.ToString();
             txtDetallesAuto.Text      = iventure.DetalleAutomovil;
             txtImporteAuto.Text       = iventure.ImporteAutomovil.ToString();
             txtImporteTotal.Text      = iventure.ImporteTotal.ToString();
             txtNombre.Text            = iventure.Cliente.Nombre;
             txtApellido.Text          = iventure.Cliente.Apellido;
             txtCUITDNI.Text           = iventure.Cliente.CuitDni;
             txtDomicilio.Text         = iventure.Cliente.Domicilio;
             txtEmail.Text             = iventure.Cliente.Email;
             txtTelefonos.Text         = iventure.Cliente.Telefonos;
             txtImporteTotal.Enabled   = false;
             txtIdIventure.Enabled     = false;
             txtProveedor.Enabled      = false;
             txtVencimiento.Enabled    = false;
             txtDetalle.Enabled        = false;
             cboAereo.Enabled          = false;
             txtImporteAereo.Enabled   = false;
             txtEstadia.Enabled        = false;
             txtPasajeros.Enabled      = false;
             txtImporteEstadia.Enabled = false;
             txtDetallesAuto.Enabled   = false;
             txtImporteAuto.Enabled    = false;
             txtNombre.Enabled         = false;
             txtApellido.Enabled       = false;
             txtCUITDNI.Enabled        = false;
             txtDomicilio.Enabled      = false;
             txtEmail.Enabled          = false;
             txtTelefonos.Enabled      = false;
         }
     }
 }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int idIventure = Convert.ToInt32(Request["IdIventure"]);

        Core.Iventure iventure = FacadeDao.GetIventure(idIventure);

        if (!IsPostBack && Request["EncData"] != null && iventure != null)
        {
            string encData = "";
            try
            {
                encData = Core.NpsEncripterHelper.Decrypt(Request["EncData"], iventure.Proveedor.ClaveEncNPS);
                encData = encData.Remove(encData.IndexOf("</TRANSACTIONS>") + "</TRANSACTIONS>".Length, encData.Length - (encData.IndexOf("</TRANSACTIONS>") + "</TRANSACTIONS>".Length));
                ReprocesarPago(encData);
            }
            catch
            {
                Label2.Text = encData;
            }
        }
        Response.Redirect("MisIventures.aspx");
    }
Пример #4
0
    private int Grabar()
    {
        int result = -1;

        try
        {
            if (CaptchaControl1.IsValid)
            {
                Core.Iventure ivent = new Core.Iventure();
                ivent.Id           = Convert.ToInt32(txtIdIventure.Text.Trim());
                ivent.Proveedor    = new Proveedor();
                ivent.Proveedor.Id = ((Proveedor)(Session["Proveedor"])).Id;
                ivent.DetalleAereo = txtDetalle.Text.Trim();
                ivent.ImporteTotal = Convert.ToDouble(txtImporte.Text.Trim());
                ivent.Vencimiento  = (txtFechaHasta.Text.Trim() == "")?null:(DateTime?)Convert.ToDateTime(txtFechaHasta.Text.Trim(), ci);
                ivent.CntCuotas    = Convert.ToInt32(cboCntCuotas.SelectedValue);
                ivent.IdVendedor   = Convert.ToInt32(cboVendedores.SelectedValue);
                result             = FacadeDao.ActualizarIventure(ivent);
                if (result != 1)
                {
                    throw (new Exception("Ocurrió un error en la actualización de la solicitud"));
                }
            }
            else
            {
                throw (new Exception(CaptchaControl1.ErrorMessage));
            }
            return(result);
        }
        catch (Exception ex)
        {
            //Logger.EscribirEventLog(ex);
            string script = "alert('" + ex.Message + "');";
            ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script);
            return(result);
        }
    }
Пример #5
0
 private void CargarIventure()
 {
     if (Request.QueryString["IdIventure"] != null)
     {
         int           idIventure = Convert.ToInt32(Request.QueryString["IdIventure"]);
         Core.Iventure iventure   = FacadeDao.GetIventure(idIventure);
         if (iventure != null)
         {
             txtIdIventure.Text = iventure.Id.ToString();
             //txtIdIventure.Enabled = false;
             txtProveedor.Text          = iventure.Proveedor.RazonSocial;
             txtVendedor.Text           = iventure.Vendedor;
             txtDetalle.Text            = iventure.DetalleAereo;
             txtImporte.Text            = iventure.ImporteTotal.ToString("F2");
             cboCntCuotas.SelectedIndex = cboCntCuotas.Items.IndexOf(cboCntCuotas.Items.FindByValue(iventure.CntCuotas.ToString()));
             txtNombre.Text             = iventure.Cliente.Nombre;
             txtApellido.Text           = iventure.Cliente.Apellido;
             txtCUITDNI.Text            = iventure.Cliente.CuitDni;
             txtDomicilio.Text          = iventure.Cliente.Domicilio;
             txtEmail.Text         = iventure.Cliente.Email;
             txtTelefonos.Text     = iventure.Cliente.Telefonos;
             txtImporte.Enabled    = false;
             cboCntCuotas.Enabled  = false;
             txtIdIventure.Enabled = false;
             txtProveedor.Enabled  = false;
             txtVendedor.Enabled   = false;
             txtDetalle.Enabled    = false;
             txtNombre.Enabled     = false;
             txtApellido.Enabled   = false;
             txtCUITDNI.Enabled    = false;
             txtDomicilio.Enabled  = false;
             txtEmail.Enabled      = false;
             txtTelefonos.Enabled  = false;
         }
     }
 }
Пример #6
0
    private void ProcesarPago()
    {
        if (Request["egp_data"] != null && Request.QueryString["IdIventure"] != null)
        {
            Core.Iventure iventure = FacadeDao.GetIventure(Convert.ToInt32(Request.QueryString["IdIventure"]));
            if (iventure != null)
            {
                //string data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], ConfigurationManager.AppSettings["Key"]);
                //string data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], iventure.Proveedor.ClaveEncNPS);
                string data = Core.NpsEncripterHelper.Decrypt(Request["egp_data"], "298887645747869742751484443145062435617099358761");
                //"298887645747869742751484443145062435617099358761"
                string[] campos = data.Split("|".ToCharArray());
                string   codigo = "-11111";
                string   sOrderId = "-1";
                string   sAmount = "-1";
                string   sFecha = "", sHora = "", sTrans = "", sAuthorizCode = "";
                DateTime fechaPago;
                for (int i = 0; i < campos.Length; i++)
                {
                    if (campos[i].StartsWith("egp_ResponseCode="))
                    {
                        codigo = campos[i].Substring("egp_ResponseCode=".Length);
                    }
                    else if (campos[i].StartsWith("egp_OrderID="))
                    {
                        sOrderId = campos[i].Substring("egp_OrderID=".Length);
                    }
                    else if (campos[i].StartsWith("egp_Amount="))
                    {
                        sAmount = campos[i].Substring("egp_Amount=".Length);
                    }
                    else if (campos[i].StartsWith("egp_FechaTrn_srv="))
                    {
                        sFecha = campos[i].Substring("egp_FechaTrn_srv=".Length);
                    }
                    else if (campos[i].StartsWith("egp_HoraTrn_srv="))
                    {
                        sHora = campos[i].Substring("egp_HoraTrn_srv=".Length);
                    }
                    else if (campos[i].StartsWith("egp_TrnID="))
                    {
                        sTrans = campos[i].Substring("egp_TrnID=".Length);
                    }
                    else if (campos[i].StartsWith("egp_AuthorizCode="))
                    {
                        sAuthorizCode = campos[i].Substring("egp_AuthorizCode=".Length);
                    }
                }
                fechaPago = GetFechaPago(sFecha, sHora);

                string sufijo  = "";
                string detalle = iventure.DetalleAereo;
                if (iventure.DetalleAereo.Length > 30)
                {
                    sufijo  = " ...";
                    detalle = iventure.DetalleAereo.Substring(0, 30);
                }
                lblDescripcion.Text = detalle + sufijo;
                lblFecha.Text       = fechaPago.ToShortDateString();
                lblHora.Text        = fechaPago.ToShortTimeString();
                lblTrans.Text       = sTrans;
                lblIdIventure.Text  = sOrderId;
                lblCodAut.Text      = sAuthorizCode;
                imgEmpresa.ImageUrl = iventure.Proveedor.UrlImagen;
                int    orderId, authorizCode;
                Int64  trnID;
                double amount;

                System.Globalization.CultureInfo cultureEN_US = new System.Globalization.CultureInfo("en-US");
                if (codigo == "-1")
                {
                    amount          = Convert.ToDouble(sAmount, cultureEN_US);
                    lblImporte.Text = amount.ToString(new System.Globalization.CultureInfo("es-ar"));
                    orderId         = Convert.ToInt32(sOrderId);
                    authorizCode    = Convert.ToInt32(sAuthorizCode);
                    trnID           = Convert.ToInt64(sTrans);
                    FacadeDao.ProcesarPago(orderId, amount, fechaPago, trnID, authorizCode);
                }
            }
        }
        else if (Request["egp_data"] == null)
        {
            lblData.Text = "No se encontraron valores en egp_data";
        }
        else
        {         //Request.QueryString["IdIventure"] != null
            lblData.Text = "No se encontraron valores en IdIventure";
        }
    }
Пример #7
0
    private int GrabarDonacion()
    {
        int result = -1;

        Page.Validate();
        if (Page.IsValid)
        {
            try
            {
                if (Session["Proveedor"] != null)
                {
                    if (CaptchaControl1.IsValid)
                    {
                        Core.Iventure ivent = new Core.Iventure();
                        ivent.EsDonacion   = true;
                        ivent.Proveedor    = new Proveedor();
                        ivent.Proveedor.Id = ((Proveedor)(Session["Proveedor"])).Id;
                        ivent.ImporteTotal = Convert.ToDouble(txtImporte.Text.Trim());
                        ivent.CntCuotas    = 1;
                        ivent.DetalleAereo = String.Empty;
                        Cliente cliente = new Cliente();
                        if (!String.IsNullOrEmpty(hdnIdCliente.Value))
                        {
                            cliente.Id = Convert.ToInt32(hdnIdCliente.Value);
                        }
                        ivent.Cliente     = cliente;
                        cliente.Nombre    = txtNombre.Text.Trim();
                        cliente.Apellido  = txtApellido.Text.Trim();
                        cliente.CuitDni   = String.Empty;
                        cliente.Domicilio = String.Empty;
                        cliente.Email     = txtEmail.Text.Trim();
                        string  pass = cliente.Nombre.ToLower() + DateTime.Now.GetHashCode().ToString().Replace("-", "").Trim();
                        Usuario usu  = new Usuario();
                        usu.Nombre   = cliente.CuitDni;
                        usu.Password = pass;
                        usu.Email    = cliente.Email;
                        result       = FacadeDao.CrearIventure(ref ivent, usu, Session["Logo"]);
                        if (result == 1)
                        {
                            //Response.Redirect("GraciasPorLaDonacion.aspx");
                            txtIdIventure.Value = ivent.Id.ToString();
                        }
                        else if (result == -1 || result == -4)
                        {
                            throw (new Exception("Email de cliente existente"));
                        }
                        else if (result == -2 || result == -3)
                        {
                            throw (new Exception("Cuit de cliente ya registrado"));
                        }
                        else
                        {
                            throw (new Exception("Ocurrió un error en el alta de la donación"));
                        }
                    }
                    else
                    {
                        throw (new Exception(CaptchaControl1.ErrorMessage));
                    }
                }
            }
            catch (Exception ex)
            {
                //Logger.EscribirEventLog(ex);
                string script = "alert('" + ex.Message + "');";
                ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script);
            }
        }
        return(result);
    }
Пример #8
0
 protected void btnDarDeAlta_Click(object sender, EventArgs e)
 {
     Page.Validate();
     if (Page.IsValid)
     {
         try
         {
             if (Session["Proveedor"] != null)
             {
                 if (CaptchaControl1.IsValid)
                 {
                     Core.Iventure ivent = new Core.Iventure();
                     ivent.Proveedor    = new Proveedor();
                     ivent.Proveedor.Id = ((Proveedor)(Session["Proveedor"])).Id;
                     //ivent.IdVendedor = Convert.ToInt32(hdnIdVendedor.Value);
                     ivent.IdVendedor   = Convert.ToInt32(cboVendedores.SelectedValue);
                     ivent.ImporteTotal = Convert.ToDouble(txtImporte.Text.Trim());
                     ivent.Vencimiento  = (txtFechaHasta.Text.Trim() == "") ? null : (DateTime?)Convert.ToDateTime(txtFechaHasta.Text.Trim(), ci);
                     ivent.CntCuotas    = Convert.ToInt32(cboCntCuotas.SelectedValue);
                     ivent.DetalleAereo = txtDetalle.Text.Trim();
                     Cliente cliente = new Cliente();
                     if (!String.IsNullOrEmpty(hdnIdCliente.Value))
                     {
                         cliente.Id = Convert.ToInt32(hdnIdCliente.Value);
                     }
                     ivent.Cliente     = cliente;
                     ivent.EsDonacion  = false;
                     cliente.Nombre    = txtNombre.Text.Trim();
                     cliente.Apellido  = txtApellido.Text.Trim();
                     cliente.CuitDni   = txtCUITDNI.Text.Trim();
                     cliente.Domicilio = txtDomicilio.Text.Trim();
                     cliente.Email     = txtEmail.Text.Trim();
                     cliente.Telefonos = txtTelefonos.Text.Trim();
                     string  pass = cliente.Nombre.ToLower() + DateTime.Now.GetHashCode().ToString().Replace("-", "").Trim();
                     Usuario usu  = new Usuario();
                     usu.Nombre   = cliente.CuitDni;
                     usu.Password = pass;
                     usu.Email    = cliente.Email;
                     int result = FacadeDao.CrearIventure(ref ivent, usu, Session["Logo"]);
                     if (result == 1)
                     {
                         Response.Redirect("MisIventures.aspx");
                     }
                     else if (result == -1 || result == -4)
                     {
                         throw (new Exception("Email de cliente existente"));
                     }
                     else if (result == -2 || result == -3)
                     {
                         throw (new Exception("Cuit de cliente ya registrado"));
                     }
                     else
                     {
                         throw (new Exception("Ocurrió un error en el alta de la solicitud"));
                     }
                 }
                 else
                 {
                     throw (new Exception(CaptchaControl1.ErrorMessage));
                 }
             }
         }
         catch (Exception ex)
         {
             //Logger.EscribirEventLog(ex);
             string script = "alert('" + ex.Message + "');";
             ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script);
         }
     }
 }
Пример #9
0
    private void CargarIventure()
    {
        bool   existIdIventure = false;
        string sIdIventure     = null;

        if (Request.QueryString["IdCliente"] == null && Request.Path.Length < Request.RawUrl.Length)
        {
            string   parameters  = Request.RawUrl.Substring(Request.Path.Length + 1);
            string   queryString = Cryptography.Desencriptar(parameters);
            string[] values      = queryString.Split("=".ToCharArray());
            for (int i = 0; i < values.Length; i++)
            {
                if (values[i].ToLower() == "idiventure")
                {
                    existIdIventure = true;
                    if (i + 1 < values.Length)
                    {
                        sIdIventure = values[i + 1];
                    }
                    break;
                }
            }
        }
        if (existIdIventure)
        {
            int idIventure = Convert.ToInt32(sIdIventure);
            iventure = FacadeDao.GetIventure(idIventure);
            if (iventure != null)
            {
                txtIdIventure.Text          = iventure.Id.ToString();
                txtIdIventure.Enabled       = false;
                txtProveedor.Text           = iventure.Proveedor.RazonSocial;
                egp_MerchantID_NoPost.Value = "test_travelpay"; //iventure.Proveedor.IdGateway;
                EPAY_ShopCode_NoPost.Value  = iventure.Proveedor.IdGateway;
                dev_NoPost.Value            = "1";              //(iventure.Proveedor.DevNPS) ? "1" : "0";

                /*txtVendedor.Text = iventure.Vendedor;
                 * hdnIdVendedor.Value = iventure.IdVendedor.ToString();*/
                cboVendedores.SelectedIndex = cboVendedores.Items.IndexOf(cboVendedores.Items.FindByValue(iventure.IdVendedor.ToString()));
                txtDetalle.Text             = iventure.DetalleAereo;
                txtImporte.Text             = iventure.ImporteTotal.ToString();
                txtFechaHasta.Text          = iventure.Vencimiento.HasValue ? iventure.Vencimiento.Value.ToString("dd/MM/yyyy") : "";
                cboCntCuotas.SelectedIndex  = cboCntCuotas.Items.IndexOf(cboCntCuotas.Items.FindByValue(iventure.CntCuotas.ToString()));
                hdnIdCliente.Value          = iventure.Cliente.Id.ToString();
                txtNombre.Text    = iventure.Cliente.Nombre;
                txtApellido.Text  = iventure.Cliente.Apellido;
                txtCUITDNI.Text   = iventure.Cliente.CuitDni;
                txtDomicilio.Text = iventure.Cliente.Domicilio;
                txtEmail.Text     = iventure.Cliente.Email;
                txtTelefonos.Text = iventure.Cliente.Telefonos;
                Session["Logo"]   = iventure.Proveedor.UrlImagen;
                if (iventure.Proveedor.Gateway == "NPS - Sub1")
                {
                    btnPagar.Attributes.Add("onclick", "SubmitNPS();");
                }
                else if (iventure.Proveedor.Gateway == "ePayments")
                {
                    btnPagar.Attributes.Add("onclick", "SubmitEPayments();");
                }
                else if (iventure.Proveedor.Gateway == "PagoFacil")
                {
                    btnPagar.Attributes.Add("onclick", "SubmitPagoFacil();");
                }
            }
            else
            {
                btnPagar.Enabled = false;
            }
        }
        else
        {
            Proveedor prov = null;
            if (Session["Proveedor"] != null)
            {
                prov = (Proveedor)(Session["Proveedor"]);
                txtFechaHasta.Text = DateTime.Today.AddDays(prov.DiasVencimiento).ToString("dd/MM/yyyy");
            }
        }
    }