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"); 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"); }
// -------------- Data updates -------------- // // --------- Other/shared functions --------- // private void setCurrentClient(Clients client, ClientProxy clientProxy = null) { try { if (client == null && clientProxy == null) { Globals.SelectedClient = null; PageHeader.Content = defaultHeader; if (!projectSelected) { MessageFunctions.CancelInfoAlert(); } } else { if (client == null) { client = ClientFunctions.GetClientByID(clientProxy.ID); } Globals.SelectedClient = client; PageHeader.Content = defaultHeader + " for Client " + client.ClientCode + " (" + client.ClientName + ")"; if (!projectSelected) { MessageFunctions.InfoAlert("This effectively sets the current client to " + client.ClientName + " until the name filter is changed/cleared " + " or a different project is selected (the projects drop-down list is unaffected)", "Client " + client.ClientCode + " selected"); } } } catch (Exception generalException) { MessageFunctions.Error("Error processing project client selection", generalException); } }
private void toggleProjectMode(bool specificProject) { projectSelected = ProjectButton.IsEnabled = specificProject; toggleEditButtons(projectSelected); ProjectButtonText.Text = (!projectSelected) ? "Set Project" : "All Projects"; toggleProjectSearchButton(); toggleProjectColumns(); if (specificProject && canEditTeams) { MessageFunctions.InfoAlert(keyRoles + " are key roles that must be filled throughout the project. However, existing records can be " + " amended to replace unwanted entries.", "Please note:"); } }
private bool setUpReadOnly(bool inTeam, bool isOld) { try { ProjectButtonText.Text = projectSelected ? "All Projects" : "Set Project"; ProjectFunctions.LoggedByList = ProjectFunctions.ActionList.Select(al => al.LoggedBy).Distinct().ToList(); stageList = ProjectFunctions.ActionList.Select(al => al.LinkedStage).Distinct().ToList(); ProjectFunctions.OwnerList = ProjectFunctions.ActionList.Select(al => al.Owner).Distinct().ToList(); if (editing || firstRefresh) { editing = false; ActionDataGrid.IsReadOnly = true; ActionDataGrid.BorderThickness = new Thickness(1); resetButtons(); ShowNotesButtonText.Text = "View Notes"; ShowNotesButton.IsEnabled = false; NotesBox.IsReadOnly = true; } if (!projectSelected && canEdit) { Instructions.Content = defaultInstructions + (canEdit ? " Choose a project to edit." : ""); MessageFunctions.InfoAlert("If you are a team member of an active project, you can edit its actions by selecting the project; the table becomes italic with a thicker border. " + "Further instructions will then appear.", "'Read-only' Mode"); } else { Instructions.Content = defaultInstructions; if (projectSelected && canEdit) { if (isOld) { string caption = (Globals.SelectedProjectProxy.IsCancelled) ? "Project Cancelled" : "Project Completed"; MessageFunctions.InfoAlert("This project is closed, so its actions cannot be edited.", caption); } else if (!inTeam) { MessageFunctions.InfoAlert("Only members of the project team can edit the actions for this project. Please speak to the Project Manager if you require access.", "'Read-only' Mode"); } } } return(true); } catch (Exception generalException) { MessageFunctions.Error("Error setting up actions view", generalException); return(false); } }
private bool setUpEditing(int projectID) { try { ProjectFunctions.LoggedByList = ProjectFunctions.GetInternalTeam(projectID); stageList = ProjectFunctions.GetProjectHistoryStages(projectID); stageList.Add(Globals.NoStage); ProjectFunctions.OwnerList = ProjectFunctions.CombinedTeamList(projectID); foreach (ActionProxy action in ProjectFunctions.ActionList) // Required for the initial values to display when in 'project mode' { int?stageID = action.LinkedStage.ID; if (stageID != null) { action.LinkedStage = stageList.Where(sl => sl.ID == stageID).FirstOrDefault(); } int loggedByID = action.LoggedBy.ID; action.LoggedBy = ProjectFunctions.LoggedByList.Where(lbl => lbl.ID == loggedByID).FirstOrDefault(); bool internalOwner = (action.Owner.InternalTeamMember != null); int ownerID = internalOwner ? action.Owner.InternalTeamMember.ID : action.Owner.ClientTeamMember.ID; action.Owner = ProjectFunctions.OwnerList.Where(ol => (internalOwner && ol.InternalTeamMember.ID == ownerID) || (!internalOwner && ol.ClientTeamMember != null && ol.ClientTeamMember.ID == ownerID)) .FirstOrDefault(); } if (!editing || firstRefresh) { editing = true; ProjectButtonText.Text = "All Projects"; ActionDataGrid.IsReadOnly = false; ActionDataGrid.BorderThickness = new Thickness(3); Instructions.Content = "Double-click cells in italics to edit (others update automatically). Edit the bottom (blank) row to add."; MessageFunctions.InfoAlert("To add new rows, scroll to the bottom of the table and edit the first empty row. Each action must have an 'owner' from the project team, " + "and either a linked stage or a target completion date.", "'Direct Edit' Mode"); NotesBox.IsReadOnly = false; } return(true); } catch (Exception generalException) { MessageFunctions.Error("Error setting up action editing", generalException); return(false); } }
private void removeProduct() { try { if (ProductTo.SelectedItem != null) { List <ClientProductProxy> removeList = new List <ClientProductProxy>(); ClientProductProxy thisProduct = null; ProjectProductProxy thisRecord = (ProjectProductProxy)ProductTo.SelectedItem; if (thisRecord.ClientID > 0) { thisProduct = ClientFunctions.ClientsWithProduct(false, thisRecord.ProductID).FirstOrDefault(cwp => cwp.ClientID == thisRecord.ClientID); if (thisProduct == null) { MessageFunctions.InfoAlert("No client product record found for client " + thisRecord.ClientName() + " with product " + thisRecord.ProductName + ". A 'dummy' record will be used instead.", null); thisProduct = ProjectFunctions.DummyClientProduct(thisRecord.Product); } } else { thisProduct = ProjectFunctions.DummyClientProduct(thisRecord.Product); } removeList.Add(thisProduct); bool success = ProjectFunctions.ToggleProjectProducts(removeList, false, Globals.SelectedProjectProxy); if (success) { refreshProductSummaries(false); CommitButton.IsEnabled = true; } } else { MessageFunctions.Error("Error removing products from project: no product selected.", null); } } catch (Exception generalException) { MessageFunctions.Error("Error removing products from project", generalException); } }
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(); //} FromDate.SelectedDate = fromDate = Globals.StartOfMonth; ToDate.SelectedDate = toDate = Globals.Today; refreshTableNames(); refreshStaffCombo(); FromDate.Focus(); ToDate.Focus(); TableCombo.Focus(); MessageFunctions.InfoAlert("Only records within or relevant to the current Entity (" + Globals.CurrentEntityName + ") are displayed.", "Please note:"); }
private void setLabels() { if (editMode == ByProject) { if (internalProjectSelected()) { FromLabel.Content = "Available Products"; } else { FromLabel.Content = "Available Products for " + Globals.SelectedProjectProxy.Client.ClientName; MessageFunctions.InfoAlert("Only products owned by " + Globals.SelectedProjectProxy.Client.ClientName + " are displayed. Use the 'Client Projects' button to add any missing products to the client.", "Please note:"); } } else { FromLabel.Content = "Available Projects"; MessageFunctions.InfoAlert("Only projects for clients who have product " + selectedProduct.ProductName + " (and internal projects) " + "are displayed, and only non-Live open projects can be added or removed.", "Please note:"); } }
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(); } } }