Exemple #1
0
        public DataTablesResult <SubjectListViewModel> GetSubjects(DataTablesParam dataTableParam)
        {
            var searchString = dataTableParam.GetSearchString();
            var subjects     = ApplicationService <ISubjectManagementService>().GetSubjectsLecturer(WebSecurity.CurrentUserId, pageInfo: dataTableParam.ToPageInfo(), searchString: searchString);

            return(DataTableExtensions.GetResults(subjects.Items.Select(_GetSubjectRow), dataTableParam, subjects.TotalCount));
        }
        public DataTablesResult <GroupViewModel> GetCollectionGroups(DataTablesParam dataTableParam)
        {
            var searchString = dataTableParam.GetSearchString();

            ViewBag.EditActionLink   = "/Administration/EditGroup";
            ViewBag.DeleteActionLink = "/Administration/DeleteGroup";
            var groups = GroupManagementService.GetGroupsPageable(pageInfo: dataTableParam.ToPageInfo(), searchString: searchString);

            return(DataTableExtensions.GetResults(groups.Items.Select(g => GroupViewModel.FormGroup(g, PartialViewToString("_EditGlyphLinks", g.Id))), dataTableParam, groups.TotalCount));
        }
        public DataTablesResult <LecturerViewModel> GetCollectionLecturers(DataTablesParam dataTableParam)
        {
            var searchString = dataTableParam.GetSearchString();

            ViewBag.EditActionLink   = "/Administration/EditProfessor";
            ViewBag.DeleteActionLink = "/Administration/DeleteLecturer";
            ViewBag.StatActionLink   = "/Administration/Attendance";
            var lecturers = LecturerManagementService.GetLecturersPageable(pageInfo: dataTableParam.ToPageInfo(), searchString: searchString);

            return(DataTableExtensions.GetResults(lecturers.Items.Select(l => LecturerViewModel.FormLecturers(l, PartialViewToString("_EditGlyphLinks", l.Id))), dataTableParam, lecturers.TotalCount));
        }
        public DataTablesResult <StudentViewModel> GetCollectionStudents(DataTablesParam dataTableParam)
        {
            var searchString = dataTableParam.GetSearchString();

            ViewBag.EditActionLink   = "/Administration/EditStudent";
            ViewBag.DeleteActionLink = "/Administration/DeleteStudent";
            ViewBag.StatActionLink   = "/Administration/Attendance";
            var students = StudentManagementService.GetStudentsPageable(pageInfo: dataTableParam.ToPageInfo(), searchString: searchString);

            return(DataTableExtensions.GetResults(students.Items.Select(s => StudentViewModel.FromStudent(s, PartialViewToString("_EditGlyphLinks", s.Id))), dataTableParam, students.TotalCount));
        }
Exemple #5
0
        public DataTablesResult <ProjectListViewModel> GetProjects(DataTablesParam dataTableParam)
        {
            var searchString = dataTableParam.GetSearchString();
            var projects     = ProjectManagementService.GetProjects(pageInfo: dataTableParam.ToPageInfo(), searchString: searchString);

            if (User.IsInRole("lector"))
            {
                return(DataTableExtensions.GetResults(projects.Items.Select(model => FromProject(model, PartialViewToString("_ProjectsGridActions", FromProject(model)))).Where(e => e.IsAssigned), dataTableParam, projects.TotalCount));
            }

            return(DataTableExtensions.GetResults(projects.Items.Select(FromProject).Where(e => e.IsAssigned), dataTableParam, projects.TotalCount));
        }
Exemple #6
0
        public DataTablesResult <ProjectUserListViewModel> GetProjectUsers(DataTablesParam dataTablesParam)
        {
            var searchString = dataTablesParam.GetSearchString();
            var projectUsers = ProjectManagementService.GetProjectUsers(pageInfo: dataTablesParam.ToPageInfo(),
                                                                        searchString: searchString);
            var projectId = int.Parse(Request.QueryString["projectId"]);

            if (User.IsInRole("lector") && ProjectManagementService.GetProject(projectId).CreatorId == WebSecurity.CurrentUserId)
            {
                return(DataTableExtensions.GetResults(projectUsers.Items.Select(model => FromProjectUser(model, PartialViewToString("_ProjectUsersGridActions", FromProjectUser(model)))).Where(e => e.ProjectId == projectId && e.UserName != GetProjectCreatorName(projectId)), dataTablesParam, projectUsers.TotalCount));
            }

            return(DataTableExtensions.GetResults(projectUsers.Items.Select(FromProjectUser).Where(e => e.ProjectId == projectId && e.UserName != GetProjectCreatorName(projectId)), dataTablesParam, projectUsers.TotalCount));
        }
Exemple #7
0
        public DataTablesResult <BugListViewModel> GetAllBugs(DataTablesParam dataTableParam)
        {
            var searchString = dataTableParam.GetSearchString();
            var bugs         = BugManagementService.GetAllBugs(pageInfo: dataTableParam.ToPageInfo(), searchString: searchString);

            if (User.IsInRole("lector"))
            {
                if (_currentProjectId != 0)
                {
                    return(DataTableExtensions.GetResults(bugs.Items.Select(model => FromBug(model, PartialViewToString("_BugsGridActions", FromBug(model)))).Where(e => e.ProjectId == _currentProjectId), dataTableParam, bugs.TotalCount));
                }

                return(DataTableExtensions.GetResults(bugs.Items.Select(model => FromBug(model, PartialViewToString("_BugsGridActions", FromBug(model)))).Where(e => e.IsAssigned), dataTableParam, bugs.TotalCount));
            }

            if (_currentProjectId != 0)
            {
                return(DataTableExtensions.GetResults(bugs.Items.Select(FromBug).Where(e => e.ProjectId == _currentProjectId), dataTableParam, bugs.TotalCount));
            }

            return(DataTableExtensions.GetResults(bugs.Items.Select(FromBug).Where(e => e.IsAssigned), dataTableParam, bugs.TotalCount));
        }