public static void CancelInfoAlert()
 {
     if (InfoMessageDisplaying)
     {
         PageFunctions.HideMessage();
     }
 }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
                canEdit  = (pageMode != PageFunctions.View && Globals.MyPermissions.Allow("EditActions"));
                staffID  = Int32.Parse(PageFunctions.pageParameter(this, "StaffID"));
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            setUpHeaderStyles();
            ProjectButton.Margin = CommitButton.Margin;
            refreshClientCombo();
            refreshStatusCombo();
            FromDate.SelectedDate = fromDate = Globals.StartOfTime;
            ToDate.SelectedDate   = toDate = Globals.OneMonthAhead;
            setCompletedLists();
            if (staffID > 0)
            {
                chooseCombinedStaffMember(staffID);
            }

            pageLoaded = true;
            refreshActionsGrid();
            ProjectFunctions.ActionsChanged += actionsAmended;
            PageFunctions.ShowFavouriteButton();
        }
Beispiel #3
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode          = PageFunctions.pageParameter(this, "Mode");
                selectedProductID = Int32.Parse(PageFunctions.pageParameter(this, "ProductID"));
                refreshProductCombo(true);
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ClientFunctions.ReturnToTilesPage();
            }

            if (pageMode == PageFunctions.View)
            {
                ClientButton.Visibility = Visibility.Hidden;
                Instructions.Content    = "Select a client and click 'Products', or select a product to see its clients.";
            }
            else
            {
                Instructions.Content = activeInstructions;
            }

            CommitButton.Visibility = Visibility.Hidden;
            ClientFrom.Visibility   = ClientTo.Visibility = Visibility.Hidden;
            ClientLabel.Margin      = NameContainsLabel.Margin;
            ClientCombo.Margin      = NameContains.Margin;
            if (!Globals.MyPermissions.Allow("ActivateClientProducts"))
            {
                DisableButton.IsEnabled = false;
                DisableButton.ToolTip   = "Your current permissions do not allow activating or disabling client products";
            }

            if (Globals.SelectedClient != null) // Opened from the Clients Page or Project Products
            {
                fromSource            = Globals.ClientSourcePage;
                ClientCombo.IsEnabled = false; // Cannot easily recreate the same selection list
                refreshClientDataGrid();       // Ensure the record we want is listed, though
                viewProductsByClient();
            }
            else if (selectedProductID > 0) // Opened from Project Products
            {
                fromSource             = Globals.ClientSourcePage;
                ProductCombo.IsEnabled = false; // Cannot easily recreate the same selection list
                refreshClientDataGrid();        // Ensure the record we want is listed, though
                viewClientsByProduct();
            }
            else
            {
                fromSource             = Globals.TilesPageName;
                ClientLabel.Visibility = ClientCombo.Visibility = Visibility.Hidden;
                BackButton.Visibility  = Visibility.Hidden;
                ProductFrom.Visibility = ProductTo.Visibility = Visibility.Hidden;

                AddButton.Visibility    = RemoveButton.Visibility = Visibility.Hidden;
                VersionLabel.Visibility = Version.Visibility = DisableButton.Visibility = Visibility.Hidden;
                FromLabel.Visibility    = ToLabel.Visibility = Visibility.Hidden;
            }
        }
Beispiel #4
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode  = PageFunctions.pageParameter(this, "Mode");
                projectID = Int32.Parse(PageFunctions.pageParameter(this, "ProjectID"));
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }
            if (pageMode == PageFunctions.View)
            {
                viewOnly = true;
                CommitButton.Visibility = NextButton.Visibility = Visibility.Hidden;
                StageCombo.IsEnabled    = false;
            }

            PageHeader.Content = "Project Timeline for Project " + ProjectFunctions.GetProject(projectID).ProjectCode;
            createControlArrays();
            refreshStageCombo();
            setTimelineType(Globals.SelectedTimelineType);
            refreshTimeData();
            MessageFunctions.InfoAlert("Effective date is the actual date for previous stages, and the target date for future ones. If targets are out of date, this can mean that "
                                       + "future stages show an earlier (target) date than historic ones.", "Please note");
        }
