Example #1
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();
                }
            };
        }
Example #2
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");
            };
        }
Example #3
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();
            }

            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>";
                }
            };
        }
Example #4
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", ""));
                }
            }

            //-------------------------------------------------------------------------------------------------
            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");
                    }
                }
            }
        }