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"; } }
protected void BorrarIventure(object sender, EventArgs e) { string idIventure = ((ImageButton)sender).CommandArgument; FacadeDao.BorrarIventure(Convert.ToInt32(idIventure)); BindLista(); }
protected void BtnReenviar(object sender, EventArgs e) { string nombreUsuario = ((ImageButton)sender).CommandArgument; Usuario usu = null; try { usu = FacadeDao.RecuperarPassword(nombreUsuario.Trim(), null); if (usu != null) { if (Core.FacadeDao.EnviarMail(usu.Email, "Travel Pay - recuperación de contraseña", "Su usuario es: " + usu.Nombre + "<br>Su contraseña es: " + usu.Password, Session["Logo"], true)) { string script = "alert('Se envió un mail a la casilla " + usu.Email + " donde recibirá los datos de ingreso al sistema');"; ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } else { string script = "alert('Ocurrió un error al enviar el email, inténtelo más tarde');"; ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } } else { string script = "alert('El usuario o el email ingresados son inexistentes');"; ClientScript.RegisterClientScriptBlock(this.GetType(), DateTime.Now.ToFileTime().ToString(), script, false); } } catch (Exception ex) { string script = "alert('" + ex.Message + "');"; ClientScript.RegisterStartupScript(this.GetType(), "error3", script); } }
private void CargarUsuario() { if (Request.QueryString["IdUsuario"] != null) { int idUsuario = Convert.ToInt32(Request.QueryString["IdUsuario"]); usuario = FacadeDao.GetUsuario(idUsuario); if (usuario != null) { txtNombre.Text = usuario.Nombre; cboRol.SelectedIndex = cboRol.Items.IndexOf(cboRol.Items.FindByValue(usuario.Rol.ToString())); txtEmail.Text = usuario.Email; txtNombre.Enabled = false; cboRol.Enabled = false; btnDarDeAlta.Visible = false; CaptchaControl1.Visible = false; } } else { txtNombre.Enabled = true; cboRol.Enabled = true; btnDarDeAlta.Visible = true; CaptchaControl1.Visible = true; } }
private void CargarProveedor() { Proveedor prov = FacadeDao.GetProveedor(Request.QueryString["IdGateway"]); Session["Proveedor"] = prov; txtProveedor.Text = prov.RazonSocial; txtProveedor.Enabled = false; egp_MerchantID_NoPost.Value = prov.IdGateway; EPAY_ShopCode_NoPost.Value = prov.IdGateway; dev_NoPost.Value = (prov.DevNPS) ? "1" : "0"; Session["scriptPago"] = ""; if (prov.Gateway == "NPS - Sub1") { Session["scriptPago"] = "SubmitNPS();"; } else if (prov.Gateway == "ePayments") { Session["scriptPago"] = "SubmitEPayments();"; } else if (prov.Gateway == "PagoFacil") { Session["scriptPago"] = "SubmitPagoFacil();"; } }
protected void EliminarCliente(object sender, EventArgs e) { string idCliente = ((ImageButton)sender).CommandArgument; FacadeDao.BorrarCliente(Convert.ToInt32(idCliente)); BindLista(); }
private void ReprocesarPago(string xml) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml); XmlNode nodeCharge = xmlDoc.SelectSingleNode("//CHARGE"); string encData = nodeCharge.Attributes["ENC_DATA"].InnerText; string date = nodeCharge.Attributes["DATE"].InnerText; string idIventure = nodeCharge.Attributes["ORDER_ID"].InnerText; string codigo = nodeCharge.Attributes["RESPONSE_CODE"].InnerText; string data = encData; string[] campos = data.Split("|".ToCharArray()); string sAmount = "-1"; for (int i = 0; i < campos.Length; i++) { if (campos[i].StartsWith("egp_Amount=")) { sAmount = campos[i].Substring("egp_Amount=".Length); } } System.Globalization.CultureInfo cultureEN_US = new System.Globalization.CultureInfo("en-US"); try { FacadeDao.ProcesarPago(Convert.ToInt32(idIventure), Convert.ToDouble(sAmount, cultureEN_US), Convert.ToDateTime(date, cultureEN_US)); Response.Redirect("MisIventures.aspx"); } catch (Exception ex) { Label3.Text = ex.Message; } }
private void BindLista() { StringBuilder sql = new StringBuilder(); try { int idProveedor = ((Proveedor)(Session["Proveedor"])).Id; List <Cliente> Clientes = FacadeDao.GetClientes(idProveedor, cuit, email); grilla.DataSource = Clientes; grilla.DataBind(); grilla.Visible = true; if (((List <Cliente>)grilla.DataSource).Count == 0) { grilla.Visible = false; lblAviso.Visible = true; lblAviso.Text = "No se encontraron clientes disponibles para usted."; } else { grilla.Visible = true; lblAviso.Visible = false; } } catch { //Logger.EscribirEventLog(ex); lblAviso.Text = "Ocurrio un error al ejecutar la consulta, pongase en contacto con el administrador"; lblAviso.Visible = true; } }
protected void BorrarUsuario(object sender, EventArgs e) { string idUsuario = ((ImageButton)sender).CommandArgument; FacadeDao.BorrarUsuario(Convert.ToInt32(idUsuario)); BindLista(); }
private void BindLista() { StringBuilder sql = new StringBuilder(); try { List <Proveedor> proveedores = FacadeDao.GetProveedores(); grilla.DataSource = proveedores; grilla.DataBind(); grilla.Visible = true; if (((List <Proveedor>)grilla.DataSource).Count == 0) { grilla.Visible = false; lblAviso.Visible = true; lblAviso.Text = "No se encontraron empresas disponibles."; } else { grilla.Visible = true; lblAviso.Visible = false; } } catch { //Logger.EscribirEventLog(ex); lblAviso.Text = "Ocurrió un error al ejecutar la consulta, pongase en contacto con el administrador"; lblAviso.Visible = true; } }
private void ProcesarPago() { if (CodigosEPAY.IsAuthorized(Request.Form["MessageDescrip"])) { FacadeDao.ProcesarPago(Convert.ToInt32(Request.Form["OrderCode"])); } }
protected void btnLogin_Click(object sender, ImageClickEventArgs e) { if (txtPassword.Text.Trim() != "" && txtUsuario.Text.Trim() != "") { Usuario usu = FacadeDao.GetUsuario(txtUsuario.Text, txtPassword.Text); if (usu != null) { Session["Usuario"] = usu; GetMenu(usu); if (usu.IsProveedor) { Session["Proveedor"] = FacadeDao.GetProveedor(usu.IdProveedor.Value); } else if (usu.IsCliente) { Session["Cliente"] = FacadeDao.GetCliente(usu.IdCliente.Value); } SetLogo(); Response.Redirect(redirect); } else { string script = "alert('Usuario o password equivocado');"; Page.ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } } else { string script = "alert('Complete el usuario y password');"; Page.ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } }
private void ActualizarEstados() { if (Application["UltimaActualizacionEstados"] == null || ((DateTime)Application["UltimaActualizacionEstados"]) < DateTime.Today) { FacadeDao.ActualizarEstados(); Application["UltimaActualizacionEstados"] = DateTime.Today; } }
private void BindLista() { StringBuilder sql = new StringBuilder(); try { int?idCliente = null, idProveedor = null; if (Session["Cliente"] != null) { idCliente = ((Cliente)(Session["Cliente"])).Id; idProveedor = ((Cliente)(Session["Cliente"])).Proveedor.Id; grilla.Columns[0].Visible = false; //Cliente grilla.Columns[1].Visible = true; //Empresa } else if (Session["Proveedor"] != null) { idProveedor = ((Proveedor)(Session["Proveedor"])).Id; grilla.Columns[0].Visible = true; //Cliente grilla.Columns[1].Visible = false; //Empresa } else { idProveedor = -1; } int?idVendedor = null; if (((Usuario)(Session["Usuario"])).IsVendedor) { idVendedor = ((Usuario)(Session["Usuario"])).Id; } //Se invoca a este metodo par reemplazar al job de actualizacion ActualizarEstados(); List <Core.Iventure> iventures = FacadeDao.GetIventure(idCliente, idProveedor, idVendedor); grilla.DataSource = iventures; grilla.DataBind(); grilla.Visible = true; if (((List <Core.Iventure>)grilla.DataSource).Count == 0) { grilla.Visible = false; lblAviso.Visible = true; lblAviso.Text = "No se encontraron solicitudes disponibles para usted."; } else { grilla.Visible = true; lblAviso.Visible = false; } } catch { //Logger.EscribirEventLog(ex); lblAviso.Text = "Ocurrió un error al ejecutar la consulta, pongase en contacto con el administrador"; lblAviso.Visible = true; } }
protected void BtnReenviar(object sender, EventArgs e) { try { string idIventure = ((ImageButton)sender).CommandArgument; FacadeDao.EnviarIventureEmail(Convert.ToInt32(idIventure.Trim()), Session["Logo"]); string script = "alert('Se ha enviado el mail correctamente');"; ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } catch { string script = "alert('Hubo un problema al enviar el mail');"; ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } }
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; } } }
private void CargarCliente() { if (Request.QueryString["IdCliente"] != null) { int idCliente = Convert.ToInt32(Request.QueryString["IdCliente"]); cliente = FacadeDao.GetCliente(idCliente); if (cliente != null) { txtIdCliente.Value = cliente.Id.ToString(); txtNombre.Text = cliente.Nombre; txtApellido.Text = cliente.Apellido; txtDNI.Text = cliente.CuitDni; txtDomicilio.Text = cliente.Domicilio; txtEmail.Text = cliente.Email; txtTelefonos.Text = cliente.Telefonos; } } }
private void CargarProveedor() { if (Request.QueryString["IdProveedor"] != null) { int idProveedor = Convert.ToInt32(Request.QueryString["IdProveedor"]); proveedor = FacadeDao.GetProveedor(idProveedor); if (proveedor != null) { txtIdProveedor.Value = proveedor.Id.ToString(); txtEmail.Text = proveedor.Email; txtCuit.Text = proveedor.CUIT; txtIIBB.Text = proveedor.IIBB; txtRazonsocial.Text = proveedor.RazonSocial; txtFechaAlta.Text = proveedor.Alta.ToShortDateString(); cboGateway.SelectedIndex = cboGateway.Items.IndexOf(cboGateway.Items.FindByValue(proveedor.Gateway)); txtIdGateway.Text = proveedor.IdGateway.ToString(); txtNombreResponsable.Text = proveedor.NombreResp; txtApellidoResponsable.Text = proveedor.ApellidoResp; txtDNIResponsable.Text = proveedor.DNIResp; txtCargoResponsable.Text = proveedor.CargoResp; txtCntTransacciones.Text = proveedor.CntTransacciones.ToString(); txtMontoTransacciones.Text = proveedor.MontoTransacciones.ToString("F2"); txtImagen.Text = proveedor.UrlImagen; txtTelefonos.Text = proveedor.Telefonos; txtClaveEncNPS.Text = proveedor.ClaveEncNPS; cboDevNPS.SelectedIndex = cboDevNPS.Items.IndexOf(cboDevNPS.Items.FindByValue(proveedor.DevNPS.ToString())); txtDiasVencimiento.Text = proveedor.DiasVencimiento.ToString(); chkAmerican.Checked = proveedor.TieneAmericanExpress; chkCabal.Checked = proveedor.TieneCabal; chkDiners.Checked = proveedor.TieneDiners; chkMastercard.Checked = proveedor.TieneMastercard; chkNaranja.Checked = proveedor.TieneNaranja; chkNevada.Checked = proveedor.TieneNevada; chkVisa.Checked = proveedor.TieneVisa; } } else { txtFechaAlta.Text = DateTime.Today.ToShortDateString(); } }
protected void btnMail_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { if (Grabar() == 1) { try { FacadeDao.EnviarIventureEmail(Convert.ToInt32(txtIdIventure.Text.Trim()), Session["Logo"]); string script = "alert('Se ha enviado el mail correctamente');"; ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } catch { string script = "alert('Hubo un problema al enviar el mail');"; ClientScript.RegisterStartupScript(this.GetType(), DateTime.Now.ToFileTime().ToString(), script); } } } }
private void CargarCliente() { if (Request.QueryString["IdCliente"] != null) { int idCliente = Convert.ToInt32(Request.QueryString["IdCliente"]); Cliente cliente = FacadeDao.GetCliente(idCliente); txtNombre.Text = cliente.Nombre; txtApellido.Text = cliente.Apellido; txtCUITDNI.Text = cliente.CuitDni; txtDomicilio.Text = cliente.Domicilio; txtEmail.Text = cliente.Email; txtTelefonos.Text = cliente.Telefonos; hdnIdCliente.Value = idCliente.ToString(); txtNombre.Enabled = false; txtApellido.Enabled = false; txtCUITDNI.Enabled = false; txtDomicilio.Enabled = false; txtEmail.Enabled = false; txtTelefonos.Enabled = false; } }
private void SetLogo() { int idProveedor = -1; if (Session["Cliente"] != null) { idProveedor = ((Cliente)(Session["Cliente"])).Proveedor.Id; } else if (Session["Proveedor"] != null) { idProveedor = ((Proveedor)(Session["Proveedor"])).Id; } if (idProveedor == -1) { Session["Logo"] = "images/Logos/travelPay.png"; } else { Session["Logo"] = FacadeDao.GetLogo(idProveedor); } }
private void CargarVendedores() { Proveedor prov = null; if (Session["Proveedor"] != null) { prov = (Proveedor)(Session["Proveedor"]); } else { if (iventure != null) { prov = iventure.Proveedor; } } if (prov != null) { cboVendedores.Items.Clear(); cboVendedores.DataSource = FacadeDao.GetVendedores(prov.Id); cboVendedores.DataTextField = "Nombre"; cboVendedores.DataValueField = "Id"; cboVendedores.DataBind(); if (Session["Proveedor"] != null) { prov = (Proveedor)(Session["Proveedor"]); if (iventure != null) { cboVendedores.SelectedIndex = cboVendedores.Items.IndexOf(cboVendedores.Items.FindByValue(iventure.IdVendedor.ToString())); } else { cboVendedores.SelectedIndex = cboVendedores.Items.IndexOf(cboVendedores.Items.FindByValue(((Usuario)Session["Usuario"]).Id.ToString())); } } else { cboVendedores.SelectedIndex = cboVendedores.Items.IndexOf(cboVendedores.Items.FindByValue(iventure.IdVendedor.ToString())); } } }
private void BindLista() { StringBuilder sql = new StringBuilder(); try { List <Usuario> usuarios = new List <Usuario>(); int? idProveedor = null; if (Session["Proveedor"] != null) { idProveedor = ((Proveedor)(Session["Proveedor"])).Id; } usuarios = FacadeDao.GetUsuarios(idProveedor); grilla.DataSource = usuarios; grilla.DataBind(); grilla.Visible = true; } catch { //Logger.EscribirEventLog(ex); } }
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"); }
private void BindLista() { StringBuilder sql = new StringBuilder(); try { List <Usuario> usuarios = new List <Usuario>(); int? idProveedor = null; if (Request.QueryString["IdProveedor"] != null) { idProveedor = Convert.ToInt32(Request.QueryString["IdProveedor"]); usuarios = FacadeDao.GetUsuarios(idProveedor); } grilla.DataSource = usuarios; grilla.DataBind(); } catch (Exception ex) { //Logger.EscribirEventLog(ex); throw ex; } }
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); } }
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; } } }
protected void btnAgregar_Click(object sender, EventArgs e) { Page.Validate(); if (Page.IsValid) { try { if (CaptchaControl1.IsValid) { Proveedor prov = new Proveedor(); if (!String.IsNullOrEmpty(txtIdProveedor.Value)) { prov.Id = Convert.ToInt32(txtIdProveedor.Value); } prov.Email = txtEmail.Text.Trim(); prov.CUIT = txtCuit.Text.Trim(); prov.IIBB = txtIIBB.Text.Trim(); prov.RazonSocial = txtRazonsocial.Text.Trim(); prov.Alta = Convert.ToDateTime(txtFechaAlta.Text.Trim()); prov.Gateway = cboGateway.SelectedValue; prov.IdGateway = txtIdGateway.Text.Trim(); prov.NombreResp = txtNombreResponsable.Text.Trim(); prov.ApellidoResp = txtApellidoResponsable.Text.Trim(); prov.DNIResp = txtDNIResponsable.Text.Trim(); prov.CargoResp = txtCargoResponsable.Text.Trim(); prov.UrlImagen = (txtImagen.Text.Trim() == "") ? "Images/Logos/travelpay.png" : txtImagen.Text.Trim(); prov.Telefonos = txtTelefonos.Text.Trim(); prov.ClaveEncNPS = txtClaveEncNPS.Text.Trim(); prov.DevNPS = Convert.ToBoolean(cboDevNPS.SelectedValue); prov.DiasVencimiento = Convert.ToInt32(txtDiasVencimiento.Text.Trim()); #region Tarjetas if (chkAmerican.Checked) { prov.SetAmericanExpress = prov.GetCodeCard(chkAmerican.Attributes["description"]); //chkAmerican.Value; } if (chkCabal.Checked) { prov.SetCabal = prov.GetCodeCard(chkCabal.Attributes["description"]); //chkCabal.Value; } if (chkDiners.Checked) { prov.SetDiners = prov.GetCodeCard(chkDiners.Attributes["description"]); //chkDiners.Value; } if (chkMastercard.Checked) { prov.SetMastercard = prov.GetCodeCard(chkMastercard.Attributes["description"]); //chkMastercard.Value; } if (chkNaranja.Checked) { prov.SetNaranja = prov.GetCodeCard(chkNaranja.Attributes["description"]); //chkNaranja.Value; } if (chkNevada.Checked) { prov.SetNevada = prov.GetCodeCard(chkNevada.Attributes["description"]); //chkNevada.Value; } if (chkVisa.Checked) { prov.SetVisa = prov.GetCodeCard(chkVisa.Attributes["description"]); //chkVisa.Value; } #endregion Tarjetas int result; if (prov.Id == 0) { result = FacadeDao.CrearProveedor(prov); } else { result = FacadeDao.ActualizarProveedor(prov); } if (result == 1) { Response.Redirect("MisProveedores.aspx"); } else { throw (new Exception("Ocurrió un error en el alta / actualización de la empresa")); } } 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); } } }
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"; } }
private void ProcesarConfirmacion() { if (Request.QueryString["egp_data"] != null && Request.QueryString["MerchantId"] != null) { //string data = Core.NpsEncripterHelper.Decrypt(Request.QueryString["egp_data"], ConfigurationManager.AppSettings["Key"]); Proveedor prov = null; prov = FacadeDao.GetProveedor(Request.QueryString["MerchantId"]); if (prov != null) { string data = Core.NpsEncripterHelper.Decrypt(Request.QueryString["egp_data"], prov.ClaveEncNPS); string[] campos = data.Split("|".ToCharArray()); string codigo = "-11111"; string sOrderId = "-1"; string sAmount = "-1"; 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); } } string descripcion = CodigosNPS.GetDescripcion(Convert.ToInt32(codigo)); int orderId; double amount; System.Globalization.CultureInfo cultureEN_US = new System.Globalization.CultureInfo("en-US"); if (codigo == "-1") { amount = Convert.ToDouble(sAmount, cultureEN_US); orderId = Convert.ToInt32(sOrderId); if (FacadeDao.IventurePagado(orderId)) { Response.Clear(); Response.Write("-1"); } else { FacadeDao.ProcesarPago(orderId, amount); Response.Clear(); Response.Write("1"); } } } else { throw new Exception("No se encontró un proveedor con merchantId = " + Request.QueryString["idGateway"]); } } else if (Request.QueryString["egp_data"] == null) { throw new Exception("No se encontró el parámetro egp_data"); } else { //Request.QueryString["MerchantId"] == null throw new Exception("No se encontró el parámetro idGateway"); } }