Exemple #1
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");
        }
 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 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";
        }
Exemple #4
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();
        }
Exemple #5
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;
            }
        }
        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();
        }
Exemple #7
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 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");
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            if (pageMode == PageFunctions.Amend)
            {
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AmendIcon");
            }
        }
        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();
            }

            thisDoc.SetResourceReference(FontFamilyProperty, "MainFont");
            thisDoc.FontSize    = 12;
            thisDoc.PagePadding = new Thickness(0, 0, 15, 15);
            MainText.Document   = thisDoc;

            addTileQuestions();
            addActionsQuestions();
            addFunctionalityQuestions();
            addDevelopmentQuestions();
            addYourQuestions();
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
                Globals.ProjectSourceMode = pageMode;
                //Globals.ProjectSourcePage = "ProjectPage"; // Now set in Page Functions beforehand
                if (pageMode == PageFunctions.View || !Globals.MyPermissions.Allow("EditProjects"))
                {
                    viewOnly = true;
                }
                if (pageMode != PageFunctions.Lookup)
                {
                    PageFunctions.ShowFavouriteButton();
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                closePage(true);
            }

            if (pageMode == PageFunctions.View)
            {
                AddButton.Visibility = CommitButton.Visibility = Visibility.Hidden;
                AmendImage.SetResourceReference(Image.SourceProperty, "ViewIcon");
            }
            else if (pageMode == PageFunctions.Amend)
            {
                PageHeader.Content   = "Amend or Manage Projects";
                Instructions.Content = "Use filters to restrict results and column headers to sort them, then choose the required option.";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AmendIcon");
                CommitButton.Visibility = Visibility.Hidden;
                AddButton.Visibility    = Globals.MyPermissions.ShowOrCollapse("AddProjects");
            }
            else if (pageMode == PageFunctions.Lookup)
            {
                PageHeader.Content   = "Select Project";
                Instructions.Content = "Use filters to restrict results and column headers to sort them, then choose the desired project.";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "SearchIcon");
                AddButton.Visibility  = AmendButton.Visibility = BackButton.Visibility = MoreButton.Visibility = Visibility.Hidden;
                CommitButton.Margin   = AmendButton.Margin;
                CancelButtonText.Text = "Cancel";
            }

            try
            {
                BackButton.Visibility = ProjectFunctions.BackButtonVisibility("ProjectPage");
                BackButton.ToolTip    = ProjectFunctions.BackButtonTooltip();
                refreshClientCombo();
                refreshPMsCombo();
                if (ProjectFunctions.PMFilterList.Exists(ssr => ssr.ID == Globals.MyStaffID))
                {
                    PMsCombo.SelectedItem = ProjectFunctions.PMFilterList.First(ssr => ssr.ID == Globals.MyStaffID);
                }
                refreshStatusCombo();
                toggleMoreButton();
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error refreshing filters", generalException);
                closePage(true);
            }
        }
