Esempio n. 1
0
        private void DumpExcel(string fi, string ff)
        {
            ws = Session["wsac"] as wsac.IsacClient;
            byte[] reporte = ws.ExportaRepConc(fi, ff);
            //MemoryStream stream = new MemoryStream();
            //stream.Write(reporte, 0, reporte.Length);
            //NPOI.HSSF.UserModel.HSSFWorkbook excel = new NPOI.HSSF.UserModel.HSSFWorkbook()
            string saveAsFileName = "RepConciliacion.xls";

            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName));
            Response.Clear();
            Response.BinaryWrite(reporte);
            Response.End();

            //using (var exporter = new NpoiExport())
            //{
            //    exporter.ExportDataTableToWorkbook(dt, "Results");
            //    string saveAsFileName = "RepConciliacion.xls"; //string.Format("Results-{0:d}.xls", DateTime.Now);
            //    Response.ContentType = "application/vnd.ms-excel";
            //    Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName));
            //    Response.Clear();
            //    Response.BinaryWrite(exporter.GetBytes());
            //    Response.End();
            //}
        }
Esempio n. 2
0
 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);
 }
Esempio n. 3
0
        public void btnAcceso_Click(Object sender, EventArgs e)
        {
            string str_email = email.Value;
            string str_Nip   = NIP.Value;

            Session["fallo"] = null;

            if (!string.IsNullOrEmpty(str_email) && !string.IsNullOrEmpty(str_Nip))
            {
                ws = Session["wsac"] as wsac.IsacClient;
                string json             = ws.GetAdmin(0, check.SafeSqlLiteral(str_email), check.SafeSqlLiteral(str_Nip));
                List <administrador> lu = JsonConvert.DeserializeObject <List <administrador> >(json);

                if (lu.Count > 0)
                {
                    Session["idadminlogged"] = lu.FirstOrDefault().idadministrador;
                    Session["adminlogged"]   = lu.FirstOrDefault();
                    Response.Redirect("recargas_historial_admin.aspx");
                }
                else
                {
                    Session["fallo"] = "1";
                    Response.Redirect("login_admin.aspx");
                }
            }
        }
Esempio n. 4
0
        public void btnAcceso_Click(Object sender, EventArgs e)
        {
            string str_email = Email.Value;
            string str_Nip   = NIP.Value;

            Session["fallido"] = null;

            if (!string.IsNullOrEmpty(str_email) && !string.IsNullOrEmpty(str_Nip))
            {
                ws = Session["wsac"] as wsac.IsacClient;
                string         json = ws.GetUser(0, check.SafeSqlLiteral(str_email), check.SafeSqlLiteral(str_Nip));
                List <Usuario> lu   = JsonConvert.DeserializeObject <List <Usuario> >(json);

                if (lu.Count > 0)
                {
                    if (lu.FirstOrDefault().idusuario == -1)
                    {
                        spnJS.Text = "<script>CargaCombos(); 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();
                        Session["fallido"]     = null;
                        Response.Redirect("datosrecarga.aspx");
                    }
                }
                else
                {
                    //Session["fallido"] = "1";
                    //Response.Redirect("index.aspx");
                    spnJS.Text = "<script>CargaCombos(); msgError('Los datos no son correctos revise nuevamente');</script>";
                }
            }
        }
Esempio n. 5
0
        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.GetUser(idusr, "", "");
                            List <Usuario> lu   = JsonConvert.DeserializeObject <List <Usuario> >(json);
                            if (lu.Count > 0)
                            {
                                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");
                    }
                }
            }
            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", ""));
                }
            }
            //-------------------------------------------------------------------------------------------------
        }
