public IList<FullItemModel> GetByParent(int parentId)
        {
            Project result = session.Load<Project>(parentId);
            IList<FullItemModel> models = new List<FullItemModel>();
            models.FilledBy(result.Children);

            return models;
        }
        public IList<ProjectAuthorizationModel> GetAdmined(int userId)
        {
            IList<ProjectAuthorizationModel> models = new List<ProjectAuthorizationModel>();

            User result = session.Load<User>(userId);
            IList<Authorization> isAdminAuthorizations = result.Authorizations
                .Where(x => x.IsAdmin).ToList();


            models.FilledBy(isAdminAuthorizations);

            return models;
        }
        public _DropdownlistLinkedModel GetDropdownlistLink(int userId, int projectId)
        {
            _DropdownlistLinkedModel model = new _DropdownlistLinkedModel();

            Project project = session.Load<Project>(projectId);
            IList<Project> projects = session.Load<User>(userId).RootProjects;

            model.LinkedProject = new LinkedList<_DropdownlistLinkedNodeModel>();

            model.LinkedProject.FilledByTail(project);

            IList<LiteItemModel> headProjects = new List<LiteItemModel>();
            headProjects.FilledBy(projects);
            model.LinkedProject.First.Value.Projects = headProjects;

            model.TailSelectedProject = model.LinkedProject.Last.Value.CurrentProject;
            model.SelectedProjectHasChild = !project.Children.IsNullOrEmpty();

            return model;
        }
Example #4
0
        private IList<UserModel> fill(IEnumerable<User> users)
        {
            IList<UserModel> models = new List<UserModel>();
            models.FilledBy(users.ToList());

            return models;
        }
        private IList<UserModel> getCommunicators(int? userId, MessageFor direction)
        {
            IList<UserModel> models = new List<UserModel>();

            IList<User> users = getRawCommunicators(userId, direction);
            models.FilledBy(users);

            return models;
        }
        private IList<_LiteralLinkedModel> getProjects(int? userId, MessageFor direction)
        {
            IList<_LiteralLinkedModel> models = new List<_LiteralLinkedModel>();

            var messages = _querySource.CanShow(direction); ;
            if (direction == MessageFor.Addresser)
            {
                messages = messages.From(userId);
            }
            else if (direction == MessageFor.Addressee)
            {
                messages = messages.To(userId);
            }
            var projects = messages
                .Select(m => m.Project)
                .Distinct()
                .ToList();

            models.FilledBy(projects);

            return models;
        }