private void get_link(string link) { ws = Session["wsac"] as wsac.IsacClient; wsac.Usuario obt = new wsac.Usuario(); obt.nip = nuevo_nip.Value; int val = ws.Mod_Usuario(obt); }
public void btnAcceso_Click(Object sender, EventArgs e) { int _nuevo_nip = Convert.ToInt32(check.SafeSqlLiteral(nuevo_nip.Value)); int _confirm_nuevo_nip = Convert.ToInt32(check.SafeSqlLiteral(confirm_nuevo_nip.Value)); if (_nuevo_nip != _confirm_nuevo_nip) { spnJS.Text = "<script>msgError('Los 2 nips deben ser iguales'); </script>"; return; } else { if (!check.ValidaNip(_nuevo_nip.ToString())) { spnJS.Text = "<script>msgError('Revise el NIP. (No se permiten consecutivos ni que todos los digitos sean iguales)');</script>"; return; } else { ws = Session["wsac"] as wsac.IsacClient; wsac.Usuario apunta = new wsac.Usuario(); apunta.idusuario = Convert.ToInt32(Session["id_usuario"].ToString()); apunta.nip = _nuevo_nip.ToString(); if (ws.Mod_Usuario(apunta) > 0) { spnJS.Text = "<script>msgExito('El NIP se modifico correctamente. Vuelva a ingresar'); </script>"; } else { spnJS.Text = "<script>msgError('Ocurrio un error. Contacte con el administrador.'); </script>"; } /*string json = ws.GetUser(int.Parse(Session["id_usuario"].ToString()), "", ""); * List<Usuario> lu = JsonConvert.DeserializeObject<List<Usuario>>(json); * if (lu.Count > 0) * { * Session["idusrlogged"] = lu.FirstOrDefault().idusuario; * Session["usrlogged"] = lu.FirstOrDefault(); * Session["fallido"] = null; * Session["temporal_n"] = null; * Session["fecharecup"] = null; * Session["id_usuario"] = null; * Response.Redirect("datosrecarga.aspx"); * }*/ } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Form.Count > 0) { datosredes = JsonConvert.DeserializeObject <DatosRedes>(Request.Form[0]); Session["datosredes"] = datosredes; ws = Session["wsac"] as wsac.IsacClient; if (datosredes.email != null && !datosredes.email.Equals("")) { string json = ws.GetUser(0, check.SafeSqlLiteral(datosredes.email), ""); List <Usuario> lu = JsonConvert.DeserializeObject <List <Usuario> >(json); if (lu.Count > 0) { if (lu.FirstOrDefault().idusuario == -1) { spnJS.Text = "<script>msgError('El usuario se encuentra bloqueado. Revise el correo con el que se registro'); </script>"; } else { Session["idusrlogged"] = lu.FirstOrDefault().idusuario; Session["usrlogged"] = lu.FirstOrDefault(); if (Session["RecargaPendiente"] != null) { if (bool.Parse(Session["RecargaPendiente"].ToString())) { RecargasViewModel rvm = Session["rvm"] as RecargasViewModel; rvm.IdUsuario = lu.FirstOrDefault().idusuario; TarjetasViewModel tvm = Session["tvm"] as TarjetasViewModel; tvm.Idusuario = lu.FirstOrDefault().idusuario; Response.Redirect("confir_recarga.aspx"); } else { Response.Redirect("datosrecarga.aspx"); } } else { Response.Redirect("datosrecarga.aspx"); } } } else { txtNombre.Value = datosredes.name; txtEmail.Value = datosredes.email; imgFoto.ImageUrl = datosredes.picture.data.url; } } else { spnJS.Text = "<script>msgError('Error al logearse con redes sociales'); </script>"; } } } btnRegistrar.Click += async(s, ea) => { string nip1 = "", nip2 = "", email = "", nombre = "", numero = ""; nip1 = check.SafeSqlLiteral(txtNip1.Value.Trim()); nip2 = check.SafeSqlLiteral(txtNip2.Value.Trim()); email = check.SafeSqlLiteral(txtEmail.Value.Trim()); nombre = check.SafeSqlLiteral(txtNombre.Value.Trim()); numero = check.SafeSqlLiteral(txtNumero.Value.Trim()); //verificador de correo Random r = new Random(); int verif = r.Next(100000, 999999); if (nip1 != nip2) { spnJS.Text = "<script>msgError('Los 2 nips deben ser iguales');</script>"; return; } else { if (!check.ValidaNip(nip1)) { spnJS.Text = "<script>msgError('Revise el NIP. (No se permiten consecutivos ni que todos los digitos sean iguales)');</script>"; return; } else { spnJS.Text = ""; } } ws = Session["wsac"] as wsac.IsacClient; string json = ws.GetUser(0, check.SafeSqlLiteral(email), ""); List <Usuario> lu = JsonConvert.DeserializeObject <List <Usuario> >(json); if (lu.Count > 0) { spnJS.Text = "<script>msgError('Ya existe un usuario con este email. Inicie sesion con su NIP');</script>"; return; } else { spnJS.Text = ""; wsac.Usuario u = new wsac.Usuario() { numerocontacto = numero, email = email, name = nombre, nip = nip1, fechaalta = DateTime.Now, verificacion = nip1 + verif, idpais = int.Parse(Session["idpais"].ToString()) }; if (Session["datosredes"] != null) { datosredes = Session["datosredes"] as DatosRedes; } if (datosredes != null) { u.first_name = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.first_name) ? datosredes.first_name : ""); u.last_name = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.last_name) ? datosredes.last_name : ""); u.gender = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.gender) ? datosredes.gender : ""); u.picture = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.picture.data.url) ? datosredes.picture.data.url : ""); } wsac.AltaUsrResponse res = await ws.AltaUsrAsync(u, 0); if (res.Body.AltaUsrResult > 0) { Session["idusrlogged"] = res.Body.AltaUsrResult; Session["datosredes"] = null; if (Session["RecargaPendiente"] != null) { if (bool.Parse(Session["RecargaPendiente"].ToString())) { RecargasViewModel rvm = Session["rvm"] as RecargasViewModel; rvm.IdUsuario = res.Body.AltaUsrResult; TarjetasViewModel tvm = Session["tvm"] as TarjetasViewModel; tvm.Idusuario = res.Body.AltaUsrResult; Response.Redirect("confir_recarga.aspx"); // spnJS.Text = "<script>alert('Revise su mail de confirmación');</script>"; // enviaMail(u.email,u.verificacion); // Session["bienvenido"] = true; // Response.Redirect("datosrecarga.aspx"); } else { //spnJS.Text = "<script>alert('Revise su mail de confirmación');</script>"; Session["bienvenido"] = true; Response.Redirect("datosrecarga.aspx"); } } else { //spnJS.Text = "<script>alert('Revise su mail de confirmación');</script>"; Session["bienvenido"] = true; Response.Redirect("datosrecarga.aspx"); } } else { spnJS.Text = "<script>msgError('Ocurrio un error. Contacte al administrador');</script>"; return; } }; }; }
protected void Page_Load(object sender, EventArgs e) { int idusr = 0; if (!IsPostBack) { if (Session["idusrlogged"] != null) { if (int.TryParse(Session["idusrlogged"].ToString(), out idusr)) { if (idusr > 0) { ws = Session["wsac"] as wsac.IsacClient; string json = ws.GetUser(idusr, "", ""); List <Usuario> lu = JsonConvert.DeserializeObject <List <Usuario> >(json); if (lu.Count > 0) { Session["usrlogged"] = lu.FirstOrDefault(); Response.Redirect("datosrecarga.aspx"); } } } } if (!string.IsNullOrEmpty(Request.Form["redireccion"])) { spnJS.Text = "<script>msgError('Ya existe un usuario con este email. Inicie sesion con su NIP');</script>"; } //if (Session["fallido"] != null) //{ // spnJS.Text = "<script>msgError('Los datos no son correctos revise nuevamente');</script>"; // Session["fallido"] = null; //} } //CargaCombos(false); if (!IsPostBack) { Session["RecargaPendiente"] = false; Session["rvm"] = null; ws = Session["wsac"] as wsac.IsacClient; jsonRc = ws.GetCatalogo(11, "where idusuario = " + Session["idusrlogged"].ToString() + " and err = 0 and rsauthorization is not null and rsauthorization != '' order by idrecarga desc limit 1"); //recargas List <Recarga> lsr = JsonConvert.DeserializeObject <List <Recarga> >(jsonRc); if (lsr.Count > 0) { Recarga r = lsr.FirstOrDefault(); spnJS.Text = "<script>CargaCombos(); SelOper(" + r.idoperadora.ToString() + ", '" + r.numerorecarga + "', " + r.idpaquete.ToString() + ");</script>"; } } btnNuevaT.Click += async(s, ea) => { string nip1 = "", nip2 = "", email = "", nombre = "", numero = ""; nip1 = check.SafeSqlLiteral(txtNip1.Value.Trim()); nip2 = check.SafeSqlLiteral(txtNip2.Value.Trim()); email = check.SafeSqlLiteral(txtEmail.Value.Trim()); nombre = check.SafeSqlLiteral(txtNombre.Value.Trim()); numero = check.SafeSqlLiteral(txtNumero.Value.Trim()); //verificador de correo Random r = new Random(); int verif = r.Next(100000, 999999); if (nip1 != nip2) { spnJS.Text = "<script>msgError('Los 2 nips deben ser iguales');</script>"; return; } else { if (!check.ValidaNip(nip1)) { spnJS.Text = "<script>msgError('Revise el NIP. (No se permiten consecutivos ni que todos los digitos sean iguales)');</script>"; return; } else { spnJS.Text = ""; } } ws = Session["wsac"] as wsac.IsacClient; string json = ws.GetUser(0, check.SafeSqlLiteral(email), ""); List <Usuario> lu = JsonConvert.DeserializeObject <List <Usuario> >(json); if (lu.Count > 0) { spnJS.Text = "<script>msgError('Ya existe un usuario con este email. Inicie sesion con su NIP');</script>"; return; } else { spnJS.Text = ""; wsac.Usuario u = new wsac.Usuario() { numerocontacto = numero, email = email, name = nombre, nip = nip1, fechaalta = DateTime.Now, //verificacion = nip1 + verif, verificacion = verif.ToString(), idpais = int.Parse(Session["idpais"].ToString()) }; wsac.AltaUsrV2Response res = await ws.AltaUsrV2Async(u, 0); if (res.Body.AltaUsrV2Result > 0) { Session["idusrlogged"] = res.Body.AltaUsrV2Result; Session["datosredes"] = null; wsmoon = new wsmoon.wsMoonSoapClient(); bool respuestaSMS = wsmoon.getSN("dragonballZ@", "wsM00n", "ws4d1mnt43@", u.numerocontacto, "Bienvenido a Asicompras, tu codigo de verificacion es: " + u.verificacion); if (respuestaSMS) { Response.Redirect("valida_codigo.aspx"); } else { spnJS.Text = "<script>msgError('Ocurrio un error. Contacte al administrador');</script>"; return; } if (Session["RecargaPendiente"] != null) { if (bool.Parse(Session["RecargaPendiente"].ToString())) { RecargasViewModel rvm = Session["rvm"] as RecargasViewModel; rvm.IdUsuario = res.Body.AltaUsrV2Result; TarjetasViewModel tvm = Session["tvm"] as TarjetasViewModel; tvm.Idusuario = res.Body.AltaUsrV2Result; Response.Redirect("confir_recarga.aspx"); // spnJS.Text = "<script>alert('Revise su mail de confirmación');</script>"; // enviaMail(u.email,u.verificacion); // Session["bienvenido"] = true; // Response.Redirect("datosrecarga.aspx"); } else { //spnJS.Text = "<script>alert('Revise su mail de confirmación');</script>"; Session["bienvenido"] = true; Response.Redirect("datosrecarga.aspx"); } } else { //spnJS.Text = "<script>alert('Revise su mail de confirmación');</script>"; Session["bienvenido"] = true; Response.Redirect("datosrecarga.aspx"); } } else { spnJS.Text = "<script>msgError('Ocurrio un error. Contacte al administrador');</script>"; return; } }; /*string nip1 = "", nip2 = "", email = "", nombre = "", numero = ""; * nip1 = check.SafeSqlLiteral(txtNip1.Value.Trim()); * nip2 = check.SafeSqlLiteral(txtNip2.Value.Trim()); * email = check.SafeSqlLiteral(txtEmail.Value.Trim()); * nombre = check.SafeSqlLiteral(txtNombre.Value.Trim()); * numero = check.SafeSqlLiteral(txtNumero.Value.Trim()); * if (nip1 != nip2) * { * spnJS.Text = "<script>msgError('Los 2 nips deben ser iguales');</script>"; * return; * } * else * { * if (!check.ValidaNip(nip1)) * { * spnJS.Text = "<script>msgError('Revise el NIP. (No se permiten consecutivos ni que todos los digitos sean iguales)');</script>"; * return; * } * else * spnJS.Text = ""; * } * ws = Session["wsac"] as wsac.IsacClient; * string json = ws.GetUser(0, check.SafeSqlLiteral(email), ""); * List<Usuario> lu = JsonConvert.DeserializeObject<List<Usuario>>(json); * if (lu.Count > 0) * { * spnJS.Text = "<script>msgError('Ya existe un usuario con este email. Inicie sesion con su NIP');</script>"; * return; * } * else * { * spnJS.Text = ""; * wsac.Usuario u = new wsac.Usuario() * { * numerocontacto = numero, * email = email, * name = nombre, * nip = nip1, * fechaalta = DateTime.Now, * idpais = int.Parse(Session["idpais"].ToString()) * }; * wsac.AltaUsrV2Response res = await ws.AltaUsrV2Async(u,0); * if (res.Body.AltaUsrV2Result > 0) * { * * Session["idusrlogged"] = res.Body.AltaUsrV2Result; * Session["datosredes"] = null; * if (Session["RecargaPendiente"] != null) * { * if (bool.Parse(Session["RecargaPendiente"].ToString())) * { * RecargasViewModel rvm = Session["rvm"] as RecargasViewModel; * rvm.IdUsuario = res.Body.AltaUsrV2Result; * TarjetasViewModel tvm = Session["tvm"] as TarjetasViewModel; * tvm.Idusuario = res.Body.AltaUsrV2Result; * Response.Redirect("confir_recarga.aspx"); * } * else * { * * Session["bienvenido"] = true; * Response.Redirect("datosrecarga.aspx"); * } * } * else * { * * Session["bienvenido"] = true; * Response.Redirect("datosrecarga.aspx"); * * } * } * else * { * spnJS.Text = "<script>msgError('Ocurrio un error. Contacte al administrador');</script>"; * return; * } * };*/ }; btnReg1.Click += (s, ea) => { Response.Redirect("registro.aspx"); }; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.Form.Count > 0) { datosredes = JsonConvert.DeserializeObject <DatosRedes>(Request.Form[0]); Session["datosredes"] = datosredes; ws = Session["wsac"] as wsac.IsacClient; string json = ws.GetUser(0, check.SafeSqlLiteral(datosredes.email), ""); List <Usuario> lu = JsonConvert.DeserializeObject <List <Usuario> >(json); if (lu.Count > 0) { if (lu.FirstOrDefault().idusuario == -1) { spnJS.Text = "<script>msgError('El usuario se encuentra bloqueado. Revise el correo con el que se registro'); </script>"; } else { Session["idusrlogged"] = lu.FirstOrDefault().idusuario; Session["usrlogged"] = lu.FirstOrDefault(); if (Session["RecargaPendiente"] != null) { if (bool.Parse(Session["RecargaPendiente"].ToString())) { RecargasViewModel rvm = Session["rvm"] as RecargasViewModel; rvm.IdUsuario = lu.FirstOrDefault().idusuario; TarjetasViewModel tvm = Session["tvm"] as TarjetasViewModel; tvm.Idusuario = lu.FirstOrDefault().idusuario; Response.Redirect("confir_recarga.aspx"); } else { Response.Redirect("datosrecarga.aspx"); } } else { Response.Redirect("datosrecarga.aspx"); } } } else { txtNombre.Value = datosredes.name; txtEmail.Value = datosredes.email; imgFoto.ImageUrl = datosredes.picture.data.url; } } } btnRegistrar.Click += async(s, ea) => { string nip1 = "", nip2 = "", email = "", nombre = "", numero = ""; nip1 = check.SafeSqlLiteral(txtNip1.Value.Trim()); nip2 = check.SafeSqlLiteral(txtNip2.Value.Trim()); email = check.SafeSqlLiteral(txtEmail.Value.Trim()); nombre = check.SafeSqlLiteral(txtNombre.Value.Trim()); numero = check.SafeSqlLiteral(txtNumero.Value.Trim()); if (nip1 != nip2) { spnJS.Text = "<script>msgError('Los 2 nips deben ser iguales');</script>"; return; } else { if (!check.ValidaNip(nip1)) { spnJS.Text = "<script>msgError('Revise el NIP. (No se permiten consecutivos ni que todos los digitos sean iguales)');</script>"; return; } else { spnJS.Text = ""; } } ws = Session["wsac"] as wsac.IsacClient; string json = ws.GetUser(0, check.SafeSqlLiteral(email), ""); List <Usuario> lu = JsonConvert.DeserializeObject <List <Usuario> >(json); if (lu.Count > 0) { spnJS.Text = "<script>msgError('Ya existe un usuario con este email. Inicie sesion con su NIP');</script>"; return; } else { spnJS.Text = ""; wsac.Usuario u = new wsac.Usuario() { numerocontacto = numero, email = email, name = nombre, nip = nip1, fechaalta = DateTime.Now, idpais = int.Parse(Session["idpais"].ToString()) }; if (Session["datosredes"] != null) { datosredes = Session["datosredes"] as DatosRedes; } if (datosredes != null) { u.first_name = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.first_name) ? datosredes.first_name : ""); u.last_name = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.last_name) ? datosredes.last_name : ""); u.gender = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.gender) ? datosredes.gender : ""); u.picture = check.SafeSqlLiteral(!String.IsNullOrEmpty(datosredes.picture.data.url) ? datosredes.picture.data.url : ""); } wsac.AltaUsrResponse res = await ws.AltaUsrAsync(u); if (res.Body.AltaUsrResult > 0) { // spnJS.Text = "<script> msgError('Bienvenido!!!, Comience sus compras con Asi Compras!!!'); </script>"; Session["idusrlogged"] = res.Body.AltaUsrResult; Session["datosredes"] = null; if (Session["RecargaPendiente"] != null) { if (bool.Parse(Session["RecargaPendiente"].ToString())) { RecargasViewModel rvm = Session["rvm"] as RecargasViewModel; rvm.IdUsuario = res.Body.AltaUsrResult; TarjetasViewModel tvm = Session["tvm"] as TarjetasViewModel; tvm.Idusuario = res.Body.AltaUsrResult; Response.Redirect("confir_recarga.aspx"); } else { /* string vtn = "window.open('bienvenido.aspx','Dates','scrollbars=no,resizable=no,height=450, width=450')"; * ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true); */ Response.Redirect("datosrecarga.aspx"); /* vtn = "window.open('bienvenido.aspx','Dates','scrollbars=no,resizable=no,height=450, width=450')"; * ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true); */} } else { /* string vtn = "window.open('bienvenido.aspx','Dates','scrollbars=no,resizable=no,height=450, width=450')"; * ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true); */Response.Redirect("datosrecarga.aspx"); // vtn = "window.open('bienvenido.aspx','Dates','scrollbars=no,resizable=no,height=450, width=450')"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true);*/ } } else { spnJS.Text = "<script>msgError('Ocurrio un error. Contacte al administrador');</script>"; return; } }; }; }