Esempio n. 1
0
        private void SCargarOpcionesModulo(Int32 pintIdRol)
        {
            ModuloRolBLL capanegocios = new ModuloRolBLL();
            ModuloRolBE  objModuloRol = new ModuloRolBE();

            try
            {
                objModuloRol.IdRol = pintIdRol;

                List <ModuloRolBE> listModuloRol = new List <ModuloRolBE>();
                listModuloRol = capanegocios.List(objModuloRol);

                foreach (ModuloRolBE oModuloRol in listModuloRol)
                {
                    if (oModuloRol.IdModulo.Equals(oModuloRol.Modulo.IdPadre))
                    {
                        mnuPrincipal.Items.Add(new MenuItem(oModuloRol.Modulo.Modulo.ToString(), oModuloRol.IdModulo.ToString()));
                    }
                }

                foreach (ModuloRolBE oModuloRol in listModuloRol)
                {
                    if (oModuloRol.Modulo.Nivel > 1)
                    {
                        MenuItem mnu = new MenuItem(oModuloRol.Modulo.Modulo.ToString(), oModuloRol.IdModulo.ToString());
                        mnuPrincipal.FindItem(oModuloRol.Modulo.IdPadre.ToString()).ChildItems.Add(mnu);
                    }
                }
            }
            catch (Exception ex)
            {
                errores = ex.Message;
            }
        }
Esempio n. 2
0
 public List <ModuloRolBE> List(ModuloRolBE objModuloRol)
 {
     try
     {
         return(new ModuloRolDAL().List(objModuloRol));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
0
        public List <ModuloRolBE> List(ModuloRolBE objModuloRol)
        {
            List <ModuloRolBE>          lstModuloRol     = null;
            Dictionary <string, object> searchParameters = null;

            try
            {
                searchParameters = new Dictionary <string, object>()
                {
                    { "@IdRol", objModuloRol.IdRol }
                };

                SqlDataReader reader = SqlHelper.GetDataReader("pListModuloRol", searchParameters);


                if (reader.HasRows)
                {
                    lstModuloRol = new List <ModuloRolBE>();

                    while (reader.Read())
                    {
                        ModuloRolBE oModuloRol = new ModuloRolBE();

                        oModuloRol.IdModulo       = Convert.ToInt32(reader["IdModulo"]);
                        oModuloRol.IdRol          = Convert.ToInt32(reader["IdRol"]);
                        oModuloRol.Nuevo          = Convert.ToInt32(reader["Nuevo"]);
                        oModuloRol.Actualizar     = Convert.ToInt32(reader["Actualizar"]);
                        oModuloRol.Eliminar       = Convert.ToInt32(reader["Eliminar"]);
                        oModuloRol.Exportar       = Convert.ToInt32(reader["Exportar"]);
                        oModuloRol.Imprimir       = Convert.ToInt32(reader["Imprimir"]);
                        oModuloRol.Modulo         = new ModuloBE();
                        oModuloRol.Modulo.Modulo  = Convert.ToString(reader["Nombre"]);
                        oModuloRol.Modulo.Nivel   = Convert.ToInt32(reader["Nivel"]);
                        oModuloRol.Modulo.IdPadre = Convert.ToInt32(reader["Padre"]);
                        oModuloRol.Modulo.Url     = Convert.ToString(reader["URL"]);
                        oModuloRol.Modulo.Tooltip = Convert.ToString(reader["ToolTip"]);

                        lstModuloRol.Add(oModuloRol);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(lstModuloRol);
        }