/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!Page.IsPostBack) { DataView projectsList = new DataView(); // If filtering by user, determine which project a user belongs if (FilterByUser) { ProjectManagementDa da = new ProjectManagementDa(); string uName = new Caisis.Security.SecurityController().GetUserName(); UserDa uda = new UserDa(); int uId = uda.GetUserId(uName); projectsList = da.GetAllProjectsByUserId(uId).DefaultView; } // Else, user has access to all projects else { //Project biz = new Project(); if (String.IsNullOrEmpty(OrganizationId) || OrganizationId.Equals("-1")) { //biz.GetAll(); //projectsList = biz.DataSourceView; projectsList = BusinessObject.GetAllAsDataView <Project>(); } else { ProjectManagementDa da = new ProjectManagementDa(); projectsList = da.GetAllProjectsForOrg(Int32.Parse(OrganizationId)).DefaultView; } } // Force default sort to earliest records first //projectsList.Sort = Project.ProjectId + " ASC"; // default sort projectsList.Sort = "Title"; // SORTING DISABLED recordCount = projectsList.Count; // Bind projects to user's view BindProjectList(projectsList); } }