Esempio n. 6
0
        private void DumpExcel(string fi, string ff)
        {
            ws = Session["wsac"] as wsac.IsacClient;
            byte[] reporte        = ws.ExportaRepUsrF(fi, ff);
            string saveAsFileName = "RepUsrs.xls";

            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName));
            Response.Clear();
            Response.BinaryWrite(reporte);
            Response.End();
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
            //    if (Session["fallo"] != null)
            //    {
            //        if (Session["fallo"].ToString() == "1")
            //        {
            //            spnJS.Text = "<script>msgError('Los datos no son correctos, verifique e intente nuevamente'); </script>";
            //            Session["fallo"] = null;
            //        }
            //        if (Session["fallo"].ToString() == "-1")
            //        {
            //            spnJS.Text = "<script>msgError('El usuario se encuentra bloqueado. Revise el correo con el que se registro'); </script>";
            //            Session["fallo"] = null;
            //        }
            //    }

            //}

            btnEnviaCorreo.Click += (s, ea) =>
            {
                string email = "";
                ws = Session["wsac"] as wsac.IsacClient;
                if (!String.IsNullOrEmpty(edtCorreo.Value))
                {
                    email = check.SafeSqlLiteral(edtCorreo.Value.Trim());
                }
                if (email == "")
                {
                    spnJS.Text = "<script>msgError('No existe ese usuario y/o email'); </script>";
                }
                else
                {
                    //UserDialogs.Instance.ShowLoading("Cargando...");
                    string         json = ws.GetUser(0, email, "");
                    List <Usuario> lu   = JsonConvert.DeserializeObject <List <Usuario> >(json);
                    if (lu.Count > 0)
                    {
                        //UserDialogs.Instance.HideLoading();
                        ws.EnviaMailRecordatorioAsync(lu.FirstOrDefault().idusuario);
                        spnJS.Text = "<script>msgExito('Se envio su nip al correo registrado'); </script>";
                        //await App.Nav.PopAsync(Constantes.animated);
                    }
                    else
                    {
                        //UserDialogs.Instance.HideLoading();
                        spnJS.Text = "<script>msgError('No existe ese usuario y/o email'); </script>";
                    }
                }
            };
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            int idusr = 0;

            if (!IsPostBack)
            {
                if (Session["idadminlogged"] != null)
                {
                    if (int.TryParse(Session["idadminlogged"].ToString(), out idusr))
                    {
                        if (idusr > 0)
                        {
                            ws = Session["wsac"] as wsac.IsacClient;
                            //string json = ws.GetCatalogo(15, "where idadministrador = " + idusr + "");
                            string json             = ws.GetAdmin(idusr, "", "");
                            List <administrador> lu = JsonConvert.DeserializeObject <List <administrador> >(json);
                            if (lu.Count > 0)
                            {
                                Session["adminlogged"] = lu.FirstOrDefault();
                                loadoperadora();
                                loadpaquete(null);
                                getoperadora(" ");
                                GridView2.Visible = false;
                            }
                            else
                            {
                                Response.Redirect("login_admin.aspx");
                            }
                        }
                        else
                        {
                            Response.Redirect("login_admin.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("login_admin.aspx");
                    }
                }
            }
            else
            {
                if (Request["__EVENTTARGET"] == "lnkSalir")
                {
                    Session["idadminlogged"] = 0;
                    Session["usrlogged"]     = null;
                    Response.Redirect("index.aspx");
                    Session.Abandon();
                    Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
                }
            }
        }
Esempio n. 9
0
        private bool validaVerif(string ver)
        {
            bool res = false;

            ws = Session["wsac"] as wsac.IsacClient;
            bool jsonVerif = ws.verificaCliente(ver);

            if (jsonVerif)
            {
                res = true;
            }
            return(res);
        }
Esempio n. 10
0
        public void btnAcceso_Click(Object sender, EventArgs e)
        {
            string str_email = email.Value;
            string str_Nip   = NIP.Value;

            //Session["fallo"] = null;

            if (!string.IsNullOrEmpty(str_email) && !string.IsNullOrEmpty(str_Nip))
            {
                ws = Session["wsac"] as wsac.IsacClient;
                string         json = ws.GetUser(0, check.SafeSqlLiteral(str_email), check.SafeSqlLiteral(str_Nip));
                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
                {
                    spnJS.Text = "<script>msgError('Los datos no son correctos, verifique e intente nuevamente'); </script>";
                }
            }
        }
Esempio n. 11
0
        private void Refresh(string fi, string ff)
        {
            string json      = "";
            string formatted = "";

            ws   = Session["wsac"] as wsac.IsacClient;
            json = ws.GetUsersF(fi, ff);
            List <Usuario> lsu = JsonConvert.DeserializeObject <List <Usuario> >(json);
            CultureInfo    ci  = new CultureInfo("es-MX");

            foreach (Usuario u in lsu)
            {
                HtmlTableRow row = new HtmlTableRow();
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "3%;", InnerHtml = u.idusuario.ToString()
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = u.fechaalta.ToString("dd/MMM/yyyy", ci)
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = (u.FechaPrimera == null ? "" : (u.FechaPrimera.Year == 1 ? "" : u.FechaPrimera.ToString("dd/MMM/yyyy", ci)))
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = (u.FechaUltima == null ? "" : (u.FechaUltima.Year == 1 ? "" : u.FechaUltima.ToString("dd/MMM/yyyy", ci)))
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = u.NumRecargas.ToString()
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "20%;", InnerHtml = u.name
                });
                //row.Cells.Add(new HtmlTableCell() { Width = "10%;", InnerHtml = u.gender });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "20%;", InnerHtml = u.email
                });
                formatted = (u.numerocontacto.Length == 10 ? new StringBuilder(12).Append(u.numerocontacto, 0, 2).Append(" ").Append(u.numerocontacto, 2, 4).Append(' ').Append(u.numerocontacto, 6, 4).ToString() : u.numerocontacto);
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "20%;", InnerHtml = formatted
                });
                tbReporte.Rows.Add(row);
            }
        }
 private void CargaCombos(bool muestraerr)
 {
     ws      = Session["wsac"] as wsac.IsacClient;
     jsonPa  = ws.GetCatalogo(2, "");                   //pais
     jsonEmi = ws.GetCatalogo(4, "");                   //emisor
     jsonEdo = ws.GetCatalogo(7, "");                   //estados
     jsonCd  = ws.GetCatalogo(8, "order by municipio"); //ciudades
     if (muestraerr)
     {
         spnJS.Text = "<script>msgError('Faltan algunos campos obligatorios'); CargaCombos();</script>";
     }
     else
     {
         spnJS.Text = "<script>CargaCombos();</script>";
     }
 }
Esempio n. 13
0
        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");
                     * }*/
                }
            }
        }
