protected void Page_Load(object sender, EventArgs e) { mm = (MinMaster)Master; projectsTable = mm.SysDriver.GetProjects(); ProjectsGrid.DataSource = projectsTable; ProjectsGrid.DataBind(); }
//********************************************************************* // // 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(); }
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); }