Exemple #16
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
                Globals.ClientSourcePage = "ClientPage";
                Globals.ClientSourceMode = pageMode;
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ClientFunctions.ReturnToTilesPage();
            }

            BackButton.Visibility      = Visibility.Hidden;
            EntityWarningLabel.Content = ClientFunctions.EntityWarning;
            SuggestionTips.Text        = "";

            if (pageMode == PageFunctions.View)
            {
                EditGrid.Visibility       = AddButton.Visibility = AmendButton.Visibility = CopyButton.Visibility = Visibility.Hidden;
                MainClientGrid.Visibility = Visibility.Visible;
                CommitButton.Visibility   = Visibility.Hidden;
                setButtonSecurity();
                refreshMainManagersCombo();
            }
            else if (pageMode == PageFunctions.New)
            {
                //PageHeader.Content = "Create New Client";
                //HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon");
                editMode(null);
                //EntityWarningLabel.Visibility = Visibility.Hidden;
            }
            else if (pageMode == PageFunctions.Amend)
            {
                ClientDataGrid.SelectionMode = DataGridSelectionMode.Single;
                AddButton.Visibility         = myPermissions.Allow("AddClients")? Visibility.Visible : Visibility.Hidden;
                setButtonSecurity();
                resetAmendPage();
                // refreshMainManagersCombo(); // Not required as done by resetAmendPage
            }
            else if (pageMode == PageFunctions.Lookup)
            {
                EditGrid.Visibility          = AddButton.Visibility = AmendButton.Visibility = CopyButton.Visibility = Visibility.Hidden;
                ProductButton.Visibility     = ContactButton.Visibility = ProjectButton.Visibility = Visibility.Hidden;
                ActiveOnlyCheckBox.IsChecked = true;
                ActiveOnlyCheckBox.IsEnabled = false;
                MainClientGrid.Visibility    = Visibility.Visible;
                CommitButton.Visibility      = Visibility.Visible;
                CommitButton.IsEnabled       = false;
                CommitButtonText.Text        = "Select";
                CancelButtonText.Text        = "Cancel";
                refreshMainManagersCombo();
                double width = CentreColumn.ActualWidth - 30;
                ClientDataGrid.Width = width;
                PageHeader.Content   = "Client Lookup";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "LookupIcon");
                Instructions.Content          = "Use the filters to help find the required client record, then select it and click 'Select'.";
                EntityWarningLabel.Visibility = Visibility.Hidden;
            }

            if (!Globals.MyPermissions.Allow("ActivateClients"))
            {
                ActiveCheckBox.IsEnabled = false;
                ActiveCheckBox.ToolTip   = ActiveLabel.ToolTip = "Your current permissions do not allow activating or disabling clients";
            }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                try
                {
                    pageMode = PageFunctions.pageParameter(this, "Mode");
                }
                catch (Exception generalException)
                {
                    MessageFunctions.Error("Error retrieving query details", generalException);
                    PageFunctions.ShowTilesPage();
                }

                if (pageMode == PageFunctions.Switch)
                {
                    PageHeader.Content = "Change Current Entity";
                    HeaderImage2.SetResourceReference(Image.SourceProperty, "ChangeEntityIcon");
                    Instructions.Content        = "Pick an Entity from the list to change to it.";
                    EntityName.Visibility       = Visibility.Hidden;
                    SwitchToCheckBox.Visibility = Visibility.Hidden;
                    EntityDescription.IsEnabled = false;
                    EntityCombo.Margin          = EntityName.Margin;
                    CommitButtonText.Text       = "Change";
                    ChangeNameLabel.Visibility  = Visibility.Hidden;
                    EntityCombo.ItemsSource     = EntityFunctions.EntityList(Globals.MyStaffID, false, Globals.CurrentEntityID);
                    if (EntityCombo.Items.Count == 1)
                    {
                        EntityCombo.SelectedIndex = 0;
                    }
                }
                else if (pageMode == PageFunctions.New)
                {
                    EntityCombo.Visibility     = Visibility.Hidden;
                    ChangeNameLabel.Visibility = Visibility.Hidden;
                }
                else if (pageMode == PageFunctions.Amend)
                {
                    PageHeader.Content = "Amend Existing Entity";
                    HeaderImage2.SetResourceReference(Image.SourceProperty, "AmendIcon");
                    Instructions.Content           = "Pick an Entity from the list to amend it.";
                    SwitchToCheckBox.Visibility    = Visibility.Hidden;
                    MakeDefaultCheckBox.Visibility = Visibility.Hidden;
                    EntityDescription.IsEnabled    = false;

                    Thickness nameMargin = EntityName.Margin;
                    EntityName.Margin       = EntityCombo.Margin;
                    EntityCombo.Margin      = nameMargin;
                    CommitButtonText.Text   = "Amend";
                    EntityCombo.ItemsSource = EntityFunctions.EntityList(Globals.MyStaffID, false);
                }
                else if (pageMode == PageFunctions.Default)
                {
                    PageHeader.Content = "Change Default Entity";
                    HeaderImage2.SetResourceReference(Image.SourceProperty, "PinIcon");
                    HeaderImage2.Width             = 25;
                    HeaderImage2.Stretch           = System.Windows.Media.Stretch.UniformToFill;
                    Instructions.Content           = "Pick an Entity from the list to set it as your default.";
                    EntityName.Visibility          = Visibility.Hidden;
                    SwitchToCheckBox.Visibility    = Visibility.Hidden;
                    MakeDefaultCheckBox.Visibility = Visibility.Hidden;
                    EntityDescription.IsEnabled    = false;
                    EntityCombo.Margin             = EntityName.Margin;
                    CommitButtonText.Text          = "Set Default";
                    ChangeNameLabel.Visibility     = Visibility.Hidden;
                    EntityCombo.ItemsSource        = EntityFunctions.EntityList(Globals.MyStaffID, false, Globals.MyDefaultEntityID);

                    if (Globals.MyDefaultEntityID != Globals.CurrentEntityID)
                    {
                        try { EntityCombo.SelectedItem = Globals.CurrentEntityName; }
                        catch (Exception generalException) { MessageFunctions.Error("Error setting current entity", generalException); }
                    }
                    else
                    {
                        if (EntityCombo.Items.Count == 1)
                        {
                            EntityCombo.SelectedIndex = 0;
                        }
                    }
                }
                else // Not sure
                {
                    EntityCombo.Visibility = Visibility.Hidden;
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error setting initial values", generalException); }
        }
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            FirstName.Focus();
            CapsLockLabel.Visibility = Visibility.Hidden;
            refreshRoleList();
            refreshEntityList();
            toggleConfirm(false);
            if (!Globals.MyPermissions.Allow("ActivateStaff"))
            {
                ActiveCheckBox.IsEnabled = false;
                ActiveCheckBox.ToolTip   = ActiveLabel.ToolTip = "Your current permissions do not allow activating or disabling staff members";
            }

            try
            {
                pageMode        = PageFunctions.pageParameter(this, "Mode");
                selectedStaffID = Int32.Parse(PageFunctions.pageParameter(this, "StaffID"));
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                StaffFunctions.ReturnToStaffPage(selectedStaffID);
            }

            if (pageMode == PageFunctions.New)
            {
                PageHeader.Content = "Create New Staff Member";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon");
                Instructions.Content  = "Fill in the details as required and then click 'Save' to create the record.";
                BackButton.Visibility = Visibility.Hidden;
            }
            else if (pageMode == PageFunctions.Amend)
            {
                if (selectedStaffID > 0)
                {
                    try
                    {
                        thisStaffMember = StaffFunctions.GetStaffMember(selectedStaffID);
                        FirstName.Text  = thisStaffMember.FirstName;
                        Surname.Text    = thisStaffMember.Surname;
                        UserID.Text     = thisStaffMember.UserID;
                        if (thisStaffMember.UserID != null && thisStaffMember.UserID != "")
                        {
                            UserID.IsEnabled = false;
                        }
                        displayRole();
                        if (thisStaffMember.StartDate != null)
                        {
                            StartDate.SelectedDate = thisStaffMember.StartDate;
                        }
                        if (thisStaffMember.LeaveDate != null)
                        {
                            LeaveDate.SelectedDate = thisStaffMember.LeaveDate;
                        }
                        displayDefaultEntity();
                        ActiveCheckBox.IsChecked = thisStaffMember.Active;
                        SSOCheckBox.IsChecked    = thisStaffMember.SingleSignon;
                        DomainUser.Text          = thisStaffMember.OSUser;
                    }

                    catch (Exception generalException)
                    {
                        MessageFunctions.Error("Error populating staff member data", generalException);
                        StaffFunctions.ReturnToStaffPage(selectedStaffID);
                    }
                }
                else
                {
                    MessageFunctions.Error("Load error: no staff member loaded.", null);
                    StaffFunctions.ReturnToStaffPage(selectedStaffID);
                }
            }
        }