Esempio n. 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                msgMensaje.Visible = false;
                msgaviso.Visible   = false;
                string str_email = Request.Form["s"];

                if (!string.IsNullOrEmpty(str_email))
                {
                    try
                    {
                        msgMensaje.Visible = true;
                        msgaviso.Visible   = false;
                        procesos apunta = new procesos();
                        ws = Session["wsac"] as wsac.IsacClient;

                        string json = ws.GetUser(0, check.SafeSqlLiteral(str_email), "");

                        /*List<Usuario> lu = JsonConvert.DeserializeObject<List<Usuario>>(json);
                         *
                         * Usuario users = lu.Where(x => x.email.Equals(str_email)).First();
                         *
                         * string nombre_servidor = HttpContext.Current.Request.Url.AbsoluteUri;
                         *
                         * string[] segmentosURL = HttpContext.Current.Request.Url.Segments;
                         * string pagina = segmentosURL[segmentosURL.Length - 1];
                         *
                         * string linkfinal = nombre_servidor.Substring(0, nombre_servidor.Length - pagina.Length);
                         *
                         * if (lu.Count > 0)
                         * {
                         *  apunta.EnviaCorreo(users.idusuario, str_email, users.nip, linkfinal);
                         * }*/
                    }
                    catch (Exception er)
                    {
                        msgaviso.Visible   = true;
                        msgMensaje.Visible = false;
                    }
                }
                else
                {
                    Response.Redirect("login.aspx");
                }
            }
        }
        private void loadoperadora()
        {
            ws = Session["wsac"] as wsac.IsacClient;

            string sql_consulta = "SELECT * FROM catoperadora";

            string json = ws.GetCatalogoPersonalizado(sql_consulta);
            List <catOperadora> list_oper = JsonConvert.DeserializeObject <List <catOperadora> >(json);

            if (list_oper.Count > 0)
            {
                list_operadora.DataSource     = list_oper;
                list_operadora.DataTextField  = "operadora";
                list_operadora.DataValueField = "idoperadora";
                list_operadora.DataBind();
            }
        }
        private void get_detallado(string idpaquete)
        {
            int idusr = 0;

            if (int.TryParse(Session["idadminlogged"].ToString(), out idusr))
            {
                if (idusr > 0)
                {
                    try
                    {
                        ws = Session["wsac"] as wsac.IsacClient;

                        string sql_consulta = "SELECT recarga.idrecarga, usuario.name, usuario.first_name, usuario.last_name, " +
                                              "recarga.numerorecarga, catpaquete.monto, recarga.contactorecarga FROM recarga " +
                                              "INNER JOIN catpaquete ON catpaquete.idpaquete = recarga.idpaquete " +
                                              "INNER JOIN usuario ON usuario.idusuario = recarga.idusuario " +
                                              " WHERE recarga.err = 0 and recarga.idpaquete =" + idpaquete;

                        string json = ws.GetCatalogoPersonalizado(sql_consulta);
                        List <paquetes_mod> list_oper = JsonConvert.DeserializeObject <List <paquetes_mod> >(json);

                        if (list_oper.Count > 0)
                        {
                            GridView2.DataSource = list_oper;
                            GridView2.DataBind();
                            GridView2.Visible = true;
                        }
                        else
                        {
                            Response.Redirect("index.aspx");
                        }
                    }
                    catch (Exception er)
                    {
                    }
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }
            else
            {
                Response.Redirect("index.aspx");
            }
        }
        //WHERE recarga.fecha >= '2016/10/01' AND recarga.fecha <= '2016/10/15'

        private void getoperadora(string rango)
        {
            int idusr = 0;

            if (int.TryParse(Session["idadminlogged"].ToString(), out idusr))
            {
                if (idusr > 0)
                {
                    try
                    {
                        ws = Session["wsac"] as wsac.IsacClient;

                        string sql_consulta = "SELECT recarga.idoperadora , catoperadora.img ,  catoperadora.operadora as 'telefonia' , COUNT(*) AS 'Total_Recargas', sum(catpaquete.monto) as 'MontoPesos' " +
                                              " FROM recarga INNER JOIN catoperadora ON catoperadora.idoperadora = recarga.idoperadora INNER JOIN catpaquete ON catpaquete.idpaquete = recarga.idpaquete  " +
                                              rango + "  where recarga.err = 0 GROUP BY recarga.idoperadora";

                        string           json      = ws.GetCatalogoPersonalizado(sql_consulta);
                        List <operadora> list_oper = JsonConvert.DeserializeObject <List <operadora> >(json);

                        if (list_oper.Count > 0)
                        {
                            GridView1.DataSource = list_oper;
                            GridView1.DataBind();
                        }
                        else
                        {
                            Response.Redirect("index.aspx");
                        }
                    }
                    catch (Exception er)
                    {
                    }
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }
            else
            {
                Response.Redirect("index.aspx");
            }
        }
Esempio n. 18
0
        static void Main(string[] args)
        {
            evt = new System.Diagnostics.EventLog();
            if (!System.Diagnostics.EventLog.SourceExists("AsiCompras"))
            {
                System.Diagnostics.EventLog.CreateEventSource("AsiCompras", "AsiCompras");
            }
            evt.Source = "AsiCompras";
            evt.Log    = "AsiCompras";

            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport)
            {
                Name                   = "basicHttpBinding",
                MaxBufferSize          = 2147483647,
                MaxReceivedMessageSize = 2147483647,
            };
            TimeSpan timeout = new TimeSpan(0, 3, 0);

            binding.SendTimeout    = timeout;
            binding.OpenTimeout    = timeout;
            binding.ReceiveTimeout = timeout;
            binding.Security       = new BasicHttpSecurity
            {
                Mode      = BasicHttpSecurityMode.Transport,
                Transport = new HttpTransportSecurity
                {
                    ClientCredentialType = HttpClientCredentialType.Basic,
                    ProxyCredentialType  = HttpProxyCredentialType.None,
                    Realm = "",
                },
            };
            EndpointAddress ea = new EndpointAddress("https://asicompras.com/wsac/sac.svc");

            ws = new wsac.IsacClient(binding, ea);
            ws.ClientCredentials.UserName.UserName = "******";
            ws.ClientCredentials.UserName.Password = "******";

            evt.WriteEntry("Iniciando recargas programadas");
            var ini = Inicia();

            Task.WaitAll(ini);
        }
Esempio n. 19
0
 private void CargaCombos(bool muestraerr)
 {
     try
     {
         ws     = Session["wsac"] as wsac.IsacClient;
         jsonPa = ws.GetCatalogo(2, ""); //pais
         jsonOp = ws.GetCatalogo(1, ""); //operadora
         jsonPq = ws.GetCatalogo(3, ""); //paquete
         if (muestraerr)
         {
             spnJS.Text = "<script>msgError('Faltan algunos campos obligatorios'); CargaCombos();</script>";
         }
         else
         {
             spnJS.Text = "<script>CargaCombos();</script>";
         }
     }
     catch (Exception ex)
     {
     }
 }
        private void loadpaquete(string id)
        {
            ws = Session["wsac"] as wsac.IsacClient;

            string sql_consulta = "SELECT * FROM catpaquete";

            if (id != null)
            {
                sql_consulta = sql_consulta + " WHERE idoperadora=" + id;
            }

            string            json      = ws.GetCatalogoPersonalizado(sql_consulta);
            List <catPaquete> list_oper = JsonConvert.DeserializeObject <List <catPaquete> >(json);

            if (list_oper.Count > 0)
            {
                list_paquete.DataSource     = list_oper;
                list_paquete.DataTextField  = "paquete";
                list_paquete.DataValueField = "idpaquete";
                list_paquete.DataBind();
            }
        }
Esempio n. 21
0
        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;
                    }
                };
            };
        }
