Пример #1
0
        private void SetUserFunctionalities(User user)
        {
            var manager         = new FunctionalitiesManager();
            var functionalities = manager.GetRoleFunctionalities(user.RoleID);

            foreach (var functionality in functionalities)
            {
                user.Permissions.Add(functionality);
            }
        }
Пример #2
0
        public BindingList <Rol> GetRoles()
        {
            var result = SqlDataAccess.ExecuteDataTableQuery(
                ConfigurationManager.ConnectionStrings["GrouponConnectionString"].ToString(),
                "GRUPO_N.GetRoles"
                );
            var roles = new BindingList <Rol>();
            var functionalitiesManager = new FunctionalitiesManager();

            foreach (DataRow row in result.Rows)
            {
                var rol = new Rol()
                {
                    ID              = int.Parse(row["ID"].ToString()),
                    Nombre          = row["Descripcion"].ToString(),
                    Functionalities = functionalitiesManager.GetRoleFunctionalities(int.Parse(row["ID"].ToString()))
                };
                roles.Add(rol);
            }

            return(roles);
        }