private void clearSelection() { selectedGridRecord = null; // selectedClientID = 0; // Don't clear this automatically, as the refresh tries to reuse it Globals.SelectedClient = null; // Ditto ProductButton.IsEnabled = false; }
private void ClientDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (ClientDataGrid.SelectedItem != null) { selectedRecord = (ClientProxy)ClientDataGrid.SelectedItem; ClientFunctions.SelectClient(selectedRecord.ID); toggleSideButtons(true); if (pageMode == PageFunctions.Lookup) { CommitButton.IsEnabled = true; } } else { clearSelection(); } } catch (Exception generalException) { MessageFunctions.Error("Error processing client selection", generalException); clearSelection(); } }
// -------------- 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 displaySelectedClient(int currentClientID) { // Necessary because the binding won't find the record in the list automatically try { ClientProxy selectedClient = ProjectFunctions.GetClientInOptionsList(currentClientID); ClientCombo.SelectedIndex = ProjectFunctions.ClientOptionsList.IndexOf(selectedClient); } catch (Exception generalException) { MessageFunctions.Error("Error selecting current client", generalException); } }
private void setCurrentClient(ClientProxy clientProxy) { try { Globals.SelectedClientProxy = clientProxy; clientSelected = (clientProxy != null && clientProxy.ID > 0); togglePageHeader(); } catch (Exception generalException) { MessageFunctions.Error("Error processing project client selection", generalException); } }
private void ClientCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ClientFunctions.IgnoreAnyChanges()) { clearChanges(); if (ClientCombo.SelectedItem != null) { selectedGridRecord = (ClientProxy)ClientCombo.SelectedItem; ClientFunctions.SelectClient(selectedGridRecord.ID); refreshProductSummaries(true); } } }
private void refreshClientCombo() { try { ClientProxy currentRecord = (Globals.SelectedClientProxy != null) ? Globals.SelectedClientProxy : Globals.DefaultClientProxy; ProjectFunctions.SetClientFilterList(); ClientCombo.ItemsSource = ProjectFunctions.ClientFilterList; if (ProjectFunctions.ClientFilterList.Exists(ccl => ccl.ID == currentRecord.ID)) { ClientCombo.SelectedItem = ProjectFunctions.ClientFilterList.First(ccl => ccl.ID == currentRecord.ID); } } catch (Exception generalException) { MessageFunctions.Error("Error populating client drop-down list", generalException); } }
private void ClientCombo_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (ClientCombo.IsEnabled) // Otherwise just the one value, already 'selected' { if (ClientCombo.SelectedItem != null) // No need for an 'else', won't be long... { ClientProxy thisRecord = (ClientProxy)ClientCombo.SelectedItem; ClientFunctions.SelectClient(thisRecord.ID); } } refreshContactGrid(); } catch (Exception generalException) { MessageFunctions.Error("Error processing client drop-down selection", generalException); } }
public static void ResetProjectParameters() { SelectedClientProxy = DefaultClientProxy; SelectedPMProxy = DefaultPMProxy; SelectedStatusFilter = DefaultStatusFilter; SelectedProjectProxy = DefaultProjectProxy; SelectedProjectRole = DefaultProjectRole; SelectedClientRole = DefaultClientRole; ProjectSourcePage = TilesPageName; ProjectSourceMode = PageFunctions.None; SelectedTeamTimeFilter = DefaultTeamTimeFilter; SelectedStage = DefaultStage; SelectedTimelineType = DefaultTimelineType; SelectedFromDate = DefaultFromDate; SelectedToDate = DefaultToDate; SelectedHistory = null; }
private void ClientDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (ClientDataGrid.SelectedItem != null) { selectedGridRecord = (ClientProxy)ClientDataGrid.SelectedItem; ClientFunctions.SelectClient(selectedGridRecord.ID); ProductButton.IsEnabled = true; } else // No record selected, e.g. because filter changed { clearSelection(); } } catch (Exception generalException) { MessageFunctions.Error("Error processing selection change", generalException); Globals.SelectedClient = null; // Avoid accidentally using the previous selection clearSelection(); } }
private void editMode(ClientProxy gridRecord, bool copy = false) { try { ButtonsGrid.Visibility = MainClientGrid.Visibility = Visibility.Hidden; EditGrid.Visibility = Visibility.Visible; CommitButton.Visibility = Visibility.Visible; NonAMsCheckBox.IsChecked = false; EntityWarningLabel.Visibility = Visibility.Hidden; toggleSuggestionMode(false); if (gridRecord != null) // Amending/copying an existing record { try { if (copy) { editRecordID = 0; PageHeader.Content = "Copy Client Details"; HeaderImage2.SetResourceReference(Image.SourceProperty, "CopyIcon"); Instructions.Content = "Amend the details as required for the new record, then click 'Save' to create it."; toggleEntityControls(true); refreshEntityList(); } else { editRecordID = gridRecord.ID; PageHeader.Content = "Amend Client Details"; //HeaderImage2.SetResourceReference(Image.SourceProperty, "AmendIcon"); Instructions.Content = "Amend the selected record as required and then click 'Save' to apply changes."; toggleEntityControls(false); } ClientCode.Text = gridRecord.ClientCode; ClientName.Text = gridRecord.ClientName; ActiveCheckBox.IsChecked = gridRecord.ActiveClient; BackButton.Visibility = Visibility.Visible; refreshEditManagersCombo((bool)NonAMsCheckBox.IsChecked, gridRecord.ManagerName); } catch (Exception generalException) { MessageFunctions.Error("Error setting up the page for client amendments", generalException); } } else // Brand new record { try { editRecordID = 0; PageHeader.Content = "Create New Client"; HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon"); Instructions.Content = "Fill in the details as required and then click 'Save' to create the record."; toggleEntityControls(false); refreshEditManagersCombo((bool)NonAMsCheckBox.IsChecked, ""); if (pageMode == PageFunctions.Amend) { BackButton.Visibility = Visibility.Visible; ClientCode.Text = ClientName.Text = ""; ActiveCheckBox.IsChecked = false; EditManagersCombo.SelectedItem = ""; } } catch (Exception generalException) { MessageFunctions.Error("Error setting up the page for client creation", generalException); } } } catch (Exception generalException) { MessageFunctions.Error("Error setting up the page for editing", generalException); } }