// Other/shared functions // private void refreshProjectDataGrid() { try { int selectedID = (Globals.SelectedProjectProxy != null) ? Globals.SelectedProjectProxy.ProjectID : 0; projectGridList = ProjectFunctions.ProjectGridListByProduct(activeOnly, nameContains, selectedProductID, Globals.CurrentEntityID); ProjectDataGrid.ItemsSource = projectGridList; ProjectDataGrid.Items.SortDescriptions.Clear(); ProjectDataGrid.Items.SortDescriptions.Add(new SortDescription("ProjectCode", ListSortDirection.Ascending)); if (selectedID > 0) { try { if (projectGridList.Exists(pgl => pgl.ProjectID == selectedID)) { ProjectDataGrid.SelectedItem = projectGridList.First(pgl => pgl.ProjectID == selectedID); ProjectDataGrid.ScrollIntoView(ProjectDataGrid.SelectedItem); } } catch (Exception generalException) { MessageFunctions.Error("Error selecting record", generalException); } } // refreshProjectSummaries(true); } catch (Exception generalException) { MessageFunctions.Error("Error filling project grid", 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); } }