public MainPage() { try { Page p; p = new menu(); (p as menu).Menu.ItemSelected += (sender, e) => NavigateTo(e.SelectedItem as MenuItem); Master = p; //var det = new NavigationPage(https)) Recarga r = App.db.SelRecargas().OrderByDescending(x => x.idrecarga).FirstOrDefault(); var det = new NavigationPage(new CargarSaldo(r)) { Title = "Así Compras", BarTextColor = Color.White, BarBackgroundColor = Color.FromHex("#e35102"), }; Detail = det; App.Nav = det.Navigation; MasterBehavior = MasterBehavior.Popover; } catch (Exception e) { } }
public List <RecargaFrecuente> SelRecargasFrecuentes() { List <Recarga> lsr; lock (locker) { //return(database.Table<RecargaFrecuente>().OrderBy(x => x.numRecargas).Take(3).ToList<RecargaFrecuente>()); lsr = database.Table <Recarga>().Where(x => x.err == 0).ToList <Recarga>(); } IEnumerable <string> lsnum = lsr.Select(x => x.numerorecarga).Distinct(); List <RecargaFrecuente> lsnumcount = new List <RecargaFrecuente>(); lsnumcount = lsnum.Select(x => new RecargaFrecuente { numerorecarga = x, numRecargas = lsr.Where(z => z.numerorecarga == x).Count() }).ToList(); List <RecargaFrecuente> lsfrec = lsnumcount.OrderBy(x => x.numRecargas).Take(3).ToList(); foreach (RecargaFrecuente rf in lsfrec) { Recarga rtmp = lsr.Where(x => x.numerorecarga == rf.numerorecarga).FirstOrDefault(); rf.contactorecarga = rtmp.contactorecarga; rf.idpais = rtmp.idpais; rf.idoperadora = rtmp.idoperadora; rf.idpaquete = rtmp.idpaquete; } return(lsfrec); }
public Historicos() { try { InitializeComponent(); rvm = new RecargasViewModel(); Title = "Histórico de recargas"; NavigationPage.SetBackButtonTitle(this, ""); lsr = rvm.SelRecargas().Where(x => x.err == 0 && !String.IsNullOrEmpty(x.rsauthorization) && !String.IsNullOrEmpty(x.rstransactionid)).OrderByDescending(x => x.fecha).ToList(); lvHistoricos.ItemSelected += async(sender, e) => { if (e.SelectedItem == null) { return; } Recarga h = e.SelectedItem as Recarga; var action = await DisplayActionSheet("Opción", "Cerrar", null, "Recargar a este número"); if (action == "Recargar a este número") { CargarSaldo p = new CargarSaldo(h); await App.Nav.PushAsync(p); } ((ListView)sender).SelectedItem = null; }; } catch (Exception ex) { } }
public void AltaRecarga(Recarga item) { lock (locker) { if ((from i in database.Table <Recarga>() where i.idrecarga == item.idrecarga select i).Count() > 0) { database.Update(item); } else { database.Insert(item); } } }
public void CargaDeAgenda(Recarga rec) { if (rec != null) { mirec = rec; } if (mirec.idpais != 0) { rvm.idpais = mirec.idpais; } if (mirec.idoperadora != 0) { rvm.idoperadora = mirec.idoperadora; } if (mirec.idpaquete != 0) { rvm.idpaquete = mirec.idpaquete; } rvm.NumeroRecarga = mirec.numerorecarga; rvm.ContactoRecarga = (!String.IsNullOrEmpty(mirec.contactorecarga) ? CleanString.UseRegex(mirec.contactorecarga) : ""); rvm.idFormaPago = mirec.idformapago; rvm.IdTarjeta = mirec.idtarjeta; if (mirec != null) { txtNum.Text = mirec.numerorecarga; lblContacto.Text = (!String.IsNullOrEmpty(mirec.contactorecarga) ? CleanString.UseRegex(mirec.contactorecarga) : ""); } if (rvm.idoperadora == 0 || rvm.idpaquete == 0) { lblvalOpePaq.IsVisible = true; } else { lblvalOpePaq.IsVisible = false; } }
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) { //-------------------------------------------------------------------------------------------------- int idusr = 0; if (!IsPostBack) { divMenu.InnerHtml = check.GeneraMenu(); if (Session["idusrlogged"] != null) { if (int.TryParse(Session["idusrlogged"].ToString(), out idusr)) { if (idusr > 0) { ws = Session["wsac"] as wsac.IsacClient; //string json = ws.GetCatalogo(10, "where idusuario = " + idusr + ""); string json = ws.GetUser(idusr, "", ""); List <Usuario> lu = JsonConvert.DeserializeObject <List <Usuario> >(json); if (lu.Count > 0) { if (Session["bienvenido"] != null) { //string vtn = "window.open('bienvenido.aspx','Dates','scrollbars=no,resizable=no,height=450, width=450')"; //ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true); } Session["usrlogged"] = lu.FirstOrDefault(); lblCtaNom.Text = lu.FirstOrDefault().name; if (!String.IsNullOrEmpty(lu.FirstOrDefault().picture)) { imgFoto.ImageUrl = lu.FirstOrDefault().picture; } else { imgFoto.ImageUrl = "assets/images/icono_app.png"; } } else { Response.Redirect("index.aspx"); } } else { Response.Redirect("index.aspx"); } } else { Response.Redirect("index.aspx"); } } CargaCombos(false); } else { if (Request["__EVENTTARGET"] == "lnkSalir") { Session["idusrlogged"] = 0; Session["usrlogged"] = null; Response.Redirect("index.aspx"); Session.Abandon(); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", "")); } } //-------------------------------------------------------------------------------------------------- if (!IsPostBack) { Session["rvm"] = null; ws = Session["wsac"] as wsac.IsacClient; //------- la ultima exitosa --------------------------------------------------- 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>"; } else { spnJS.Text = "<script>CargaCombos();</script>"; } //------------------------------------------------------------------------------------------ //------- frecuentes ------------------------------------------------------------ jsonRc = ws.GetCatalogo(11, "where idusuario = " + Session["idusrlogged"].ToString() + " and err = 0"); lsr = JsonConvert.DeserializeObject <List <Recarga> >(jsonRc); IEnumerable <string> lsnum = lsr.Select(x => x.numerorecarga).Distinct(); List <RecargaFrecuente> lsnumcount = new List <RecargaFrecuente>(); lsnumcount = lsnum.Select(x => new RecargaFrecuente { numerorecarga = x, numRecargas = lsr.Where(z => z.numerorecarga == x).Count() }).ToList(); List <RecargaFrecuente> lsfrec = lsnumcount.OrderByDescending(x => x.numRecargas).Take(3).ToList(); divFrec.InnerHtml = "<br /><br />"; List <catOperadora> lso; List <catPaquete> lsp; string href = ""; foreach (RecargaFrecuente rf in lsfrec) { Recarga rtmp = lsr.Where(x => x.numerorecarga == rf.numerorecarga).FirstOrDefault(); rf.contactorecarga = rtmp.contactorecarga; rf.idpais = rtmp.idpais; rf.idoperadora = rtmp.idoperadora; rf.idpaquete = rtmp.idpaquete; string numformatted = new StringBuilder(12).Append(rf.numerorecarga, 0, 2).Append(" ").Append(rf.numerorecarga, 2, 4).Append(' ').Append(rf.numerorecarga, 6, 4).ToString(); lso = JsonConvert.DeserializeObject <List <catOperadora> >(jsonOp); lsp = JsonConvert.DeserializeObject <List <catPaquete> >(jsonPq); href = "javascript:CargaCombos();SelOper(" + rf.idoperadora.ToString() + ", '" + rf.numerorecarga + "', " + rf.idpaquete.ToString() + ");"; divFrec.InnerHtml += "<p><a href=\"" + href + "\"><b>" + numformatted + "</b><br />" + lso.Where(x => x.idoperadora == rf.idoperadora).FirstOrDefault().operadora + " " + lsp.Where(x => x.idpaquete == rf.idpaquete).FirstOrDefault().monto.ToString("c") + "</a></p>"; } //-------------------------------------------------------------------------------------------------- } btnMediosP.Click += (s, ea) => { if (hidPais.Value == "0" || hidCompania.Value == "0" || idpaquetew.Value == "0" || String.IsNullOrEmpty(txtNumero.Value)) { CargaCombos(true); return; } else { rvm = new RecargasViewModel(); rvm.Tiporecarga = TipoRecarga.RecargaTA; rvm.WS = Session["wsac"] as wsac.IsacClient; rvm.IdUsuario = int.Parse(Session["idusrlogged"].ToString()); rvm.idpais = int.Parse(hidPais.Value.ToString()); rvm.idoperadora = int.Parse(hidCompania.Value.ToString()); rvm.NumeroRecarga = txtNumero.Value; //rvm.idpaquete = int.Parse(hidPaquete.Value.ToString()); rvm.idpaquete = int.Parse(idpaquetew.Value.ToString()); Session["rvm"] = rvm; Response.Redirect("mediosdepago.aspx"); } }; }
public void CargarInicia(Recarga rec) { InitializeComponent(); Title = "Cargar Saldo"; rvm = new RecargasViewModel(); this.BindingContext = rvm; rvm.Tiporecarga = TipoRecarga.RecargaTA; NavigationPage.SetBackButtonTitle(this, ""); if (rec != null) { if (rec is RecargaProg) { rvm.EdicionOnly = true; } if (App.usr.idpais != 0) { rvm.idpais = App.usr.idpais; } else { rvm.idpais = 1; //default Mexico } rvm.IdUsuario = App.usr.idusuario; mirec = new Recarga(); mirec = rec; } else { Refresh(); if (App.usr.idpais != 0) { rvm.idpais = App.usr.idpais; } else { rvm.idpais = 1; //default Mexico } } ToolbarItems.Add(new ToolbarItem("Ayuda", "ayuda2.png", () => { var page = new InfoAyuda("cargarsaldo.html"); Navigation.PushPopupAsync(page); })); lsC.Clear(); rvm.RecargaIncompleta += (s, e) => { if (e.estaincompleta) { if (rvm.idoperadora == 0 || rvm.idpaquete == 0) { lblvalOpePaq.IsVisible = true; } else { lblvalOpePaq.IsVisible = false; } btnAplicar.IsEnabled = false; } else { btnAplicar.IsEnabled = true; } }; if (mirec != null) { rvm.idpais = mirec.idpais; rvm.idoperadora = mirec.idoperadora; rvm.idpaquete = mirec.idpaquete; rvm.NumeroRecarga = mirec.numerorecarga; rvm.ContactoRecarga = (!String.IsNullOrEmpty(mirec.contactorecarga) ? CleanString.UseRegex(mirec.contactorecarga) : ""); rvm.idFormaPago = mirec.idformapago; rvm.IdTarjeta = mirec.idtarjeta; if (rvm.idFormaPago == 2 && rvm.IdTarjeta > 0) { rvm.TipoTrans = TipoTransaccion.SegundaVez; } } if (rvm.EdicionOnly) { btnAplicar.Text = "Comprar"; } else { if (rvm.idFormaPago == 2 && rvm.IdTarjeta > 0 && App.db.SelTarjetas(rvm.IdTarjeta) != null) { btnAplicar.Text = "Confirmar"; } else { btnAplicar.Text = "Comprar"; } } string title = ""; ListaOpciones lo; TapGestureRecognizer tapgrdPais = new TapGestureRecognizer(); tapgrdPais.Tapped += async(s, e) => //vclPais.Tapped += async (object sender, EventArgs e) => { grdPais.BackgroundColor = Color.FromHex("#e5e5e5"); //Color.FromHex((App.Current.Resources["ButtonRojo"] as Style).Setters.Where(x => x.Property == BackgroundColorProperty).FirstOrDefault().Value.ToString()); //.Opacity = .5; await Task.Delay(100); grdPais.BackgroundColor = Color.Transparent; //grdEstado.Opacity = 1; ls.Clear(); title = "Selecciona un pais"; ls = rvm.lsPais().Select(x => new Opcion { idopc = x.idpais, opc = x.pais, imgopc = x.img }).ToObservableCollection(); lo = new ListaOpciones(ls, title, 1); lo.IdOpc = 1; await App.Nav.PushAsync(lo, Constantes.animated); }; grdPais.GestureRecognizers.Add(tapgrdPais); TapGestureRecognizer tapgrdOperadora = new TapGestureRecognizer(); tapgrdOperadora.Tapped += async(s, e) => //vclOperadora.Tapped += async (object sender, EventArgs e) => { grdOperadora.BackgroundColor = Color.FromHex("#e5e5e5"); //Color.FromHex((App.Current.Resources["ButtonRojo"] as Style).Setters.Where(x => x.Property == BackgroundColorProperty).FirstOrDefault().Value.ToString()); //.Opacity = .5; await Task.Delay(100); grdOperadora.BackgroundColor = Color.Transparent; //grdEstado.Opacity = 1; ls.Clear(); title = "Selecciona una compañía"; ls = rvm.LsOperadoras(rvm.idpais).Select(x => new Opcion { idopc = x.idoperadora, opc = x.operadora, imgopc = x.img }).ToObservableCollection(); lo = new ListaOpciones(ls, title, 1); lo.IdOpc = 2; await App.Nav.PushAsync(lo, Constantes.animated); }; grdOperadora.GestureRecognizers.Add(tapgrdOperadora); if (mirec != null) { txtNum.Text = mirec.numerorecarga; lblContacto.Text = (!String.IsNullOrEmpty(mirec.contactorecarga) ? CleanString.UseRegex(mirec.contactorecarga) : ""); } TapGestureRecognizer tapgrdSaldo = new TapGestureRecognizer(); tapgrdSaldo.Tapped += async(s, e) => //vclSaldo.Tapped += async (object sender, EventArgs e) => { grdSaldo.BackgroundColor = Color.FromHex("#e5e5e5"); //Color.FromHex((App.Current.Resources["ButtonRojo"] as Style).Setters.Where(x => x.Property == BackgroundColorProperty).FirstOrDefault().Value.ToString()); //.Opacity = .5; await Task.Delay(100); grdSaldo.BackgroundColor = Color.Transparent; //grdEstado.Opacity = 1; ls.Clear(); title = "Selecciona monto"; ObservableCollection <catPaquete> lpq = rvm.LsPaquetes(rvm.idoperadora); ls = lpq.OrderBy(x => x.tipo).Select(x => new Opcion { idopc = x.idpaquete, opc = x.monto.ToString("c", new System.Globalization.CultureInfo("es-MX")) + " " + x.paquete, idagrupador = x.tipo, agrupador = (x.tipo == 0 ? "Tiempo aire" : "Paquetes de datos") }).ToObservableCollection(); if (ls.Select(x => x.idagrupador).Distinct().Count() > 1) { lo = new ListaOpciones(ls, title, 1, true); //hay TA y datos } else { lo = new ListaOpciones(ls, title, 1); //solo TA } lo.IdOpc = 4; await App.Nav.PushAsync(lo, Constantes.animated); }; grdSaldo.GestureRecognizers.Add(tapgrdSaldo); TapGestureRecognizer tapgrdLimpiar = new TapGestureRecognizer(); tapgrdLimpiar.Tapped += async(s, e) => { grdLimpiar.BackgroundColor = Color.FromHex("#e5e5e5"); await Task.Delay(100); grdLimpiar.BackgroundColor = Color.Transparent; rvm.Refresh(); txtNum.Text = ""; lblContacto.Text = ""; }; grdLimpiar.GestureRecognizers.Add(tapgrdLimpiar); btnAplicar.Clicked += async(sender, ea) => { if (rvm.EsIncompleta()) { await DisplayAlert("Error", "Faltan capturar o seleccionar algunos campos", "OK"); } else { btnAplicar.IsEnabled = false; rvm.NumeroRecarga = check.SafeSqlLiteral(txtNum.Text.Trim()); if (rvm.EdicionOnly) { await App.Nav.PushAsync(new RegPago(rvm), Constantes.animated); } else { if (rvm.idFormaPago == 2 && rvm.IdTarjeta > 0 && App.db.SelTarjetas(rvm.IdTarjeta) != null) { //vamos a cargar el tvm desde una tarjeta (no se como?) TarjetasViewModel tvm = new TarjetasViewModel(); await App.Nav.PushAsync(new Procesar(rvm, tvm, TipoTransaccion.SegundaVez), Constantes.animated); } else { await App.Nav.PushAsync(new RegPago(rvm), Constantes.animated); } } } }; phvalNum.PropertyChanged += (object sender, PropertyChangedEventArgs e) => { if (phvalNum.IsValid) { rvm.NumeroRecarga = check.SafeSqlLiteral(txtNum.Text); } else { rvm.NumeroRecarga = ""; } }; btnContactos.Clicked += async(sender, e) => { vwContactos = new Contactos(); await App.Nav.PushAsync(vwContactos); lsC = vwContactos.GetLista(); }; txtNum.TextChanged += (s, e) => { if (lsC.Count > 0) { IEnumerable <Contacto> tmp = lsC.Where(x => Regex.Replace(x.Number, @"\s+", "").Contains(e.NewTextValue)); if (tmp.Count() > 0) { lblContacto.Text = CleanString.UseRegex(tmp.FirstOrDefault().Name); rvm.ContactoRecarga = lblContacto.Text; } else { lblContacto.Text = ""; rvm.ContactoRecarga = ""; } } }; }
public CargarSaldo(Recarga rec) { CargarInicia(rec); }
public void Alta() { Recarga r = new Recarga() { idusuario = _idusuario, idpais = _idpais, idoperadora = _idoperadora, idpaquete = _idpaquete, idformapago = _idformapago, idtarjeta = (_idformapago == 2) ? _idtarjeta : -1, numerorecarga = _numerorecarga, contactorecarga = _contactorecarga, fecha = DateTime.Now, TransactionID = Guid.NewGuid().ToString(), err = -1, // -1 es una recarga recien creada q aun no ha sido procesada (pagada) //os = DependencyService.Get<IContactos>().GetOS() }; if (_idformapago == 1) //monedero { /*EventHandler<AltaRecargaViaWalletCompletedEventArgs> atc = null; * atc = (s, ea) => * { * App.WS.AltaRecargaViaWalletCompleted -= atc; * if (ea.Error == null && !ea.Cancelled) * { * errRecarga err = JsonConvert.DeserializeObject<errRecarga>(ea.Result); * r.idrecarga = err.idrecarga; * r.err = err.err; * r.errVs = err.errVs; * r.errRs = err.errRs; * r.rsauthorization = err.tresp.op_authorization; * r.rstransactionid = err.tresp.transaction_id; * r.rsrcode = err.tresp.rcode_description; * r.printdata = err.tresp.printDatam_data; * App.db.AltaRecarga(r); * this._err = err; * if (err.err == 0) * { * string json = ""; * json = App.WSc.GetCatalogo(12, "where idusuario = " + App.usr.idusuario.ToString()); * List<SaldoMonedero> sm = JsonConvert.DeserializeObject<List<SaldoMonedero>>(json); * if (sm.Count() > 0) * App.db.DescargaSaldo(sm.FirstOrDefault()); * } * Device.BeginInvokeOnMainThread(() => OnAltaViaWallet(ea)); * } * else * Device.BeginInvokeOnMainThread(() => OnRecargaAltaErr(null)); * App.WS.Close(); * }; * App.Current.IniciaWS(); * App.WS.AltaRecargaViaWalletCompleted += atc; * r.ip = DependencyService.Get<IContactos>().GetIP(); * App.WS.AltaRecargaViaWalletAsync(ConvertRecargaToTemp(r)); */ } else //2 tarjeta /*EventHandler<CargaVestaCompletedEventArgs> av = null; * av = (s, ea) => * { * App.WS.CargaVestaCompleted -= av; * if (ea.Error == null && !ea.Cancelled) * { * errRecarga err = JsonConvert.DeserializeObject<errRecarga>(ea.Result); * r.err = err.err; * r.errVs = err.errVs; * r.errRs = err.errRs; * r.PaymentID = err.PaymentID; * r.rsauthorization = err.tresp.op_authorization; * r.rstransactionid = err.tresp.transaction_id; * r.rsrcode = err.tresp.rcode_description; * App.db.AltaRecarga(r); * this._err = err; * Device.BeginInvokeOnMainThread(() => OnProcesadoEnVesta(ea)); * } * else * Device.BeginInvokeOnMainThread(() => OnRecargaAltaErr(null)); * App.WS.Close(); * }; * EventHandler<AltaRecargaCompletedEventArgs> atc = null; * atc = async (s, ea) => * { * App.WS.AltaRecargaCompleted -= atc; * if (ea.Error == null && !ea.Cancelled) * { * tags = JsonConvert.DeserializeObject<GetSessionTags>(ea.Result); * Device.BeginInvokeOnMainThread(() => OnCargaFinger(new FingerPrintEventArgs { url = Constantes.FingerprintAPI, orgid = tags.OrgID, webses = tags.WebSessionID } )); * await Task.Delay(TimeSpan.FromSeconds(30)); * //--- iOS --- * //await LlamaFingerp(tags); * //--- --- * r.idrecarga = tags.idrecarga; * App.db.AltaRecarga(r); * App.WS.CargaVestaCompleted += av; * App.WS.CargaVestaAsync(ConvertRecargaToTemp(r), null, tags.WebSessionID); * } * else * Device.BeginInvokeOnMainThread(() => OnRecargaAltaErr(null)); * }; * App.Current.IniciaWS(); * App.WS.AltaRecargaCompleted += atc; * r.ip = DependencyService.Get<IContactos>().GetIP(); * App.WS.AltaRecargaAsync(ConvertRecargaToTemp(r));*/ { } }
protected void Page_Load(object sender, EventArgs e) { /*if (Request.QueryString["verifica"] != null) * { * ver=Request.QueryString["verifica"]; * if (validaVerif(ver)) * { * string vtn = "window.open('bienvenido.aspx','Dates','scrollbars=no,resizable=no,height=450, width=450')"; * ScriptManager.RegisterStartupScript(this, this.GetType(), "popup", vtn, true); * } * else { * * } * }*/ 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>"; } else { spnJS.Text = "<script>CargaCombos();</script>"; } } btnNuevaT.Click += (s, ea) => { if (hidPais.Value == "0" || hidCompania.Value == "0" || idpaquetew.Value == "0" || String.IsNullOrEmpty(txtNumero.Value)) { CargaCombos(true); return; } else { rvm = new RecargasViewModel(); rvm.Tiporecarga = TipoRecarga.RecargaTA; rvm.WS = Session["wsac"] as wsac.IsacClient; rvm.IdUsuario = 0; //int.Parse(Session["idusrlogged"].ToString()); rvm.idpais = int.Parse(hidPais.Value.ToString()); rvm.idoperadora = int.Parse(hidCompania.Value.ToString()); rvm.NumeroRecarga = txtNumero.Value; //rvm.idpaquete = int.Parse(hidPaquete.Value.ToString()); rvm.idpaquete = int.Parse(idpaquetew.Value.ToString()); Session["rvm"] = rvm; Session["RecargaPendiente"] = true; Response.Redirect("nuevatarjetasinsesion.aspx"); } }; }