Exemple #1
0
        // -------------- Data updates -------------- //

        private void updateProjectStage(int newStageNumber, bool alreadyUpdated)
        {
            try
            {
                if (newStageNumber != currentStageNumber) // Allows looping round again if undoing the change
                {
                    bool confirm = MessageFunctions.ConfirmOKCancel("This will update the start dates of any future-dated stages that are now complete or in progress. Are you sure? "
                                                                    + "If the results are not as expected, use the 'Back' or 'Close' button afterwards to undo all changes.");
                    if (!confirm)
                    {
                        if (alreadyUpdated)
                        {
                            currentTimeline.Stage = ProjectFunctions.GetStageByNumber(currentStageNumber);
                        }
                        return;
                    }
                    currentStageNumber = newStageNumber;
                    if (!alreadyUpdated)
                    {
                        currentTimeline.Stage = ProjectFunctions.GetStageByNumber(newStageNumber);
                        displaySelectedStage();
                    }
                    stageChanged = true;
                    updateAffectedDates();
                    formatDatePickers();
                    NextButton.IsEnabled   = (!ProjectFunctions.IsLastStage(newStageNumber));
                    CommitButton.IsEnabled = true;
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error updating current project stage", generalException); }
        }
        private void CommitButton_Click(object sender, RoutedEventArgs e)
        {
            bool confirm = MessageFunctions.ConfirmOKCancel("Are you sure you wish to save your amendments?", "Save changes?");

            if (!confirm)
            {
                return;
            }
            bool success = (editMode == ByProject) ? ProjectFunctions.SaveProjectProductChanges(Globals.SelectedProjectProxy.ProjectID) : ProjectFunctions.SaveProductProjectChanges(selectedProductID);

            if (success)
            {
                MessageFunctions.SuccessAlert("Your changes have been saved successfully. You can make further changes, go back to the previous screen, or close the current page.", "Changes Saved");
                CommitButton.IsEnabled = false;
            }
        }
 // Other/shared functions //
 public bool ConfirmClosure()
 {
     try
     {
         string thisPage = PageFunctions.ThisPageName();
         string question = "Are you sure you want to exit?";
         if (thisPage != Globals.TilesPageName && thisPage != "LoginPage")
         {
             question = question + " Any unsaved changes you have made would be lost.";
             return(MessageFunctions.WarningYesNo(question, "Close ProjectTile Application?"));
         }
         else
         {
             return(MessageFunctions.ConfirmOKCancel(question, "Close ProjectTile Application?"));
         }
     }
     catch
     {
         // Do nothing as it's not worth raising an error when the user wants to leave
         return(true);
     }
 }