Esempio n. 22
0
        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");
            };
        }
Esempio n. 23
0
        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 + "&nbsp;&nbsp;" + 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");
                }
            };
        }
Esempio n. 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //--------------------------------------------------------------------------------------------------
            int idusr = 0;

            if (!IsPostBack)
            {
                if (Session["idadminlogged"] != null)
                {
                    if (int.TryParse(Session["idadminlogged"].ToString(), out idusr))
                    {
                        if (idusr > 0)
                        {
                            ws = Session["wsac"] as wsac.IsacClient;
                            string         json = ws.GetAdmin(idusr, "", "");
                            List <Usuario> lu   = JsonConvert.DeserializeObject <List <Usuario> >(json);
                            if (lu.Count > 0)
                            {
                                Session["adminlogged"] = 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");
                    }
                }
            }
            else
            {
                if (Request["__EVENTTARGET"] == "lnkSalir")
                {
                    Session["idadminlogged"] = 0;
                    Session["adminlogged"]   = null;
                    Response.Redirect("index.aspx");
                    Session.Abandon();
                    Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
                }
            }

            //-------------------------------------------------------------------------------------------------
            if (!IsPostBack)
            {
                ws = Session["wsac"] as wsac.IsacClient;
                if (tvm == null)
                {
                    tvm            = new TarjetasViewModel();
                    Session["tvm"] = tvm;
                }
                tvm.WS = ws;
                tvm.Inicia();
                //if (Session["rvm"] == null)
                //    Response.Redirect("datosrecarga.aspx");
                //else
                //    Refresh();
            }
            else
            {
                if (Request.Form["__EVENTTARGET"] == "delrec")
                {
                    int idr = int.Parse(Request.Form["__EVENTARGUMENT"].ToString());
                    ws = Session["wsac"] as wsac.IsacClient;
                    if (ws.EliminaRecProg(idr))
                    {
                        Response.Redirect("histrecprog.aspx");
                    }
                }
            }
            btnExcel.Click += (s, ea) =>
            {
                DateTime dtini = DateTime.MinValue; DateTime dtfin = DateTime.MinValue;
                if (DateTime.TryParseExact(fini.Value, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtini) && DateTime.TryParseExact(ffin.Value, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtfin))
                {
                    DumpExcel(dtini.ToString("yyyyMMdd"), dtfin.ToString("yyyyMMdd"));
                    spnJS.Text = "";
                }
                else
                {
                    spnJS.Text = "<script>msgError('Faltan fecha de inicio y fin');</script>";
                }
            };
            btnConsultar.Click += (s, ea) =>
            {
                DateTime dtini = DateTime.MinValue; DateTime dtfin = DateTime.MinValue;
                if (DateTime.TryParseExact(fini.Value, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtini) && DateTime.TryParseExact(ffin.Value, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out dtfin))
                {
                    Refresh(dtini.ToString("yyyyMMdd"), dtfin.ToString("yyyyMMdd"));
                    spnJS.Text = "";
                }
                else
                {
                    spnJS.Text = "<script>msgError('Faltan fecha de inicio y fin');</script>";
                }
            };
        }
Esempio n. 25
0
        private void Refresh(string fi, string ff)
        {
            string json = "";

            ws   = Session["wsac"] as wsac.IsacClient;
            json = ws.GetReporteConciliacion(fi, ff);
            repconc rep = JsonConvert.DeserializeObject <repconc>(json);

            foreach (DataRow dr in rep.recargas.Rows)
            {
                HtmlTableRow row = new HtmlTableRow();
                Label        lbl = new Label();
                if (dr["err"] is DBNull)
                {
                    lbl.Text = "<a id=\"\" style='background-color:yellow;' class=\"btn default btn-xs\"</a>";
                }
                else
                {
                    switch (dr["err"].ToString())
                    {
                    case "0":
                        lbl.Text = "<a id=\"\" style='background-color:#00ff00;' class=\"btn default btn-xs\"</a>";
                        break;

                    case "1":
                        lbl.Text = "<a id=\"\" style='background-color:#0000ff;' class=\"btn default btn-xs\"</a>";
                        break;

                    case "2":
                        lbl.Text = "<a id=\"\" style='background-color:#ff0000;' class=\"btn default btn-xs\"</a>";
                        break;

                    case "-1":
                    case "3":
                        lbl.Text = "<a id=\"\" style='background-color:yellow;' class=\"btn default btn-xs\"</a>";
                        break;
                    }
                }
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "2%;"
                });
                row.Cells[0].Controls.Add(lbl);
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = dr["operadora"].ToString()
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = dr["paquete"].ToString()
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = dr["numerorecarga"].ToString()
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = dr["fecha"].ToString()
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = dr["PaymentID"].ToString()
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = (rep.recargas.Columns.Contains("rstransactionid") ? dr["rstransactionid"].ToString() : "")
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "10%;", InnerHtml = (rep.recargas.Columns.Contains("rsrcode") ? dr["rsrcode"].ToString() : "")
                });
                row.Cells.Add(new HtmlTableCell()
                {
                    Width = "28%;", InnerHtml = dr["errvestadetallado"].ToString()
                });
                tbReporte.Rows.Add(row);

                HtmlTable     tbInterna = new HtmlTable();
                HtmlTableRow  row2 = null, rowint = null;;
                List <string> ls = new List <string> {
                    "0", "1", "2"
                };
                if (ls.Contains(dr["err"].ToString()))
                {
                    DataRow[] drvesta = (rep.vesta.Rows.Count > 0 ? rep.vesta.Select("paymentid = '" + dr["PaymentID"].ToString() + "'") : new DataRow[0]);
                    DataRow[] drrs    = (rep.rs.Rows.Count > 0 ? rep.rs.Select("idtransaccion = '" + dr["rstransactionid"].ToString() + "'") : new DataRow[0]);
                    if (drvesta.Count() > 0)
                    {
                        row2 = new HtmlTableRow()
                        {
                            BgColor = "#ffffff"
                        };
                        rowint = new HtmlTableRow()
                        {
                            BgColor = "#ffffff"
                        };
                        rowint.Cells.Add(new HtmlTableCell()
                        {
                            Width = "2%", InnerHtml = "<img width='40' src='assets/images/vesta.png'>"
                        });
                        rowint.Cells.Add(new HtmlTableCell()
                        {
                            Width = "10%", InnerHtml = drvesta[0]["paymentid"].ToString()
                        });
                        rowint.Cells.Add(new HtmlTableCell()
                        {
                            Width = "10%", InnerHtml = (decimal.Parse(drvesta[0]["amount"].ToString())).ToString("c")
                        });
                        rowint.Cells.Add(new HtmlTableCell()
                        {
                            Width = "10%", InnerHtml = drvesta[0]["vestadate"].ToString()
                        });
                        rowint.Cells.Add(new HtmlTableCell()
                        {
                            Width = "10%", InnerHtml = PaymentStatus(int.Parse(drvesta[0]["paymentstatus"].ToString()))
                        });
                        rowint.Cells.Add(new HtmlTableCell()
                        {
                            Width = "10%", InnerHtml = drvesta[0]["paymentstatusreason"].ToString()
                        });
                    }
                    if (dr["err"].ToString() == "0")
                    {
                        if (drrs.Count() > 0)
                        {
                            if (rowint == null)
                            {
                                rowint = new HtmlTableRow()
                                {
                                    BgColor = "#ffffff"
                                }
                            }
                            ;
                            if (row2 == null)
                            {
                                row2 = new HtmlTableRow()
                                {
                                    BgColor = "#ffffff"
                                }
                            }
                            ;
                            rowint.Cells.Add(new HtmlTableCell()
                            {
                                Width = "2%", InnerHtml = "<img width='30' src='assets/images/rs.png'>"
                            });
                            rowint.Cells.Add(new HtmlTableCell()
                            {
                                Width = "10%", InnerHtml = drrs[0]["idtransaccion"].ToString()
                            });
                            rowint.Cells.Add(new HtmlTableCell()
                            {
                                Width = "10%", InnerHtml = drrs[0]["fecha"].ToString()
                            });
                            rowint.Cells.Add(new HtmlTableCell()
                            {
                                Width = "10%", InnerHtml = drrs[0]["celular"].ToString()
                            });
                            rowint.Cells.Add(new HtmlTableCell()
                            {
                                Width = "10%", InnerHtml = (decimal.Parse(drrs[0]["monto"].ToString())).ToString("c")
                            });
                            rowint.Cells.Add(new HtmlTableCell()
                            {
                                Width = "10%", InnerHtml = drrs[0]["carrier"].ToString()
                            });
                            rowint.Cells.Add(new HtmlTableCell()
                            {
                                Width = "10%", InnerHtml = drrs[0]["folio"].ToString()
                            });
                        }
                        tbInterna.Width = "100%";
                    }
                    else
                    {
                        tbInterna.Width = "50%";
                    }
                    if (drvesta.Count() > 0 || drrs.Count() > 0)
                    {
                        tbInterna.Rows.Add(rowint);
                        StringBuilder  sb = new StringBuilder();
                        StringWriter   tw = new StringWriter(sb);
                        HtmlTextWriter hw = new HtmlTextWriter(tw);
                        tbInterna.RenderControl(hw);
                        row2.Cells.Add(new HtmlTableCell()
                        {
                            Width = "100%", ColSpan = 9, InnerHtml = sb.ToString()
                        });
                        tbReporte.Rows.Add(row2);
                    }
                }
            }
        }
    }
