// ---------------------- // // -- Data Management --- // // ---------------------- // // Data updates // private void ensureCurrentRecordDisplayed() { try { ProjectProxy currentRecord = (selectedProject != null && selectedProject.ProjectID > 0) ? selectedProject : null; int clientID = (Globals.SelectedClientProxy != null) ? ProjectFunctions.SelectedClientProxy.ID : 0; int managerID = (Globals.SelectedPMProxy != null) ? ProjectFunctions.SelectedPMProxy.ID : 0; Globals.ProjectStatusFilter statusFilter = Globals.SelectedStatusFilter; if (currentRecord != null) // Reset filters if necessary to show the selected record { if (clientID != 0 && clientID != currentRecord.Client.ID) { Globals.SelectedClientProxy = Globals.AnyClient; } if (managerID != 0 && managerID != currentRecord.ProjectManager.ID) { Globals.SelectedPMProxy = Globals.AllPMs; } if (!ProjectFunctions.IsInFilter(statusFilter, currentRecord.Stage)) { Globals.SelectedStatusFilter = Globals.ProjectStatusFilter.All; } } } catch (Exception generalException) { MessageFunctions.Error("Error displaying the current project record", generalException); } }
private void refreshMainProjectGrid() { try { ProjectProxy currentRecord = (selectedProject != null) ? selectedProject : null; int clientID = (Globals.SelectedClientProxy != null)? ProjectFunctions.SelectedClientProxy.ID : 0; int managerID = (Globals.SelectedPMProxy != null) ? ProjectFunctions.SelectedPMProxy.ID : 0; Globals.ProjectStatusFilter statusFilter = Globals.SelectedStatusFilter; bool success = ProjectFunctions.SetProjectGridList(statusFilter, clientID, managerID); if (success) { ProjectDataGrid.ItemsSource = ProjectFunctions.ProjectGridList; if (currentRecord != null && ProjectFunctions.ProjectGridList.Exists(pgl => pgl.ProjectID == currentRecord.ProjectID)) { ProjectDataGrid.SelectedItem = ProjectFunctions.ProjectGridList.First(pgl => pgl.ProjectID == currentRecord.ProjectID); ProjectDataGrid.ScrollIntoView(ProjectDataGrid.SelectedItem); } else if (ProjectFunctions.ProjectGridList.Count == 1) { ProjectDataGrid.SelectedItem = ProjectFunctions.ProjectGridList.ElementAt(0); } } else { closePage(true); } } catch (Exception generalException) { MessageFunctions.Error("Error populating project grid data", generalException); } }
private void refreshTeamDataGrid() { try { TeamProxy currentRecord = selectedTeamRecord ?? null; ProjectProxy currentProjectProxy = (ProjectCombo.SelectedItem != null) ? (ProjectProxy)ProjectCombo.SelectedItem : Globals.AllProjects; Globals.ProjectStatusFilter statusFilter = Globals.SelectedStatusFilter; string projectRoleCode = Globals.SelectedProjectRole.RoleCode; Globals.TeamTimeFilter timeFilter = Globals.SelectedTeamTimeFilter; bool success = ProjectFunctions.SetTeamsGridList(statusFilter, projectRoleCode, timeFilter, currentProjectProxy.ProjectID, nameLike, exactName); if (success) { TeamDataGrid.ItemsSource = ProjectFunctions.TeamsGridList; if (currentRecord != null && ProjectFunctions.TeamsGridList.Exists(tgl => tgl.ID == currentRecord.ID)) { TeamDataGrid.SelectedItem = ProjectFunctions.TeamsGridList.First(tgl => tgl.ID == currentRecord.ID); } else if (ProjectFunctions.TeamsGridList.Count == 1) { TeamDataGrid.SelectedItem = ProjectFunctions.TeamsGridList.ElementAt(0); } } } catch (Exception generalException) { MessageFunctions.Error("Error populating project team grid data", generalException); } }
private void refreshStatusCombo() { try { Globals.ProjectStatusFilter currentFilter = Globals.SelectedStatusFilter; string currentName = ProjectFunctions.StatusFilterName(currentFilter); if (ProjectFunctions.StatusFilterList == null) { ProjectFunctions.SetProjectStatusFilter(); } StatusCombo.ItemsSource = ProjectFunctions.StatusFilterList; StatusCombo.SelectedItem = currentName; } catch (Exception generalException) { MessageFunctions.Error("Error populating status drop-down list", generalException); } }