Beispiel #5
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            if (pageMode == PageFunctions.View)
            {
                CommitButton.Visibility   = Visibility.Hidden;
                AmendmentsGrid.Visibility = AmendButton.Visibility = AddButton.Visibility = BackButton.Visibility = Visibility.Hidden;
            }
            else if (pageMode == PageFunctions.New)
            {
                additionMode();
                AmendButton.Visibility = AddButton.Visibility = BackButton.Visibility = Visibility.Hidden;
                PageHeader.Content     = "Create New Product";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon");
            }
            else if (pageMode == PageFunctions.Amend)
            {
                ProductGrid.SelectionMode = DataGridSelectionMode.Single;
                PageHeader.Content        = allowAdd? "Amend (or Create) Products" : "Amend Products";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AmendIcon");
                amendmentSetup();
            }

            refreshProductGrid();
        }
Beispiel #6
0
 public static void UpdateCurrentEntity(ref Entities targetEntity)
 {
     CurrentEntity     = targetEntity;
     CurrentEntityID   = CurrentEntity.ID;
     CurrentEntityName = CurrentEntity.EntityName;
     PageFunctions.UpdateDetailsBlock();
 }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
                Globals.ProjectSourceMode = pageMode;
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            refreshClientCombo();
            refreshStatusCombo();
            refreshStageCombo();
            setTimelineType(Globals.SelectedTimelineType);
            FromDate.SelectedDate = Globals.SelectedFromDate;
            ToDate.SelectedDate   = Globals.SelectedToDate;
            PageFunctions.ShowFavouriteButton();
            if (pageMode == PageFunctions.View)
            {
                AmendImage.SetResourceReference(Image.SourceProperty, "ViewIcon");
                Instructions.Content += " Click 'Details' to see a project's full timeline.";
            }
            else
            {
                Instructions.Content += " Click 'Details' to amend a project's timeline.";
            }

            pageLoaded = true;
            refreshHistoryDataGrid();
            Globals.ProjectSourcePage = "StageHistoryPage";
        }
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         pageMode      = PageFunctions.pageParameter(this, "Mode");
         staffIDString = PageFunctions.pageParameter(this, "StaffID");
     }
     catch (Exception generalException)
     {
         MessageFunctions.Error("Error retrieving query details", generalException);
         PageFunctions.ShowTilesPage();
     }
     canEditTeams = (pageMode != PageFunctions.View && Globals.MyPermissions.Allow("EditProjectTeams"));
     PageFunctions.ShowFavouriteButton();
     toggleEditMode(false);
     refreshStatusCombo();
     refreshRoleFilterCombo();
     setTeamTimeRadio();
     Int32.TryParse(staffIDString, out staffID);
     if (staffID > 0)
     {
         chooseStaffName(staffID);
     }
     this.DataContext = editTeamRecord;
     toggleBackButton();
     MessageFunctions.InfoAlert("Current key roles are bold. Future roles are blue, and past ones are grey; otherwise, Live (open) projects are green.", "Grid formatting:");
 }
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     if (StaffFunctions.IgnoreAnyChanges())
     {
         StaffFunctions.ClearAnyChanges();
         PageFunctions.ShowTilesPage();
     }
 }
Beispiel #10
0
        public static void UpdateMyDefaultEntity(ref Entities targetEntity)
        {
            Entities defaultEntity = targetEntity;

            MyDefaultEntityID   = targetEntity.ID;
            MyDefaultEntityName = targetEntity.EntityName;
            PageFunctions.UpdateDetailsBlock();
        }
