Ejemplo n.º 1
0
        public void CrearRol(DTSeguridad objSeguridad)
        {
            try
            {
                transaction.DBcomand = transaction.DataBase.GetStoredProcCommand("Roles_Insert");

                // Añadir parámetros
                transaction.DataBase.AddInParameter(transaction.DBcomand, "@ApplicationName", DbType.String, objSeguridad.Aplicacion);
                transaction.DataBase.AddInParameter(transaction.DBcomand, "@RoleName", DbType.String, objSeguridad.Rol.Nombre);
                transaction.DataBase.AddInParameter(transaction.DBcomand, "@LoweredRoleName", DbType.String, objSeguridad.Rol.Nombre.ToLower());
                transaction.DataBase.AddInParameter(transaction.DBcomand, "@Description", DbType.String, objSeguridad.Rol.Descripcion);

                transaction.DataBase.ExecuteNonQuery(transaction.DBcomand);

            }
            catch (SqlException ex)
            {
                throw new CustomizedException(string.Format("Fallo en {0} - CrearRol()", ClassName),
                                    ex, enuExceptionType.SqlException);
            }
            catch (Exception ex)
            {
                throw new CustomizedException(string.Format("Fallo en {0} - CrearRol()", ClassName),
                                    ex, enuExceptionType.DataAccesException);
            }
        }
Ejemplo n.º 2
0
 /// <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;
     }
 }
Ejemplo n.º 3
0
        /// <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;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void LoginUsuario_Authenticate(object sender, AuthenticateEventArgs e)
        {
            try
            {
                Session.Abandon();
                LoginUser.UserName = LoginUser.UserName.Trim().ToLower();
                DTSeguridad objDTSeguridad = new DTSeguridad
                {
                    Usuario =
                    {
                        Nombre = LoginUser.UserName.Trim().ToLower(),
                        Password = BLEncriptacion.Encrypt(LoginUser.Password.Trim())
                    }
                };

                BLSeguridad objSeguridadBL = new BLSeguridad(objDTSeguridad);
                objSeguridadBL.ValidarUsuario();

                if (objDTSeguridad.Usuario.UsuarioValido)
                {
                    e.Authenticated = true;
                    FormsAuthentication.SignOut();
                    FormsAuthentication.Initialize();
                    FormsAuthentication.SetAuthCookie(LoginUser.UserName.Trim().ToLower(), false);
                    ObjSessionDataUI.ObjDTUsuario = objDTSeguridad.Usuario;
                    UIUtilidades.EliminarArchivosSession(Session.SessionID);

                    if (ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial)
                        Response.Redirect("~/Private/Account/ChangePassword.aspx", false);
                    else
                        //if (Request.Params["ReturnUrl"] != null)
                        FormsAuthentication.RedirectFromLoginPage(LoginUser.UserName.Trim(), false);
                }
                else
                {
                    e.Authenticated = false;
                    LoginUser.FailureText = UIConstantesGenerales.MensajeLoginFallido;
                }
            }
            catch (Exception ex)
            {
                Master.ManageExceptions(ex);
            }
        }