Esempio n. 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //--------------------------------------------------------------------------------------------------
            int idusr = 0;

            if (!IsPostBack)
            {
                divMenu.InnerHtml = check.GeneraMenu();
                ws = Session["wsac"] as wsac.IsacClient;
                int hab = ws.GetMonederoHab();
                if (hab == 1)
                {
                    tbMonedero.Visible = true;
                }
                else
                {
                    tbMonedero.Visible = false;
                }

                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();
                                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");
                    }
                }
            }
            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)
            {
                ws = Session["wsac"] as wsac.IsacClient;
                if (tvm == null)
                {
                    tvm            = new TarjetasViewModel();
                    Session["tvm"] = tvm;
                }
                tvm.WS = ws;
                tvm.Inicia();
                if (Session["rvm"] == null)
                {
                    Response.Redirect("datosrecarga.aspx");
                }
                else
                {
                    Refresh();
                }
            }
            else
            {
                if (Request.Form["__EVENTTARGET"] == "selcard")
                {
                    RecargasViewModel rvm = Session["rvm"] as RecargasViewModel;
                    rvm.IdTarjeta   = int.Parse(Request.Form["__EVENTARGUMENT"].ToString());
                    rvm.TipoTrans   = TipoTransaccion.SegundaVez;
                    rvm.idFormaPago = 2; //tarjeta
                    Session["rvm"]  = rvm;

                    Response.Redirect("confir_recarga.aspx");
                }
                if (Request.Form["__EVENTTARGET"] == "delcard")
                {
                    int idt = int.Parse(Request.Form["__EVENTARGUMENT"].ToString());
                    ws = Session["wsac"] as wsac.IsacClient;
                    if (ws.EliminaTarjeta(idt))
                    {
                        Response.Redirect("mediosdepago.aspx");
                    }
                }
            }

            btnUsarMon.Click += (s, ea) =>
            {
                RecargasViewModel rvm = Session["rvm"] as RecargasViewModel;
                rvm.idFormaPago = 1; //monedero
                Session["rvm"]  = rvm;
                SaldoMonedero mon = Session["SaldoMonedero"] as SaldoMonedero;
                ws = Session["wsac"] as wsac.IsacClient;
                string            jsonPq = ws.GetCatalogo(3, "");
                List <catPaquete> lspq   = JsonConvert.DeserializeObject <List <catPaquete> >(jsonPq);

                if (lspq.Where(x => x.idpaquete == rvm.idpaquete).FirstOrDefault().monto > mon.saldo)
                {
                    spnJS.Text = "<script>msgError('No tiene suficiente saldo');</script>";
                    Refresh();
                }
                else
                {
                    Response.Redirect("confir_recarga.aspx");
                }
            };
            btnNvaTarjeta.Click += (s, ea) =>
            {
                Response.Redirect("nuevatarjeta.aspx");
            };
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //--------------------------------------------------------------------------------------------------
            int idusr = 0;

            if (!IsPostBack)
            {
                CargaCombos(false);
            }

            txtNum4.TextChanged += (s, ea) =>
            {
                string num = "";
                if (!String.IsNullOrEmpty(txtNum1.Text) && !String.IsNullOrEmpty(txtNum2.Text) && !String.IsNullOrEmpty(txtNum3.Text) && !String.IsNullOrEmpty(txtNum4.Text))
                {
                    num = txtNum1.Text.Trim() + txtNum2.Text.Trim() + txtNum3.Text.Trim() + txtNum4.Text.Trim();
                    if (Session["tvm"] != null)
                    {
                        tvm = Session["tvm"] as TarjetasViewModel;
                    }
                    else
                    {
                        tvm = new TarjetasViewModel();
                    }

                    ccv = new CreditCardDetector(num);
                    if (ccv.IsValid())
                    {
                        tvm.idemisor      = SetEmisor(ccv.Brand);
                        tvm.NumeroTarjeta = num;
                        emisor.Value      = tvm.idemisor.ToString();
                    }
                    else
                    {
                        tvm.idemisor      = SetEmisor(ccv.Brand);
                        tvm.NumeroTarjeta = "";
                        emisor.Value      = tvm.idemisor.ToString();
                    }
                    Session["tvm"] = tvm;

                    ws         = Session["wsac"] as wsac.IsacClient;
                    jsonPa     = ws.GetCatalogo(2, "");                   //pais
                    jsonEmi    = ws.GetCatalogo(4, "");                   //emisor
                    jsonEdo    = ws.GetCatalogo(7, "");                   //estados
                    jsonCd     = ws.GetCatalogo(8, "order by municipio"); //ciudades
                    spnJS.Text = "<script>CargaCombos(); SetEmisor('" + tvm.idemisor.ToString() + "');</script>";
                }
            };

            /*btnCancelar.Click += (s, ea) =>
             * {
             *  Session["rvm"] = null;
             *  Session["tvm"] = null;
             *  Response.Redirect("index.aspx");
             * };*/
            btnGuardar.Click += (s, ea) =>
            {
                if (Session["tvm"] != null)
                {
                    tvm = Session["tvm"] as TarjetasViewModel;
                }
                else
                {
                    tvm = new TarjetasViewModel();
                }
                tvm.Idusuario  = 0; //int.Parse(Session["idusrlogged"].ToString());
                tvm.idpais     = int.Parse(hidPais.Value);
                tvm.ExpiraMM   = mes.Value;
                tvm.ExpiraYY   = anio.Value;
                tvm.Cvc        = cvc.Value;
                tvm.TitularFN  = nombre.Value;
                tvm.TitularLN  = apellidos.Value;
                tvm.CalleyNum  = domicilio.Value;
                tvm.IdEstado   = int.Parse(hidEstado.Value);
                tvm.IdCiudad   = int.Parse(hidCiudad.Value);
                tvm.CP         = codpostal.Value;
                Session["tvm"] = tvm;

                if (tvm.EsIncompleta())
                {
                    CargaCombos(true);
                }
                else
                {
                    if (tvm.ExpiraMM.Length < 2 || tvm.ExpiraYY.Length < 2)
                    {
                        CargaCombos(true);
                    }
                    else
                    {
                        RecargasViewModel rvm = Session["rvm"] as RecargasViewModel;
                        rvm.TipoTrans   = TipoTransaccion.PrimeraVez;
                        rvm.idFormaPago = 2; //tarjeta
                        Session["rvm"]  = rvm;
                        Response.Redirect("registro.aspx");
                    }
                }
            };
        }