Exemple #19
0
        private void loadContent()
        {
            CapsLockLabel.Visibility = Visibility.Hidden;
            try
            {
                pageMode = PageFunctions.pageParameter(this, "Mode");
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                PageFunctions.ShowTilesPage();
            }

            if (pageMode == PageFunctions.LogIn)
            {
                try
                {
                    ssoID  = LoginFunctions.SingleSignonID();
                    canSSO = (ssoID != "");
                    if (Globals.MyStaffID > 0)    // already logged in, aiming to change login
                    {
                        PageHeader.Content = "Log In as a Different User";
                        if (canSSO && ssoID != Globals.MyUserID)
                        {
                            Welcome.Content       = "Please use single sign-on or enter a UserID and password to change your login.";
                            SSOCheckBox.IsChecked = true;
                        }
                        else
                        {
                            Welcome.Content          = "Please enter a UserID and password to change your login.";
                            SSOCheckBox.IsChecked    = false;
                            SSOCheckBox.IsEnabled    = false;
                            PasswordLabel.Visibility = Password.Visibility = Visibility.Visible;
                        }
                        RightHeader.Visibility = Visibility.Hidden;
                    }
                    else if (canSSO)
                    {
                        SSOCheckBox.IsChecked = true;
                        Welcome.Content       = "Please log in via single sign-on, or un-check the 'Single Sign-on' option and enter a UserID and password.";
                        MessageFunctions.InfoAlert("Please log in to the system.", "Welcome to ProjectTile");
                    }
                    else
                    {
                        SSOCheckBox.IsEnabled    = false;
                        PasswordLabel.Visibility = Password.Visibility = Visibility.Visible;
                        MessageFunctions.InfoAlert("Please enter your login credentials.", "Welcome to ProjectTile");
                    }
                }
                catch (Exception generalException) { MessageFunctions.Error("Error setting initial login view", generalException); }
            }
            else if (pageMode == PageFunctions.PassChange)
            {
                try
                {
                    PasswordLabel.Visibility = Password.Visibility = Visibility.Visible;
                    NewPassword.Visibility   = NewPasswordLabel.Visibility = ConfirmPassword.Visibility = ConfirmLabel.Visibility = Visibility.Visible;
                    NewPasswordLabel.Margin  = SSOLabel.Margin;
                    NewPassword.Margin       = SSOCheckBox.Margin;
                    CommitButtonText.Text    = "Change";
                    PageHeader.Content       = "Change Your ProjectTile Password";
                    HeaderImage2.SetResourceReference(Image.SourceProperty, "PasswordIcon");
                    Welcome.Content         = "Please enter your existing password, and your new password twice.";
                    UserID.IsEnabled        = false;
                    UserID.Text             = Globals.MyUserID;
                    RightHeader.Visibility  = Visibility.Hidden;
                    PleaseWaitLabel.Content =
                        SSOLabel.Visibility = SSOCheckBox.Visibility = Visibility.Hidden;
                    if (LoginFunctions.HasSingleSignon(Globals.MyUserID))
                    {
                        SSONote.Text = "Note that your account currently has Single Sign-on, which allows direct login (without entering a password) when logged into the "
                                       + "operating system as yourself, so a ProjectTile password is not normally required.";
                    }
                }
                catch (Exception generalException)
                {
                    MessageFunctions.Error("Error setting screen components", generalException);
                    PageFunctions.ShowTilesPage();
                }
            }
        }