private void BuildContacts(int organizationId) { // build contacts ContactsDa da = new ContactsDa(); var contactAndUsers = da.GetAllContactsAndUser(organizationId).DefaultView; contactAndUsers.RowFilter = "OrganizationContactId IS NOT NULL"; ContactsRptr.DataSource = contactAndUsers; ContactsRptr.DataBind(); NoContacsMessage.Visible = contactAndUsers.Count == 0; // build projects ProjectManagementDa projectDa = new ProjectManagementDa(); DataView projects = projectDa.GetAllProjectsForOrg(organizationId).DefaultView; projects.Sort = Project.Title + " ASC"; ProjectsRptr.DataSource = projects; ProjectsRptr.DataBind(); NoProjectsMessage.Visible = projects.Count == 0; // build protocols DataView protocols = ProtocolMgmtDa.GetProtocolsByOrganization(organizationId).DefaultView; protocols.Sort = Protocol.ProtocolNum + " ASC"; ProtocolRptr.DataSource = protocols; ProtocolRptr.DataBind(); NoProtocolsMessage.Visible = protocols.Count == 0; }
private void BuildOrganizationProjects(int organizationId) { ProjectManagementDa da = new ProjectManagementDa(); DataView projectsList = da.GetAllProjectsForOrg(organizationId).DefaultView; OrganizationProjectsRptr.DataSource = projectsList; OrganizationProjectsRptr.DataBind(); }
/// <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); } }