Esempio n. 28
0
        private void getrecargas()
        {
            int idusr = 0;

            if (int.TryParse(Session["idusrlogged"].ToString(), out idusr))
            {
                if (idusr > 0)
                {
                    try
                    {
                        ws = Session["wsac"] as wsac.IsacClient;

                        string json_3 = ws.GetCatalogo(1, " ");
                        List <catOperadora> operadora = JsonConvert.DeserializeObject <List <catOperadora> >(json_3);

                        string            json_4     = ws.GetCatalogo(3, " ");
                        List <catPaquete> cat_paquet = JsonConvert.DeserializeObject <List <catPaquete> >(json_4);

                        string         json = ws.GetCatalogo(11, "where idusuario = " + idusr + " and err = 0 and rsauthorization is not null and rsauthorization != '' order by idrecarga desc");
                        List <Recarga> lu   = JsonConvert.DeserializeObject <List <Recarga> >(json);

                        List <recarga_detalle> fill_detalle = new List <recarga_detalle>();

                        recarga_detalle tem;

                        foreach (Recarga item in lu)
                        {
                            tem                 = new recarga_detalle();
                            tem.fecha           = item.fecha.ToString("dd/MMM/yyyy", CultureInfo.InvariantCulture);
                            tem.operadora       = operadora.Where(x => x.idoperadora == item.idoperadora).SingleOrDefault().operadora;
                            tem.den_monto       = cat_paquet.Where(c => c.idpaquete == item.idpaquete).SingleOrDefault().monto;
                            tem.numerorecarga   = item.numerorecarga;
                            tem.rsauthorization = item.rsauthorization;
                            tem.rsrcode         = item.rsrcode;
                            tem.rstransactionid = item.rstransactionid;
                            fill_detalle.Add(tem);
                        }

                        string json_2 = ws.GetCatalogo(14, "where idusuario = " + idusr + " and err = 0 and PaymentID is not null and PaymentID != '' order by idrecargamonedero desc");
                        List <RecargaMonedero> _recarga_monedero = JsonConvert.DeserializeObject <List <RecargaMonedero> >(json_2);

                        if (lu.Count > 0)
                        {
                            //List<Recarga> conexito = lu.Where (x => x.rstransactionid == null).ToList();
                            //List<Recarga> con_tem = lu.Where(x => x.rstransactionid != null).ToList();

                            GridView1.DataSource = fill_detalle;
                            GridView1.DataBind();
                            GridView2.DataSource = _recarga_monedero;
                            GridView2.DataBind();
                        }
                        //else
                        //    Response.Redirect("index.aspx");
                    }
                    catch (Exception er)
                    {
                    }
                }
                else
                {
                    Response.Redirect("index.aspx");
                }
            }
            else
            {
                Response.Redirect("index.aspx");
            }
        }
