/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { propSeguridad = new DTSeguridad(); objBLSeguridad = new BLSeguridad(propSeguridad); if (Request.Params["const"] != null) { string user = BLEncriptacion.Decrypt(Request.Params["const"].ToString()); ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial = true; ObjSessionDataUI.ObjDTUsuario.Nombre = user; propSeguridad.Usuario.Nombre = user; objBLSeguridad = new BLSeguridad(propSeguridad); objBLSeguridad.GetUsuario(); Response.Redirect("~/Public/Account/ForgotPassword.aspx", false); } } } catch (Exception ex) { AvisoMostrar = true; AvisoExcepcion = ex; } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { try { Master.BotonAvisoAceptar+=(VentanaAceptar); if (!Page.IsPostBack) { propSeguridad = new DTSeguridad(); objBLSeguridad = new BLSeguridad(propSeguridad); if (Request.Params["const"] != null) { string user = BLEncriptacion.Decrypt(Request.Params["const"].ToString()).Trim().ToLower(); ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial = true; ObjSessionDataUI.ObjDTUsuario.Nombre = user; propSeguridad.Usuario.Nombre = user; objBLSeguridad = new BLSeguridad(propSeguridad); objBLSeguridad.GetUsuario(); Response.Redirect("~/Private/Account/ForgotPassword.aspx", false); } if(User.Identity.IsAuthenticated) Response.Redirect("~/Private/Account/Welcome.aspx", false); } } catch (Exception ex) { AvisoMostrar = true; AvisoExcepcion = ex; } }
/// <summary> /// Cargars the usuario. /// </summary> private void CargarUsuario() { LimpiarCampos(); objBLSeguridad = new BLSeguridad(); objBLSeguridad.Data.Usuario = new DTUsuario(); objBLSeguridad.Data.Usuario = propUsuario; objBLSeguridad.GetUsuario(); propUsuario = objBLSeguridad.Data.Usuario; lblUserName.Text = propUsuario.Nombre; chkHabilitado.Checked = propUsuario.Aprobado; #region Carga los roles if (propUsuario.ListaRoles.Count > 0) ddlListRoles.SelectedValue = propUsuario.ListaRoles[0].NombreCorto; udpRoles.Visible = true; udpRoles.Update(); #endregion }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { try { Master.BotonAvisoAceptar += (VentanaAceptar); if (!Page.IsPostBack) { //Cargo en sesión los datos del usuario logueado DTSeguridad propSeguridad = new DTSeguridad(); propSeguridad.Usuario.Nombre = User.Identity.Name; BLSeguridad objBLSeguridad = new BLSeguridad(propSeguridad); objBLSeguridad.GetUsuario(); ObjSessionDataUI.ObjDTUsuario = objBLSeguridad.Data.Usuario; if (User.IsInRole(enumRoles.Alumno.ToString())) { habilitarAlumno(false); habilitarCurso(false); divAgenda.Visible = true; lblCurso.Visible = false; ddlCurso.Visible = false; } if (User.IsInRole(enumRoles.Docente.ToString())) { divAgenda.Visible = true; habilitarAlumno(false); UIUtilidades.BindCombo<Curso>(ddlCurso, listaCursos, "idCurso", "Nombre", true); } if (User.IsInRole(enumRoles.Tutor.ToString())) { divAgenda.Visible = true; habilitarCurso(false); ddlAlumnos.Items.Clear(); ddlAlumnos.DataSource = null; foreach (AlumnoCursoCicloLectivo item in listaAlumnos) { ddlAlumnos.Items.Insert(ddlAlumnos.Items.Count, new ListItem(item.alumno.apellido + " " + item.alumno.nombre, item.alumno.idAlumno.ToString())); } UIUtilidades.SortByText(ddlAlumnos); ddlAlumnos.Items.Insert(0, new ListItem("Seleccione", "-1")); ddlAlumnos.SelectedValue = "-1"; } fechas.startDate = cicloLectivoActual.fechaInicio; fechas.endDate = cicloLectivoActual.fechaFin; fechas.setSelectedDate(DateTime.Now, DateTime.Now.AddDays(15)); BLMensaje objBLMensaje = new BLMensaje(); List<Mensaje> objMensajes = new List<Mensaje>(); objMensajes = objBLMensaje.GetMensajes(new Mensaje() { destinatario = new Persona() { username = ObjSessionDataUI.ObjDTUsuario.Nombre }, activo = true }); objMensajes = objMensajes.FindAll(p => p.leido == false); if (objMensajes.Count > 0) { string mensaje = objMensajes.Count == 1 ? "mensaje" : "mensajes"; lblMensajes.Text = lblMensajes.Text.Replace("<MENSAJES>", objMensajes.Count.ToString()); lblMensajes.Text = lblMensajes.Text.Replace("<MSJ_STRING>", mensaje); } else divMensajes.Visible = false; CargarAgenda(); } else { fechas.setSelectedDate( (fechas.ValorFechaDesde != null) ? (DateTime)fechas.ValorFechaDesde : DateTime.Now, (fechas.ValorFechaHasta != null) ? (DateTime)fechas.ValorFechaHasta : DateTime.Now.AddDays(15)); } //this.txtDescripcionEdit.Attributes.Add("onkeyup", " ValidarCaracteres(this, 4000);"); } catch (Exception ex) { AvisoMostrar = true; AvisoExcepcion = ex; } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { try { //Llama a la funcionalidad que redirecciona a la pagina de Login cuando finaliza el tiempo de session ((EDUARBasePage)Page).DireccionamientoOnSessionEndScript(); NavigationMenu.MenuItemDataBound += (NavigationMenu_OnItemBound); ventanaInfoMaster.VentanaAceptarClick += new UserControls.VentanaInfo.VentanaBotonClickHandler(ventanaInfoMaster_VentanaAceptarClick); //11-3-13 if (HttpContext.Current.User == null || (ObjSessionDataUI.ObjDTUsuario.Nombre == null && HttpContext.Current.User.Identity.Name != string.Empty)) { //HttpContext.Current.User = null; //ObjSessionDataUI = null; if (HttpContext.Current.User != null) { DTSeguridad propSeguridad = new DTSeguridad(); propSeguridad.Usuario.Nombre = HttpContext.Current.User.Identity.Name.Trim().ToLower(); BLSeguridad objBLSeguridad = new BLSeguridad(propSeguridad); objBLSeguridad.GetUsuario(); if (objBLSeguridad.Data.Usuario != null) ObjSessionDataUI.ObjDTUsuario = objBLSeguridad.Data.Usuario; else HttpContext.Current.User = null; } } if (HttpContext.Current.User == null) { NavigationMenu.DataSource = SiteMapAnonymusEDUAR; //NavigationMenu.Orientation = Orientation.Horizontal; //div_Menu.Style.Clear(); //NavigationMenu.CssClass = "menu"; SiteMapPath1.SiteMapProvider = SiteMapAnonymusEDUAR.SiteMapProvider; NavigationMenu.Visible = true; CargarURLIniciarSesion(); } else { if (HttpContext.Current.User.Identity.IsAuthenticated) { divInfo.Visible = true; CargaInforUsuario(); // ~/Private/Manuales/{0}/index.htm string rol = string.Empty; if (HttpContext.Current.User.IsInRole(enumRoles.Administrador.ToString())) rol = enumRoles.Administrador.ToString(); if (HttpContext.Current.User.IsInRole(enumRoles.Administrativo.ToString())) rol = enumRoles.Administrativo.ToString(); if (HttpContext.Current.User.IsInRole(enumRoles.Alumno.ToString())) rol = enumRoles.Alumno.ToString(); if (HttpContext.Current.User.IsInRole(enumRoles.Director.ToString())) rol = enumRoles.Director.ToString(); if (HttpContext.Current.User.IsInRole(enumRoles.Docente.ToString())) rol = enumRoles.Docente.ToString(); if (HttpContext.Current.User.IsInRole(enumRoles.Preceptor.ToString())) rol = enumRoles.Preceptor.ToString(); if (HttpContext.Current.User.IsInRole(enumRoles.Psicopedagogo.ToString())) rol = enumRoles.Psicopedagogo.ToString(); if (HttpContext.Current.User.IsInRole(enumRoles.Tutor.ToString())) rol = enumRoles.Tutor.ToString(); if (!string.IsNullOrEmpty(rol) && ((HyperLink)Page.Master.FindControl("HeadLoginView").FindControl("linkAyuda")) != null) ((HyperLink)Page.Master.FindControl("HeadLoginView").FindControl("linkAyuda")).NavigateUrl = string.Format("~/Private/Manuales/{0}/index.html", rol); if (!string.IsNullOrEmpty(rol) && ((HyperLink)Page.Master.FindControl("HeadLoginView").FindControl("linkAyudaText")) != null) ((HyperLink)Page.Master.FindControl("HeadLoginView").FindControl("linkAyudaText")).NavigateUrl = string.Format("~/Private/Manuales/{0}/index.html", rol); //((HyperLink)Page.Master.FindControl("HeadLoginView").FindControl("linkAyuda")).NavigateUrl = string.Format("~/Private/Help/index.html"); //((HyperLink)Page.Master.FindControl("HeadLoginView").FindControl("linkAyudaText")).NavigateUrl = string.Format("~/Private/Help/index.html"); #region --[Mensajes en header]-- //StringBuilder s = new StringBuilder(); //string er; // configura los llamados a RaiseCallbackEvent y GetCallbackResult //er = Page.ClientScript.GetCallbackEventReference(this, "clientTime('')", "putCallbackResult", "null", "clientErrorCallback", true); // funcion que llama a RaiseCallbackEvent //s.Append(" function callServerTask() { "); //s.Append((er + ";")); //s.Append(" } "); //// inserta el script en la pgina //Page.ClientScript.RegisterClientScriptBlock( // this.GetType(), "callServerTask", s.ToString(), true); // NOTA: // La función callServerTask() es llamada desde la function timerEvent() #endregion } else { NavigationMenu.DataSource = SiteMapAnonymusEDUAR; //NavigationMenu.Orientation = Orientation.Horizontal; //div_Menu.Style.Clear(); //NavigationMenu.CssClass = "menu"; SiteMapPath1.SiteMapProvider = SiteMapAnonymusEDUAR.SiteMapProvider; NavigationMenu.Visible = true; CargarURLIniciarSesion(); } } NavigationMenu.DataBind(); // Ocultar la ventana de información ventanaInfoMaster.Visible = false; //Suscribe los eventos de la ventana emergente. ventanaInfoMaster.VentanaAceptarClick += (Aceptar); ventanaInfoMaster.VentanaCancelarClick += (Cancelar); if (!Page.IsPostBack) CargarMenu(); } catch (Exception ex) { ManageExceptions(ex); } }
/// <summary> /// Cargars the datos usuario. /// </summary> private void CargarDatosUsuario() { propSeguridad.Usuario.Email = txtEmail.Text.Trim(); propSeguridad.Usuario = ObjSessionDataUI.ObjDTUsuario; objBLSeguridad = new BLSeguridad(propSeguridad); objBLSeguridad.GetUsuario(); ObjSessionDataUI.ObjDTUsuario.PaswordPregunta = objBLSeguridad.Data.Usuario.PaswordPregunta; lblPregunta.Text = ObjSessionDataUI.ObjDTUsuario.PaswordPregunta; }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { try { RegisterHyperLink.NavigateUrl = "~/Private/Account/Validate.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]); ForgotPasswordHyperLink.NavigateUrl = "~/Private/Account/ForgotPassword.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]); HttpContext.Current.User = null; if (!Page.IsPostBack) { DTSeguridad propSeguridad = new DTSeguridad(); BLSeguridad objBLSeguridad = new BLSeguridad(propSeguridad); if (Request.Params["const"] != null) { string user = BLEncriptacion.Decrypt(Request.Params["const"].ToString().Replace(' ', '+')).Trim().ToLower(); ObjSessionDataUI.ObjDTUsuario.Nombre = user; // Provisoriamnente lo guardo en una variale de sesion userName porque el Page_Load de la Master me borra si HTTP.context es igual a null Session["userName"] = user; propSeguridad.Usuario.Nombre = user; objBLSeguridad = new BLSeguridad(propSeguridad); objBLSeguridad.GetUsuario(); ObjSessionDataUI.ObjDTUsuario = objBLSeguridad.Data.Usuario; ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial = true; //ObjDTSessionDataUI.ObjDTUsuario.Password = objBLSeguridad.Data.Usuario.Password; Response.Redirect("~/Private/Account/ForgotPassword.aspx", false); } } //ventanaInfoLogin.Visible = false; } catch (Exception ex) { AvisoMostrar = true; AvisoExcepcion = ex; } }
/// <summary> /// Método que se ejecuta al dibujar los controles de la página. /// Se utiliza para gestionar las excepciones del método Page_Load(). /// </summary> /// <param name="e"></param> //protected override void OnPreRender(EventArgs e) //{ // base.OnPreRender(e); // if (AvisoMostrar) // { // AvisoMostrar = false; // try // { // Master.ManageExceptions(AvisoExcepcion); // } // catch (Exception ex) { Master.ManageExceptions(ex); } // } //} /// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { try { RegisterHyperLink.NavigateUrl = "~/Public/Account/Validate.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]); ForgotPasswordHyperLink.NavigateUrl = "~/Public/Account/ForgotPassword.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]); HttpContext.Current.User = null; NavigationMenu.DataSource = SiteMapAnonymusEDUAR; NavigationMenu.MenuItemDataBound += (NavigationMenu_OnItemBound); NavigationMenu.DataBind(); //NavigationMenu.MenuItemDataBound += (NavigationMenu_OnItemBound); if (!Page.IsPostBack) { DTSeguridad propSeguridad = new DTSeguridad(); BLSeguridad objBLSeguridad = new BLSeguridad(propSeguridad); if (Request.Params["const"] != null) { string user = BLEncriptacion.Decrypt(Request.Params["const"].ToString()); ObjSessionDataUI.ObjDTUsuario.Nombre = user; propSeguridad.Usuario.Nombre = user; objBLSeguridad = new BLSeguridad(propSeguridad); objBLSeguridad.GetUsuario(); ObjSessionDataUI.ObjDTUsuario = objBLSeguridad.Data.Usuario; ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial = true; //ObjDTSessionDataUI.ObjDTUsuario.Password = objBLSeguridad.Data.Usuario.Password; Response.Redirect("~/Public/Account/ForgotPassword.aspx", false); } } ventanaInfoLogin.Visible = false; } catch (Exception) { //AvisoMostrar = true; //AvisoExcepcion = ex; } }