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