Esempio n. 29
0
        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)
                        {
                            //Validar session y status de usuario, si ya valido por SMS
                            ws = Session["wsac"] as wsac.IsacClient;
                            string         json = ws.GetUserV2(idusr, "", "");
                            List <Usuario> lu   = JsonConvert.DeserializeObject <List <Usuario> >(json);
                            if (lu.Count > 0)
                            {
                                Session["usrlogged"] = lu.FirstOrDefault();
                                string numero = "";
                                numero = check.SafeSqlLiteral(txtCodigo.Value.Trim());
                                if (numero == lu.FirstOrDefault().verificacion)
                                {
                                    bool res = ws.ActivarUsr(idusr);
                                    if (res)
                                    {
                                        Response.Redirect("index.aspx");
                                    }
                                    else
                                    {
                                        spnJS.Text = "<script>msgError('Error al verificar tu cuenta, revisa tu código.');</script>";
                                    }
                                }
                                else
                                {
                                    spnJS.Text = "<script>msgError('Error al verificar tu cuenta, revisa tus datos.');</script>";
                                }
                                //Response.Redirect("datosrecarga.aspx");
                            }
                        }
                        else
                        {
                            spnJS.Text = "<script>msgError('Ocurrio un error, contacta por teléfono. (Error 1) ');</script>";
                        }
                    }
                    else
                    {
                        spnJS.Text = "<script>msgError('Ocurrio un error, contacta por teléfono. (Error 2) ');</script>";
                    }
                }
                else
                {
                    spnJS.Text = "<script>msgError('Ocurrio un error, contacta por teléfono. (Error 3)  ');</script>";
                }
                if (!string.IsNullOrEmpty(Request.Form["redireccion"]))
                {
                    spnJS.Text = "<script>msgError('Ya existe un usuario con este email. Inicie sesion con su NIP');</script>";
                }
            }