Beispiel #11
0
 private void BackButton_Click(object sender, RoutedEventArgs e)
 {
     if (Globals.ProductSourcePage == "ProjectProductsPage")
     {
         PageFunctions.ShowProjectProductsPage();
     }
     Globals.ResetProductParameters();
 }
 public static void CompleteLogIn()
 {
     MessageFunctions.CancelInfoAlert();
     PageFunctions.MenuSecurity();
     Globals.FavouriteProjectID = StaffFunctions.MainProjectID(MyStaffID);
     PageFunctions.ToggleMainMenus(true);
     PageFunctions.ShowTilesPage();
 }
Beispiel #13
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            FirstName.Focus();
            if (!Globals.MyPermissions.Allow("ActivateClientStaff"))
            {
                ActiveCheckBox.IsEnabled = false;
                ActiveCheckBox.ToolTip   = ActiveLabel.ToolTip = "Your current permissions do not allow activating or disabling contacts";
            }
            try
            {
                pageMode          = PageFunctions.pageParameter(this, "Mode");
                selectedContactID = Int32.Parse(PageFunctions.pageParameter(this, "ContactID"));
                //selectedClientID = Int32.Parse(PageFunctions.pageParameter(this, "ClientID"));
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ClientFunctions.ReturnToTilesPage();
            }

            //Clients thisClient = ClientFunctions.GetClientByID(selectedClientID, true);
            ClientCode.Text = Globals.SelectedClient.ClientCode;
            ClientName.Text = Globals.SelectedClient.ClientName;

            if (pageMode == PageFunctions.New)
            {
                PageHeader.Content = "Create New Contact";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon");
                Instructions.Content = "Fill in the details as required and then click 'Save' to create the record.";
            }
            else if (pageMode == PageFunctions.Amend)
            {
                if (selectedContactID > 0)
                {
                    try
                    {
                        thisContact              = ClientFunctions.GetContact(selectedContactID);
                        FirstName.Text           = thisContact.FirstName;
                        Surname.Text             = thisContact.Surname;
                        JobTitle.Text            = thisContact.JobTitle;
                        ActiveCheckBox.IsChecked = thisContact.Active;
                        PhoneNumber.Text         = thisContact.PhoneNumber;
                        Email.Text = thisContact.Email;
                    }

                    catch (Exception generalException)
                    {
                        MessageFunctions.Error("Error populating contact data", generalException);
                        ClientFunctions.ReturnToContactPage(selectedContactID);
                    }
                }
                else
                {
                    MessageFunctions.Error("Load error: no contact loaded.", null);
                    ClientFunctions.ReturnToContactPage(selectedContactID);
                }
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode        = PageFunctions.pageParameter(this, "Mode");
                sourceMode      = PageFunctions.pageParameter(this, "SourceMode");
                selectedStaffID = Int32.Parse(PageFunctions.pageParameter(this, "StaffID"));
                refreshEntityCombo(true);
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            CommitButton.Visibility = Visibility.Hidden;
            StaffFrom.Visibility    = StaffTo.Visibility = Visibility.Hidden;
            StaffLabel.Margin       = NameContainsLabel.Margin;
            StaffCombo.Margin       = NameContains.Margin;

            if (selectedStaffID > 0) // Opened from the Staff Page
            {
                fromSource = "StaffPage";
                Globals.SelectedStaffMember = StaffFunctions.GetStaffMember(selectedStaffID);
                StaffCombo.IsEnabled        = false; // Cannot easily recreate the same selection list
                viewEntitiesByStaffMember();

                if (pageMode == PageFunctions.View)
                {
                    Instructions.Content = "Note that only Entities you can access yourself are displayed.";
                }
                else
                {
                    Instructions.Content = "Select the Entities this user should have, then click 'Save'. You can then choose other staff from the list.";
                }
            }
            else
            {
                fromSource              = Globals.TilesPageName;
                StaffLabel.Visibility   = StaffCombo.Visibility = Visibility.Hidden;
                BackButton.Visibility   = Visibility.Hidden;
                EntitiesFrom.Visibility = EntitiesTo.Visibility = Visibility.Hidden;

                AddButton.Visibility = DefaultButton.Visibility = RemoveButton.Visibility = Visibility.Hidden;
                FromLabel.Visibility = ToLabel.Visibility = Visibility.Hidden;

                if (pageMode == PageFunctions.View)
                {
                    StaffButton.Visibility = Visibility.Hidden;
                    //EntitiesButtonText.Text = "View Entities";
                    Instructions.Content = "Select a staff member and click 'Entities', or select an Entity to see its assigned staff.";
                }
                else
                {
                    Instructions.Content = defaultInstructions;
                }
            }
        }
 private void Main_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         HideMessage();
         subscribeToDelegates();
         PageFunctions.ShowLoginPage(PageFunctions.LogIn);
     }
     catch (Exception generalException) { MessageFunctions.Error("Error loading page", generalException); }
 }
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     if (pageMode == PageFunctions.Lookup)
     {
         StaffFunctions.CancelTeamStaffSelection();
     }
     else
     {
         PageFunctions.ShowTilesPage();
     }
 }