Ejemplo n.º 5
0
        protected void ChangePasswordPushButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            try
            {
                DTSeguridad objDTSeguridad = new DTSeguridad
                {
                    Usuario =
                    {
                        Nombre = ObjSessionDataUI.ObjDTUsuario.Nombre,
                        Password = BLEncriptacion.Encrypt(ChangeUserPassword.CurrentPassword.Trim()),
                        PasswordNuevo = BLEncriptacion.Encrypt(ChangeUserPassword.NewPassword.Trim())
                    }
                };

                BLSeguridad objSeguridadBL = new BLSeguridad(objDTSeguridad);
                objSeguridadBL.CambiarPassword();
                Response.Redirect("~/Private/Account/ChangePasswordSuccess.aspx", false);
            }
            catch (Exception ex)
            {
                Master.ManageExceptions(ex);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the CreatedUser event of the RegisterUser 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 RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            propSeguridad = new DTSeguridad();
            propSeguridad.Usuario.Nombre = RegisterUser.UserName.Trim();
            //Personal = 1,
            //Alumno = 2,
            //Tutor = 3
            DTRol rol = new DTRol();

            switch (propPersona.idTipoPersona)
            {
                case 1:
                    rol.Nombre = enumRoles.Administrativo.ToString();
                    break;
                case 2:
                    rol.Nombre = enumRoles.Alumno.ToString();
                    break;
                case 3:
                    rol.Nombre = enumRoles.Tutor.ToString();
                    break;
            }
            //asigna un rol por defecto, en función de la persona
            propSeguridad.Usuario.ListaRoles.Add(rol);
            propSeguridad.Usuario.Aprobado = true;
            propSeguridad.Usuario.EsUsuarioInicial = false;

            //encriptar la password
            propSeguridad.Usuario.PasswordNuevo = BLEncriptacion.Encrypt(RegisterUser.Password);
            propSeguridad.Usuario.Password = RegisterUser.Password;

            objBLSeguridad = new BLSeguridad(propSeguridad);
            objBLSeguridad.ActualizarUsuario();

            objBLSeguridad.CambiarPassword();

            //actualiza el nombre de usuario en la persona
            propPersona.username = propSeguridad.Usuario.Nombre;
            BLPersona objBLPersona = new BLPersona(propPersona);
            objBLPersona.Save();

            //loquea al usuario y lo redirecciona a la pagina de inicio de usuarios logueados
            Session.Abandon();
            FormsAuthentication.SignOut();
            FormsAuthentication.Initialize();
            FormsAuthentication.SetAuthCookie(propSeguridad.Usuario.Nombre, true /* createPersistentCookie */);
            ObjSessionDataUI.ObjDTUsuario = propSeguridad.Usuario;

            string continueUrl = RegisterUser.ContinueDestinationPageUrl;
            if (string.IsNullOrEmpty(continueUrl))
                continueUrl = "~/Private/Account/Welcome.aspx";
            Response.Redirect(continueUrl, false);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Cargars the list roles.
        /// </summary>
        private void CargarListRoles()
        {
            DTSeguridad objSeguridad = new DTSeguridad();
            BLSeguridad objBLSeguridad = new BLSeguridad(objSeguridad);

            objBLSeguridad.GetRoles();
            foreach (DTRol rol in objBLSeguridad.Data.ListaRoles)
            {
                //chkListRolesBusqueda.Items.Add(new System.Web.UI.WebControls.ListItem(rol.Nombre, rol.NombreCorto));
                ddlRoles.Items.Add(new System.Web.UI.WebControls.ListItem(rol.Nombre, rol.NombreCorto));
            }
        }
Ejemplo n.º 8
0
        private void EliminarUsuarios(DTSeguridad objDTSeguridad, string Nombre)
        {
            try
            {
                foreach (DTUsuario objUsuarioDelete in objDTSeguridad.ListaUsuarios)
                {

                    if (objUsuarioDelete.Nombre.ToString() != string.Empty && Membership.FindUsersByName(objUsuarioDelete.Nombre.ToString()).Count > 0)
                    {
                        foreach (DTRol rolUsuario in objUsuarioDelete.ListaRoles)
                        {
                            if (rolUsuario.Nombre.ToString() != string.Empty && Roles.RoleExists(rolUsuario.Nombre.ToString()))
                                Roles.RemoveUserFromRole(objUsuarioDelete.Nombre, rolUsuario.Nombre);
                        }
                        Membership.DeleteUser(objUsuarioDelete.Nombre, true);
                    }
                    if (Nombre == objUsuarioDelete.Nombre)
                        return;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Guardars the usuario.
        /// </summary>
        private void GuardarUsuario()
        {
            List<DTRol> listaRoles = new List<DTRol>();
            listaRoles.Add(new DTRol() { NombreCorto = ddlListRoles.SelectedValue, Nombre = ddlListRoles.SelectedItem.Text });

            DTSeguridad objDTSeguridad = new DTSeguridad { Usuario = { Nombre = lblUserName.Text.Trim(), ListaRoles = listaRoles, Aprobado = chkHabilitado.Checked } };
            objBLSeguridad = new BLSeguridad();
            objBLSeguridad.Data = objDTSeguridad;
            objBLSeguridad.ActualizarUsuario();

            //BuscarFiltrando();
            LimpiarCampos();

            udpRoles.Visible = false;
            udpRoles.Update();
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Ventanas the aceptar.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 void VentanaAceptar(object sender, EventArgs e)
 {
     try
     {
         switch (AccionPagina)
         {
             case enumAcciones.Guardar:
                 GuardarUsuario();
                 AccionPagina = enumAcciones.Limpiar;
                 Master.MostrarMensaje(enumTipoVentanaInformacion.Satisfactorio.ToString(), UIConstantesGenerales.MensajeGuardadoOk, enumTipoVentanaInformacion.Satisfactorio);
                 LimpiarCampos();
                 udpRoles.Visible = false;
                 propSeguridad = new DTSeguridad();
                 propSeguridad.Usuario.Aprobado = chkHabilitadoBusqueda.Checked;
                 objBLSeguridad = new BLSeguridad(propSeguridad);
                 BuscarUsuarios(propSeguridad.Usuario);
                 CargarPresentacion();
                 break;
             case enumAcciones.Salir:
                 Response.Redirect("~/Default.aspx", false);
                 break;
             default:
                 break;
         }
         udpRoles.Update();
         udpGrilla.Update();
     }
     catch (Exception ex)
     {
         Master.ManageExceptions(ex);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void LoginUsuario_Authenticate(object sender, AuthenticateEventArgs e)
        {
            try
            {
                Session.Abandon();
                DTSeguridad objDTSeguridad = new DTSeguridad
                {
                    Usuario =
                    {
                        Nombre = LoginUser.UserName.Trim(),
                        Password = LoginUser.Password.Trim()
                    }
                };

                BLSeguridad objSeguridadBL = new BLSeguridad(objDTSeguridad);
                objSeguridadBL.ValidarUsuario();

                if (objDTSeguridad.Usuario.UsuarioValido)
                {
                    e.Authenticated = true;
                    FormsAuthentication.SignOut();
                    FormsAuthentication.Initialize();
                    FormsAuthentication.SetAuthCookie(LoginUser.UserName.Trim(), false);
                    ObjSessionDataUI.ObjDTUsuario = objDTSeguridad.Usuario;
                    UIUtilidades.EliminarArchivosSession(Session.SessionID);
                    if (ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial)
                        Response.Redirect("~/Private/Account/ChangePassword.aspx", false);
                }
                else
                {
                    e.Authenticated = false;
                    LoginUser.FailureText = UIConstantesGenerales.MensajeLoginFallido;
                }
            }
            catch (Exception ex)
            {
                try
                {
                    ManageExceptions(ex);
                    updVentaneMensajes.Update();
                }
                catch
                {

                }
            }
        }
Ejemplo n.º 12
0
        /// <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);
            }
        }
Ejemplo n.º 13
0
        /// <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();
                    CargarPresentacionValidacion();
                }
            }
            catch (Exception ex)
            {
                AvisoMostrar = true;
                AvisoExcepcion = ex;
            }
        }
Ejemplo n.º 14
0
        /// <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;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Guardars the rol.
        /// </summary>
        private void GuardarRol(DTRol objRol)
        {
            DTSeguridad objDTSeguridad = new DTSeguridad { Rol = objRol };
            objBLSeguridad = new BLSeguridad();
            objBLSeguridad.Data = objDTSeguridad;
            objBLSeguridad.GuardarRol();

            BuscarRoles(propSeguridad);
            LimpiarCampos();
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Obteners the datos.
 /// </summary>
 private void BuscarRoles(DTSeguridad objSeguridad)
 {
     objBLSeguridad = new BLSeguridad(objSeguridad);
     objBLSeguridad.Data = objSeguridad;
     objBLSeguridad.GetRoles();
     propSeguridad = objBLSeguridad.Data;
     CargarGrilla();
 }
Ejemplo n.º 17
0
 private void BuscarFiltrando()
 {
     List<DTRol> ListaRoles = new List<DTRol>();
     foreach (ListItem item in chkListRolesBusqueda.Items)
     {
         if (item.Selected)
         {
             ListaRoles.Add(new DTRol() { Nombre = item.Value });
         }
     }
     DTSeguridad objSeguridad = new DTSeguridad();
     objSeguridad.ListaRoles = ListaRoles;
     BuscarRoles(objSeguridad);
 }
Ejemplo n.º 18
0
        /// <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)
                {
                    Response.Cookies.Clear();
                    HttpContext.Current.User = null;
                    propSeguridad = new DTSeguridad();
                    if (ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial == true)
                    {
                        ObjSessionDataUI.ObjDTUsuario.EsUsuarioInicial = false;
                        CargarDatosUsuario();
                        CargarPresentacionRecover();
                    }
                    else
                    {
                        udpEmail.Visible = true;
                        udpRecover.Visible = false;
                    }
                    udpForgotPassword.Update();

                }
            }
            catch (Exception ex)
            {
                AvisoMostrar = true;
                AvisoExcepcion = ex;
            }
        }
Ejemplo n.º 19
0
 /// <summary>
 /// Guardars the usuario.
 /// </summary>
 private void GuardarUsuario()
 {
     DTSeguridad objSeguridad = new DTSeguridad();
     objSeguridad.Usuario = ObjSessionDataUI.ObjDTUsuario;
     objSeguridad.Usuario.Email = txtEmail.Text;
     atrBLSeguridad = new BLSeguridad(objSeguridad);
     atrBLSeguridad.ActualizarEmail();
 }
Ejemplo n.º 20
0
        /// <summary>
        /// Método que crea los usuarios en forma masiva. 
        /// </summary>
        public void CrearUsuarios(DTSeguridad objDTSeguridad)
        {
            DASeguridad dataAcces = new DASeguridad();
            try
            {

                //Abre la transaccion que se va a utilizar
                //dataAcces.transaction.OpenTransaction();
                dataAcces.CrearUsuarios(objDTSeguridad);
                //Se da el OK para la transaccion.
                //dataAcces.transaction.CommitTransaction();
            }
            catch (CustomizedException ex)
            {
                //dataAcces.transaction.RollbackTransaction();
                throw ex;
            }
            catch (Exception ex)
            {
                //dataAcces.transaction.RollbackTransaction();
                throw new CustomizedException(string.Format("Fallo en {0} - CrearUsuarios()", ClassName), ex,
                                              enuExceptionType.BusinessLogicException);
            }
        }
Ejemplo n.º 21
0
        /// <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;
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// 
 /// </summary>
 public BLSeguridad()
 {
     Data = new DTSeguridad { Aplicacion = Membership.ApplicationName };
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Constructor con DTO como parámetro.
 /// </summary>
 public BLSeguridad(DTSeguridad objDTUsuario)
 {
     Data = objDTUsuario;
     Data.Aplicacion = Membership.ApplicationName;
 }
Ejemplo n.º 24
0
        /// <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);
                Master.BotonAvisoCancelar += (VentanaCancelar);

                if (!Page.IsPostBack)
                {
                    propSeguridad = new DTSeguridad();
                    atrBLSeguridad = new BLSeguridad(propSeguridad);
                    propPersona = new Persona();
                    propPersona.idTipoPersona = 1;
                    CargarPresentacion();
                    CargarCamposFiltros();
                    BuscarFiltrando();
                }
            }
            catch (Exception ex)
            {
                AvisoMostrar = true;
                AvisoExcepcion = ex;
            }
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Metodo que obtiene usuarios.
 /// </summary>
 public void GetUsuarios()
 {
     try
     {
         DASeguridad dataAcces = new DASeguridad();
         Data = dataAcces.GetUsuarios(Data, true);
     }
     catch (CustomizedException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw new CustomizedException(string.Format("Fallo en {0} - GetUsuarios", ClassName), ex,
                                       enuExceptionType.BusinessLogicException);
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Guardars the usuario.
        /// </summary>
        private void GuardarUsuario()
        {
            DTUsuario objUsuario = new DTUsuario();
            objUsuario.Nombre = txtUserName.Text;
            objUsuario.Email = txtEmailUsuario.Text;
            objUsuario.Aprobado = chkHabilitado.Checked;
            objUsuario.PaswordPregunta = lblPreguntaUsuario.Text;
            objUsuario.PaswordRespuesta = lblRespuestaUsuario.Text;
            objUsuario.EsUsuarioInicial = true;
            objUsuario.ListaRoles = new List<DTRol>();
            objUsuario.ListaRoles.Add(new DTRol() { NombreCorto = ddlListRoles.SelectedValue, Nombre = ddlListRoles.SelectedItem.Text });

            DTSeguridad objSeguridad = new DTSeguridad();
            objSeguridad.Usuario = objUsuario;
            atrBLSeguridad = new BLSeguridad(objSeguridad);
            atrBLSeguridad.CrearUsuario();

            Persona objPersona = new Persona();
            atrBLPersona = new BLPersona(propPersona);
            atrBLPersona.GetById();
            atrBLPersona.Data.username = objUsuario.Nombre;
            atrBLPersona.Save();
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Obteners the datos.
 /// </summary>
 private void BuscarUsuarios(DTUsuario objUsuario)
 {
     DTSeguridad seguridad = new DTSeguridad();
     seguridad.Usuario = objUsuario;
     seguridad.ListaRoles = objUsuario.ListaRoles;
     objBLSeguridad = new BLSeguridad(seguridad);
     objBLSeguridad.Data = seguridad;
     objBLSeguridad.GetUsuarios();
     propSeguridad = objBLSeguridad.Data;
     CargarGrilla();
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Ejecuta las acciones requeridas por el boton aceptar de la ventana de informacion.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void VentanaAceptar(object sender, EventArgs e)
 {
     try
     {
         switch (AccionPagina)
         {
             case enumAcciones.Guardar:
                 GuardarUsuario();
                 AccionPagina = enumAcciones.Limpiar;
                 Master.MostrarMensaje(enumTipoVentanaInformacion.Satisfactorio.ToString(), UIConstantesGenerales.MensajeGuardadoOk, enumTipoVentanaInformacion.Satisfactorio);
                 break;
             case enumAcciones.Salir:
                 Response.Redirect("~/Default.aspx", false);
                 break;
             case enumAcciones.Limpiar:
                 propSeguridad = new DTSeguridad();
                 atrBLSeguridad = new BLSeguridad(propSeguridad);
                 propPersona = new Persona();
                 propListaPersonas = null;
                 propPersona.idTipoPersona = 1;
                 LimpiarCampos();
                 CargarPresentacion();
                 //CargarCamposFiltros();
                 CargarGrilla();
                 break;
             default:
                 break;
         }
         udpRoles.Update();
         udpGrilla.Update();
     }
     catch (Exception ex)
     {
         Master.ManageExceptions(ex);
     }
 }
Ejemplo n.º 29
0
        /// <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();
                    propSeguridad.Usuario.Aprobado = chkHabilitadoBusqueda.Checked;
                    objBLSeguridad = new BLSeguridad(propSeguridad);
                    CargarCamposFiltros();
                    BuscarUsuarios(propSeguridad.Usuario);
                    CargarPresentacion();
                }
            }
            catch (Exception ex)
            {
                AvisoMostrar = true;
                AvisoExcepcion = ex;
            }
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Cambiars the pregunta.
 /// </summary>
 private void CambiarPregunta()
 {
     ObjSessionDataUI.ObjDTUsuario.PaswordPregunta = Question.Text.Trim();
     ObjSessionDataUI.ObjDTUsuario.PaswordRespuesta = Answer.Text.Trim();
     propSeguridad = new DTSeguridad();
     propSeguridad.Usuario = ObjSessionDataUI.ObjDTUsuario;
     objBLSeguridad = new BLSeguridad(propSeguridad);
     objBLSeguridad.CambiarPregunta();
 }