//

            btnRegistrar.Click += (s, ea) =>
            {
                /*string numero = "";
                 * numero = check.SafeSqlLiteral(txtCodigo.Value.Trim());
                 *
                 * ws = Session["wsac"] as wsac.IsacClient;
                 * string json = ws.GetUser(idusr, "", "");
                 * List<Usuario> lu = JsonConvert.DeserializeObject<List<Usuario>>(json);
                 * if (lu.Count > 0)
                 * {
                 *
                 *  spnJS.Text = "<script>msgError('Tenemos al usuarioo "+lu.FirstOrDefault().verificacion+" a "+numero+"');</script>";
                 *  return;
                 * }*/
            };


            //
        }
Esempio n. 30
0
        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;
                            //  18/Mar/2017
                            //int hab = ws.GetMonederoHab();
                            //if (hab == 1){
                            //          //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)
                            //          {
                            //              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("datosrecarga.aspx"); //monedero no habilitado
                        }
                        else
                        {
                            Response.Redirect("index.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("index.aspx");
                    }
                }
            }
            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)
            {
                ws = Session["wsac"] as wsac.IsacClient;
                if (tvm == null)
                {
                    tvm            = new TarjetasViewModel();
                    Session["tvm"] = tvm;
                }
                tvm.WS = ws;
                tvm.Inicia();
                Refresh();

                rvm                      = new RecargasViewModel();
                rvm.Tiporecarga          = TipoRecarga.Monedero;
                rvm.WS                   = Session["wsac"] as wsac.IsacClient;
                rvm.IdUsuario            = int.Parse(Session["idusrlogged"].ToString());
                rvm.MontoRecargaMonedero = 0;
                Session["rvm"]           = rvm;
            }
            else
            {
                ws = Session["wsac"] as wsac.IsacClient;
                if (Request.Form["__EVENTTARGET"] == "selcard")
                {
                    decimal monto = 0;
                    if (decimal.TryParse(check.SafeSqlLiteral(txtMonto.Text.Trim()), out monto))
                    {
                        if (monto > 0M)
                        {
                            decimal montomax = ws.GetMontoMax();
                            if (monto > montomax)
                            {
                                spnJS.Text = "<script>msgError('Solamente le es permitido agregar " + montomax.ToString("c") + " por cada evento');</script>";
                                Refresh();
                            }
                            else
                            {
                                RecargasViewModel rvm = Session["rvm"] as RecargasViewModel;
                                rvm.IdTarjeta            = int.Parse(Request.Form["__EVENTARGUMENT"].ToString());
                                rvm.TipoTrans            = TipoTransaccion.SegundaVez;
                                rvm.idFormaPago          = 2; //tarjeta
                                rvm.MontoRecargaMonedero = monto;
                                Session["rvm"]           = rvm;
                                Response.Redirect("confir_monedero.aspx");
                            }
                        }
                        else
                        {
                            spnJS.Text = "<script>msgError('Capture el saldo a cargar');</script>";
                            Refresh();
                        }
                    }
                    else
                    {
                        spnJS.Text = "<script>msgError('Capture el saldo a cargar');</script>";
                        Refresh();
                    }
                }
                if (Request.Form["__EVENTTARGET"] == "delcard")
                {
                    int idt = int.Parse(Request.Form["__EVENTARGUMENT"].ToString());
                    ws = Session["wsac"] as wsac.IsacClient;
                    if (ws.EliminaTarjeta(idt))
                    {
                        Response.Redirect("monedero.aspx");
                    }
                }
            }


            btnNvaTarjeta.Click += (s, ea) =>
            {
                ws = Session["wsac"] as wsac.IsacClient;
                decimal monto = 0;
                if (decimal.TryParse(txtMonto.Text.Trim(), out monto))
                {
                    if (monto > 0M)
                    {
                        decimal montomax = ws.GetMontoMax();
                        if (monto > montomax)
                        {
                            spnJS.Text = "<script>msgError('Solamente le es permitido agregar " + montomax.ToString("c") + " por cada evento');</script>";
                            Refresh();
                        }
                        else
                        {
                            RecargasViewModel rvm = Session["rvm"] as RecargasViewModel;
                            rvm.TipoTrans            = TipoTransaccion.SegundaVez;
                            rvm.idFormaPago          = 2; //tarjeta
                            rvm.MontoRecargaMonedero = monto;
                            Session["rvm"]           = rvm;
                            Response.Redirect("nuevatarjeta.aspx");
                        }
                    }
                    else
                    {
                        spnJS.Text = "<script>msgError('Capture el saldo a cargar');</script>";
                        Refresh();
                    }
                }
                else
                {
                    spnJS.Text = "<script>msgError('Capture el saldo a cargar');</script>";
                    Refresh();
                }
            };
        }