Beispiel #17
0
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     if (Globals.MyStaffID > 0)
     {
         PageFunctions.ShowTilesPage();
     }
     else
     {
         PageFunctions.CloseApplication();
     }                                          // not yet logged in, so close application
 }
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     if (editing && changesMade)
     {
         checkIgnoreChanges();
     }
     else
     {
         PageFunctions.ShowTilesPage();
     }
 }
        // ---------------------- //
        // -- Event Management -- //
        // ---------------------- //

        // Generic (shared) control events //
        //private void requestNavigation(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        //{
        //    Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
        //    e.Handled = true;
        //}

        //private void requestEmail(object sender, RoutedEventArgs e)
        //{
        //    Uri mailUri = new Uri("mailto:[email protected]");
        //    Process.Start(new ProcessStartInfo(mailUri.AbsoluteUri));
        //    e.Handled = true;
        //}

        // Control-specific events //
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            if (Globals.MyStaffID > 0)
            {
                PageFunctions.ShowTilesPage();
            }
            else
            {
                PageFunctions.ShowLoginPage(PageFunctions.LogIn);
            }
        }
 private void setUpAmendMode()
 {
     thisProjectProxy    = Globals.SelectedProjectProxy;
     originalManagerID   = thisProjectProxy.ProjectManager.ID;
     originalStageNumber = thisProjectProxy.StageNumber;
     displaySelectedType();
     displaySelectedStage();
     refreshManagerCombo(false);
     refreshClientCombo();
     PageFunctions.ShowFavouriteButton();
     ProjectFunctions.ToggleFavouriteButton(true);
 }
 private void BackButton_Click(object sender, RoutedEventArgs e)
 {
     if (Globals.ClientSourcePage == "ClientPage")
     {
         PageFunctions.ShowClientPage(pageMode = Globals.ClientSourceMode);
     }
     else
     {
         clientMode();
         //refreshClientGrid(); // Required to process a change of selected client in the drop-down, as doesn't happen automatically
     }
 }
 private void ProjectButton_Click(object sender, RoutedEventArgs e)
 {
     int[] allowedEntities = EntityFunctions.AllowedEntityIDs(selectedStaffID);
     if (!allowedEntities.Contains(Globals.CurrentEntityID))
     {
         MessageFunctions.InvalidMessage("This staff member does not have access to this Entity, so they cannot have any projects in it.", "Invalid Entity");
         return;
     }
     else
     {
         PageFunctions.ShowProjectTeamsPage(pageMode, selectedStaffID, "StaffPage");
     }
 }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode          = PageFunctions.pageParameter(this, "Mode");
                selectedProductID = Int32.Parse(PageFunctions.pageParameter(this, "ProductID"));
                refreshProductCombo(true);
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ProjectFunctions.ReturnToTilesPage();
            }


            if (pageMode == PageFunctions.View)
            {
                ProjectButton.Visibility = Visibility.Hidden;
                Instructions.Content     = "Select a project and click 'Products', or select a product to see its projects.";
            }
            else
            {
                Instructions.Content = activeInstructions;
            }

            CommitButton.Visibility = Visibility.Hidden;
            ProjectFrom.Visibility  = ProjectTo.Visibility = Visibility.Hidden;
            ProjectLabel.Margin     = NameContainsLabel.Margin;
            ProjectCombo.Margin     = NameContains.Margin;

            if (Globals.SelectedProjectProxy != null && Globals.SelectedProjectProxy.ProjectID > 0) // Opened from another page
            {
                fromSource             = ProjectFunctions.ProjectSourcePage;
                ProjectCombo.IsEnabled = false; // Cannot easily recreate the same selection list
                refreshProjectDataGrid();       // Ensure the record we want is listed, though
                viewProductsByProject();
                ActiveOnlyCheckBox.IsChecked = (Globals.SelectedProjectProxy.StageNumber < Globals.LiveStage);
            }
            else
            {
                ActiveOnlyCheckBox.IsChecked = true;
                fromSource = Globals.TilesPageName;
                ProjectLabel.Visibility = ProjectCombo.Visibility = Visibility.Hidden;
                BackButton.Visibility   = Visibility.Hidden;
                ProductFrom.Visibility  = ProductTo.Visibility = Visibility.Hidden;

                AddButton.Visibility       = RemoveButton.Visibility = ClientProductButton.Visibility = Visibility.Hidden;
                OldVersionLabel.Visibility = OldVersion.Visibility = NewVersionLabel.Visibility = NewVersion.Visibility = Visibility.Hidden;
                FromLabel.Visibility       = ToLabel.Visibility = Visibility.Hidden;
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                closeDetailsPage(false, false);
            }

            if (pageMode == PageFunctions.View)
            {
                setUpViewMode();
            }
            else // Amend or new
            {
                if (!Globals.MyPermissions.Allow("ActivateProjects"))
                {
                    StageCombo.IsEnabled = NextButton.IsEnabled = false;
                    StageCombo.ToolTip   = NextButton.ToolTip = "Your current permissions do not allow updating the project stage";
                }
                try
                {
                    ProjectFunctions.SetFullTypeList();
                    TypeCombo.ItemsSource = ProjectFunctions.FullTypeList;
                    ProjectFunctions.SetFullStageList();
                    StageCombo.ItemsSource = ProjectFunctions.FullStageList;
                }
                catch (Exception generalException) { MessageFunctions.Error("Error populating drop-down lists", generalException); }

                if (pageMode == PageFunctions.New)
                {
                    setUpNewMode();
                }
                else if (pageMode == PageFunctions.Amend && Globals.SelectedProjectProxy != null)  // Just to be sure
                {
                    setUpAmendMode();
                }
                else
                {
                    MessageFunctions.Error("Error: no project selected.", null);
                    closeDetailsPage(false, false);
                }
            }

            this.DataContext = thisProjectProxy;
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode         = PageFunctions.pageParameter(this, "Mode");
                initialContactID = Int32.Parse(PageFunctions.pageParameter(this, "ContactID"));
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ClientFunctions.ReturnToTilesPage();
            }

            try
            {
                originalInstructions = Instructions.Content.ToString();
                if (pageMode == PageFunctions.View || pageMode == PageFunctions.Lookup)
                {
                    canAmend = canAdd = canActivate = false;
                    CommitButton.Visibility = (pageMode == PageFunctions.Lookup)? Visibility.Visible : Visibility.Hidden;
                    CommitButton.Margin     = AddButton.Margin;
                    ClientCombo.IsEnabled   = (pageMode == PageFunctions.Lookup);
                }
                else
                {
                    canAmend                = myPermissions.Allow("EditClientStaff");
                    canAdd                  = myPermissions.Allow("AddClientStaff");
                    canActivate             = myPermissions.Allow("ActivateClientStaff");
                    originalInstructions    = originalInstructions.Replace("View", "View or Amend");
                    CommitButton.Visibility = Visibility.Hidden;
                }

                if (Globals.SelectedClient != null)
                {
                    contactMode();
                }
                else
                {
                    EntityWarningLabel.Content = ClientFunctions.ShortEntityWarning;
                    clientMode();
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error setting up the client contacts page", generalException);
                ClientFunctions.ReturnToTilesPage();
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode        = PageFunctions.pageParameter(this, "Mode");
                selectedStaffID = Int32.Parse(PageFunctions.pageParameter(this, "StaffID"));
                refreshRoleCombo(); // This also runs LoadOrRefreshData to populate the main staff data grid
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            if (pageMode == PageFunctions.View)
            {
                AmendButton.Visibility    = CommitButton.Visibility = Visibility.Hidden;
                DisableButton.Visibility  = Visibility.Hidden;
                editEntities              = false; // Override as it is a view-only screen
                EntitiesButton.Visibility = (viewEntities) ? Visibility.Visible : Visibility.Hidden;
                ProjectButton.Visibility  = (viewProjects) ? Visibility.Visible : Visibility.Hidden;
            }
            else if (pageMode == PageFunctions.Amend)
            {
                PageHeader.Content = "Amend Staff Details";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AmendIcon");
                Instructions.Content        = "Choose a staff member and then click the 'Amend' button to change their details.";
                StaffDataGrid.SelectionMode = DataGridSelectionMode.Single;
                DisableButton.Visibility    = Globals.MyPermissions.Allow("ActivateStaff") ? Visibility.Visible : Visibility.Hidden;
                CommitButton.Visibility     = Visibility.Hidden;
                EntitiesButton.Visibility   = (viewEntities || editEntities) ? Visibility.Visible : Visibility.Hidden;
                //if (editEntities) { EntitiesButtonText.Text = "Entities"; }
                ProjectButton.Visibility = (viewProjects || editProjects) ? Visibility.Visible : Visibility.Hidden;
            }
            else if (pageMode == PageFunctions.Lookup)
            {
                CommitButton.Margin = AmendButton.Margin;
                PageHeader.Content  = "Select Staff Member";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "SearchIcon");
                Instructions.Content         = "Choose a staff member and then click the 'Select' button to return their details.";
                StaffDataGrid.SelectionMode  = DataGridSelectionMode.Single;
                DisableButton.Visibility     = AmendButton.Visibility = EntitiesButton.Visibility = ProjectButton.Visibility = Visibility.Hidden;
                CancelButtonText.Text        = "Cancel";
                ActiveOnlyCheckBox.IsChecked = true;
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            if (pageMode == PageFunctions.Amend)
            {
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AmendIcon");
            }
        }
        // --------- 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); }
            }
        }
 private void BackButton_Click(object sender, RoutedEventArgs e)
 {
     if (ProjectFunctions.IgnoreAnyChanges())
     {
         clearChanges();
         if (backSource == "ProjectPage")
         {
             PageFunctions.ShowProjectPage(pageMode = Globals.ProjectSourceMode);
         }
         else
         {
             refreshProductCombo(true);
             //refreshProjectDataGrid();
             toggleSelectionControls(true);
             PageHeader.Content     = activePageHeader;
             ProjectCombo.IsEnabled = true;
         }
     }
 }
Beispiel #30
0
 public static void SwitchEntity(ref Entities selectedEntity, bool makeDefault = false)
 {
     if (selectedEntity == null)
     {
         MessageFunctions.InvalidMessage("Please select an Entity from the drop-down list.", "No Entity Selected");
         return;
     }
     try
     {
         UpdateCurrentEntity(ref selectedEntity);
         if (makeDefault)
         {
             SetDefaultEntity(ref selectedEntity);
             MessageFunctions.SuccessAlert("Your default Entity has now been set to '" + selectedEntity.EntityName + "'.", "Default Entity Changed");
         }
         PageFunctions.ShowTilesPage();
     }
     catch (Exception generalException) { MessageFunctions.Error("Error changing current Entity", generalException); }
 }