コード例 #1
0
        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); }
        }
コード例 #2
0
 private void clearSelection()
 {
     selectedGridRecord = null;
     // selectedProjectID = 0; // Don't clear this automatically, as the refresh tries to reuse it
     Globals.SelectedProjectProxy = null; // Ditto
     ProductButton.IsEnabled      = false;
 }
コード例 #3
0
        // ---------------------- //
        // -- 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); }
        }
コード例 #4
0
        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); }
        }
コード例 #5
0
 private void ProjectCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (ProjectCombo.SelectedItem == null)
     {
     }                                          // Do nothing - won't be for long
     else
     {
         try
         {
             ProjectProxy selectedProject = (ProjectProxy)ProjectCombo.SelectedItem;
             if (selectedProject == Globals.SearchProjects)
             {
                 OpenProjectLookup();
             }
             else
             {
                 Globals.SelectedProjectProxy = selectedProject;
                 setCurrentClient(null, selectedProject.Client ?? null);
                 refreshTeamDataGrid();
                 toggleProjectMode(selectedProject != Globals.AllProjects);
             }
         }
         catch (Exception generalException) { MessageFunctions.Error("Error processing project selection", generalException); }
     }
 }
コード例 #6
0
 private void refreshProjectCombo()
 {
     try
     {
         ProjectProxy currentRecord = (Globals.SelectedProjectProxy != null) ? Globals.SelectedProjectProxy : Globals.DefaultProjectProxy;
         ProjectFunctions.SetProjectFilterList(Globals.SelectedStatusFilter, true);
         ProjectCombo.ItemsSource = ProjectFunctions.ProjectFilterList;
         selectProject(currentRecord.ProjectID);
     }
     catch (Exception generalException) { MessageFunctions.Error("Error populating projects drop-down list", generalException); }
 }
コード例 #7
0
 private void setUpAmendMode()
 {
     thisProjectProxy    = Globals.SelectedProjectProxy;
     originalManagerID   = thisProjectProxy.ProjectManager.ID;
     originalStageNumber = thisProjectProxy.StageNumber;
     displaySelectedType();
     displaySelectedStage();
     refreshManagerCombo(false);
     refreshClientCombo();
     PageFunctions.ShowFavouriteButton();
     ProjectFunctions.ToggleFavouriteButton(true);
 }
コード例 #8
0
 private void ProjectCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (ProjectFunctions.IgnoreAnyChanges())
     {
         clearChanges();
         if (ProjectCombo.SelectedItem != null)
         {
             selectedGridRecord           = (ProjectProxy)ProjectCombo.SelectedItem;
             Globals.SelectedProjectProxy = selectedGridRecord;
             refreshProductSummaries(true);
             setLabels();
             toggleClientProductButton();
         }
     }
 }
コード例 #9
0
        // --------- Other/shared functions --------- //

        private void setUpViewMode()
        {
            try
            {
                ClientCombo.IsReadOnly  = ProjectName.IsReadOnly = TypeCombo.IsReadOnly = true;
                ManagerCombo.IsReadOnly = StageCombo.IsReadOnly = ProjectSummary.IsReadOnly = true;
                StartDate.IsEnabled     = false; // This cannot be read-only so an inner style trigger makes it appear read-only
                ProjectCode.IsEnabled   = true;
                ProjectCode.IsReadOnly  = true;
                CommitButton.Visibility = NextButton.Visibility = NonPMsCheckBox.Visibility = SearchButton.Visibility = Visibility.Hidden;
                CancelButtonText.Text   = "Close";
                PageHeader.Content      = "View Project Details";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "ViewIcon");
                Instructions.Content = "This page is read-only; values can be selected but not changed.";
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error displaying project details", generalException);
                closeDetailsPage(false, false);
            }

            if (Globals.SelectedProjectProxy != null) // Just to be sure (for view mode)
            {
                try
                {
                    thisProjectProxy = Globals.SelectedProjectProxy;
                    TypeCombo.Items.Add(thisProjectProxy.Type);
                    StageCombo.Items.Add(thisProjectProxy.Stage);
                    ManagerCombo.Items.Add(thisProjectProxy.ProjectManager);
                    if (thisProjectProxy.Client != null && thisProjectProxy.Client.ID > 0)
                    {
                        ClientCombo.Items.Add(thisProjectProxy.Client);
                    }
                    else
                    {
                        ClientCombo.Items.Add(Globals.NoClient);
                        ClientCombo.SelectedIndex = 0;
                    }
                    PageFunctions.ShowFavouriteButton();
                    ProjectFunctions.ToggleFavouriteButton(true);
                }
                catch (Exception generalException) { MessageFunctions.Error("Error setting current project details", generalException); }
            }
        }
コード例 #10
0
 private void setUpNewMode()
 {
     thisProjectProxy          = new ProjectProxy();
     thisProjectProxy.EntityID = Globals.CurrentEntityID;
     PageHeader.Content        = "Create New Project";
     HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon");
     Instructions.Content = "Fill in the details as required and then click 'Save' to create the record.";
     if (fromProjectPage)
     {
         bool usedFilters = ProjectFunctions.PopulateFromFilters(ref thisProjectProxy);
     }
     else
     {
         BackButton.Visibility = Visibility.Hidden;
     }
     refreshManagerCombo(false);
     refreshClientCombo();
     updateProjectStage(0);
 }
コード例 #11
0
ファイル: Globals.cs プロジェクト: thehipnotist/ProjectTile
        public static void ResetProjectParameters()
        {
            SelectedClientProxy  = DefaultClientProxy;
            SelectedPMProxy      = DefaultPMProxy;
            SelectedStatusFilter = DefaultStatusFilter;
            SelectedProjectProxy = DefaultProjectProxy;
            SelectedProjectRole  = DefaultProjectRole;
            SelectedClientRole   = DefaultClientRole;

            ProjectSourcePage = TilesPageName;
            ProjectSourceMode = PageFunctions.None;

            SelectedTeamTimeFilter = DefaultTeamTimeFilter;
            SelectedStage          = DefaultStage;
            SelectedTimelineType   = DefaultTimelineType;
            SelectedFromDate       = DefaultFromDate;
            SelectedToDate         = DefaultToDate;
            SelectedHistory        = null;
        }
コード例 #12
0
 private void ProjectDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (ProjectDataGrid.SelectedItem != null)
         {
             selectedGridRecord           = (ProjectProxy)ProjectDataGrid.SelectedItem;
             Globals.SelectedProjectProxy = selectedGridRecord;
             ProductButton.IsEnabled      = true;
         }
         else // No record selected, e.g. because filter changed
         {
             clearSelection();
         }
     }
     catch (Exception generalException)
     {
         MessageFunctions.Error("Error processing selection change", generalException);
         Globals.SelectedProjectProxy = null; // Avoid accidentally using the previous selection
         clearSelection();
     }
 }
コード例 #13
0
        // ---------------------- //
        // -- Event Management -- //
        // ---------------------- //

        // Generic (shared) control events //

        // Control-specific events //

        private void ProjectDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (ProjectDataGrid.SelectedItem == null)
                {
                    selectedProject = null;
                    toggleProjectButtons(false);
                    ProjectFunctions.ToggleFavouriteButton(false);
                }
                else
                {
                    selectedProject = (ProjectProxy)ProjectDataGrid.SelectedItem;
                    toggleProjectButtons(true);
                }
                if (pageMode != PageFunctions.Lookup) // Otherwise don't set this as may cancel selection later
                {
                    Globals.SelectedProjectProxy = selectedProject;
                    ProjectFunctions.ToggleFavouriteButton(selectedProject != null);
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error displaying project selection", generalException); }
        }