Exemple #1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(ISPCFG.Msce.clswfIndex));
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
            }

            if (Page.Request.QueryString["ReturnUrl"] != null)
            {
                //System.Web.Security.FormsAuthentication.SignOut();
                string strWarningMessage = "Usted ha sido redireccionado a esta página porque no tiene acceso a: <b>" + Page.Request.QueryString["ReturnUrl"] + "</b>. " +
                                           "Probablemente usted introdujo directamente la dirección URL en la barra de direcciones de su navegador. Si es así, por favor, utilice las " +
                                           "opciones que le proporciona la aplicación y si usted está recibiendo este mensaje y utilizó una opción disponible a través de la aplicación, " +
                                           "por favor, contacte con los administradores del sistema porque es probable que halla algún problema en la configuración de seguridad de la aplicación.";
                clsProcessError ProcessError = new clsProcessError();
                ProcessError.ShowPageWarningNotification(this.tr_Notify, this.sp_Notify, "ACCESO DENEGADO.", strWarningMessage);
                ProcessError = null;
            }
        }               // Fin de Page_Load()
Exemple #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (HttpContext.Current.Request.QueryString["downloadFile"] != null)
            {
                try
                {
                    string             strFileName = HttpContext.Current.Request.QueryString["downloadFile"].ToString();
                    clsMiMaletin       MiMaletin   = new clsMiMaletin(HttpContext.Current.User.Identity.Name);
                    System.IO.FileInfo fInfo       = MiMaletin.secureDownload(strFileName);
                    // Write the stream to the byte array
                    HttpContext.Current.Response.AddHeader("Content-disposition", "attachment; filename=" + strFileName);
                    HttpContext.Current.Response.AddHeader("Content-Length", fInfo.Length.ToString());
                    HttpContext.Current.Response.ContentType = "application/octet-stream";
                    HttpContext.Current.Response.WriteFile(fInfo.FullName);
                    HttpContext.Current.Response.End();
                }
                catch (System.Exception)
                {
                    clsProcessError ProcessError = new clsProcessError();
                    ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, "No se puede descargar el fichero seleccionado.");
                    ProcessError = null;
                }
            }

            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(clswfMiMaletin));
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
            }

            // Para cuando se suben ficheros.
            if (Request.Files.Count > 0)
            {
                try
                {
                    clsProcessError ProcessError = new clsProcessError();
                    ProcessError.ClearPageErrorNotification(this.tr_Notify, this.sp_Notify);
                    ProcessError = null;
                    clsMiMaletin MiMaletin = new clsMiMaletin(HttpContext.Current.User.Identity.Name);
                    MiMaletin.agregarFicheros(Request.Files);
                    MiMaletin = null;
                }
                catch (System.Exception Ex)
                {
                    clsProcessError ProcessError = new clsProcessError();
                    ProcessError.ShowPageWarningNotification(this.tr_Notify, this.sp_Notify, string.Empty, Ex.Message);
                    ProcessError = null;
                }
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(clswfListaUsuarios));

                clsUsuario.enuRolesName role = new ISPCFG.Msce.clsUsuario.enuRolesName();
                // Preestablecer valores para cuando no existe QueryString["role"]
                role = clsUsuario.enuRolesName.Academico;
                string roleName = "ACADÉMICOS";

                if (Page.Request.QueryString["role"] != null)
                {
                    switch (Page.Request.QueryString["role"].ToLower())
                    {
                    case "3":                             // Docentes
                    case "docente":
                    case "docentes":
                    {
                        role     = clsUsuario.enuRolesName.Docente;
                        roleName = "DOCENTES";
                        break;
                    }

                    case "4":                             // Maestrantes
                    case "maestrante":
                    case "maestrantes":
                    {
                        role     = clsUsuario.enuRolesName.Maestrante;
                        roleName = "MAESTRANTES";
                        break;
                    }
                    }
                }

                if (!Page.IsStartupScriptRegistered("ListarUsuarios"))
                {
                    System.Text.StringBuilder sbScript = new System.Text.StringBuilder();
                    sbScript.Append("<script language='JavaScript'><!--" + System.Environment.NewLine);
                    sbScript.Append("var settings = {\"role\":'" + System.Convert.ToByte(role) + "', " + System.Environment.NewLine);
                    sbScript.Append("\"roleName\":'" + roleName + "', \"currentPage\":1, \"recordsByPage\":0, \"cantPages\":0};" + System.Environment.NewLine);
                    sbScript.Append("//--></script>" + System.Environment.NewLine);
                    Page.RegisterStartupScript("ListarUsuarios", sbScript.ToString());
                }
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
                return;
            }
        }
Exemple #4
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         AjaxPro.Utility.RegisterTypeForAjax(typeof(clswfCategoria_docente));
     }
     catch (System.Exception)
     {
         string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
         clsProcessError ProcessError    = new clsProcessError();
         ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
         ProcessError = null;
     }
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(clswfEditarBibliografia));
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
            }

            if (Request.Files.Count > 0)
            {
                for (int i = 0; i <= (Request.Files.Count - 1); i++)
                {
                    System.Diagnostics.Debug.WriteLine("FileName: " + Request.Files[i].FileName + " ContentType: " + Request.Files[i].ContentType + " ContentLength: " + Request.Files[i].ContentLength);
                }
            }
        }
