Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            mm            = (MinMaster)Master;
            projectsTable = mm.SysDriver.GetProjects();


            ProjectsGrid.DataSource = projectsTable;
            ProjectsGrid.DataBind();
        }
Пример #2
0
        //*********************************************************************
        //
        // The BindProjects method retrieves the list of projects the current user
        // can view based on their role and then databinds them to the ProjectsGrid
        //
        //*********************************************************************

        private void BindProjects()
        {
            ProjectCollection projectList = Project.GetAllProjects();

            // Call method to sort the data before databinding
            SortGridData(projectList, SortField, SortAscending);

            ProjectsGrid.DataSource = projectList;
            ProjectsGrid.DataBind();
        }
Пример #3
0
        private void LoadProjects()
        {
            IQueryable <Project> projects = null;

            if (UserManager.IsInRole(LoggedInUserId, "Admin"))
            {
                projects = DatabaseContext.Projects.AsQueryable();
            }
            else if (UserManager.IsInRole(LoggedInUserId, "Professor"))
            {
                projects = DatabaseContext.Projects.Where(p => p.Reviewer == LoggedInUserId);
            }
            else if (UserManager.IsInRole(LoggedInUserId, "Student"))
            {
                projects = DatabaseContext.Projects.Where(p => p.Author == LoggedInUserId);
            }
            if (projects != null)
            {
                projects = projects.OrderBy(p => p.DateUploaded);
                ProjectsGrid.DataSource = projects.ToArray();
                ProjectsGrid.DataBind();
            }
            LoadProject(null);
        }