private void refreshEntityList() { try { entityList = EntityFunctions.EntityList(Globals.MyStaffID, false); EntityCombo.ItemsSource = entityList; } catch (Exception generalException) { MessageFunctions.Error("Error populating Entities list", generalException); } }
// ---------------------- // // -- Data Management --- // // ---------------------- // // Data updates // private void refreshEntityCombo(bool includeAll) { try { entityComboList = EntityFunctions.EntityList(Globals.MyStaffID, includeAll); EntityCombo.ItemsSource = entityComboList; EntityCombo.SelectedItem = entityComboList.FirstOrDefault(p => p.ID == selectedEntityID); } catch (Exception generalException) { MessageFunctions.Error("Error populating Entity filter list", generalException); } }
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); } }