Exemple #6
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(clswfBuscadorConsultas));
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
            }

            if (!Page.IsStartupScriptRegistered("SearchSettings"))
            {
                clsUsuario Usuario = new clsUsuario(HttpContext.Current.User.Identity.Name);
                System.Text.StringBuilder sbSearchSettings = new System.Text.StringBuilder();
                sbSearchSettings.Append("<script language='JavaScript'><!--" + System.Environment.NewLine);
                sbSearchSettings.Append("var settings = {\"role\": '" + Usuario.RolePrincipal + "', " + System.Environment.NewLine);
                sbSearchSettings.Append("\"tema\":'!=0', " + System.Environment.NewLine);
                sbSearchSettings.Append("\"respondidaPor\": '!=0', " + System.Environment.NewLine);
                sbSearchSettings.Append("\"soloMisConsultas\": '!=0', " + System.Environment.NewLine);
                sbSearchSettings.Append("\"cadena\": '%', " + System.Environment.NewLine);
                sbSearchSettings.Append("\"currentPage\":1, " + System.Environment.NewLine);
                sbSearchSettings.Append("\"recordsByPage\":5, " + System.Environment.NewLine);
                sbSearchSettings.Append("\"cantPages\":0, " + System.Environment.NewLine);
                sbSearchSettings.Append("\"begTime\":0, " + System.Environment.NewLine);
                sbSearchSettings.Append("\"endTime\":0, " + System.Environment.NewLine);
                sbSearchSettings.Append("\"searchMode\":'Simple'};" + System.Environment.NewLine);
                sbSearchSettings.Append("//--></script>" + System.Environment.NewLine);
                Usuario = null;
                Page.RegisterStartupScript("SearchSettings", sbSearchSettings.ToString());
                sbSearchSettings = null;
            }
        }
Exemple #7
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(clswfPerfil));
            }
            catch (System.Exception)
            {
                string          strErrorMessage = "Alguna(s) de las funcionalidades en esta página no estará disponible.";
                clsProcessError ProcessError    = new clsProcessError();
                ProcessError.ShowPageErrorNotification(this.tr_Notify, this.sp_Notify, strErrorMessage);
                ProcessError = null;
            }


            settings.perfilId   = 0;
            settings.esMiPerfil = false;

            if (!Page.IsStartupScriptRegistered("perfilSettings"))
            {
                // NEW
                // Existe el valor Id en el QueryString
                if (HttpContext.Current.Request.QueryString["Id"] != null)
                {
                    try
                    {
                        // Comprobar si es un UInt32 y si existe el Id en la base de datos.
                        clsUsuario UsuarioById = new clsUsuario(System.Convert.ToUInt32(HttpContext.Current.Request.QueryString["Id"]));
                        if (UsuarioById.Id > 0)
                        {
                            settings.perfilId    = UsuarioById.Id;
                            settings.perfilRoles = UsuarioById.Roles.ToString();
                        }
                        UsuarioById = null;
                    }
                    catch (System.Exception)
                    {
                        clsUsuario UsuarioByUserId = new clsUsuario(HttpContext.Current.Request.QueryString["Id"].ToString());
                        if (UsuarioByUserId.Id > 0)
                        {
                            settings.perfilId = UsuarioByUserId.Id;
                            //settings.perfilRoles = UsuarioByUserId.Roles.ToString();
                        }
                        UsuarioByUserId = null;
                    }
                }
                else                 // Si no existe el Id en el QueryString
                {
                    // Si está identificado recuperar el Id propio.
                    if (HttpContext.Current.User.Identity.IsAuthenticated)
                    {
                        clsUsuario UsuarioActual = new clsUsuario(HttpContext.Current.User.Identity.Name);
                        settings.perfilId = UsuarioActual.Id;
                        UsuarioActual     = null;
                    }
                }
                // En este punto tenemos un valor Id válido del perfil del usuario que se está solicitando si
                // corresponde ó cero (0), lo que indicaría que el usuario solicitando la página no está
                // identificado y no utilizó un Id en el QueryString ó el utilizado no es válido.

                // Comprobar que el Id del perfil no es cero antes de ver si es el del propio usuario.
                clsUsuario Usuario = new clsUsuario(HttpContext.Current.User.Identity.Name);
                if (settings.perfilId > 0)
                {
                    settings.esMiPerfil  = settings.perfilId == Usuario.Id;
                    settings.perfilRoles = Usuario.Roles.ToString();
                }
                settings.userRoles = Usuario.Roles.ToString();
                Usuario            = null;

                System.Text.StringBuilder sbScript = new System.Text.StringBuilder();
                sbScript.Append("<script language='JavaScript'><!-- " + System.Environment.NewLine);
                sbScript.Append("var settings = {\"perfilId\": " + settings.perfilId + ", " + System.Environment.NewLine);
                sbScript.Append("\"perfilRoles\": '" + settings.perfilRoles + "', " + System.Environment.NewLine);
                sbScript.Append("\"userRoles\": '" + settings.userRoles + "', " + System.Environment.NewLine);
                sbScript.Append("\"esMiPerfil\": " + System.Convert.ToByte(settings.esMiPerfil) + "}; " + System.Environment.NewLine);
                sbScript.Append("//--></script>" + System.Environment.NewLine);
                System.Diagnostics.Debug.WriteLine(sbScript.ToString());
                Page.RegisterStartupScript("perfilSettings", sbScript.ToString());
                sbScript = null;
            }
        }