using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Windows.Media; namespace BS.Shared.DataContracts.ClientPartials { public class SupportConceptGoalDC : INotifyPropertyChanged, IFilterableDC { private List _Children; private ValueListEntryDC _GoalEntryDC; private bool _IsChecked; private bool _IsExpanded; public List Children { get { return _Children ?? (_Children = new List()); } set { _Children = value; } } public ValueListEntryDC GoalEntryDC { get { return _GoalEntryDC; } set { _GoalEntryDC = value; } } public bool HasParent => ParentGoal != null; public bool HasNotice => GoalEntryDC != null && !string.IsNullOrEmpty(GoalEntryDC.Notice); public bool IsChecked { get => _IsChecked; set { _IsChecked = value; foreach (var item in Children) { item.IsChecked = value; } RaisePropertyChanged("IsChecked"); } } public bool IsExpanded { get => _IsExpanded; set { _IsExpanded = value; RaisePropertyChanged("IsExpanded"); } } public string Name => DetailDescription; public SupportConceptGoalDC ParentGoal { get; set; } public event PropertyChangedEventHandler PropertyChanged; public SolidColorBrush FilterableBrush => new SolidColorBrush(Colors.Transparent); protected void RaisePropertyChanged(string propertyName) { var propertyChanged = PropertyChanged; propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public override string ToString() { return GoalEntryDC == null ? "-" : GoalEntryDC.TypeDescription; } #region IFilterableDC Members public string IconPath { get { return string.Empty; } } public string DetailDescription { get { return GoalEntryDC.DisplayName; } } public string FilterRelevants { get { return Name; } // ?? String.Empty; } } public bool SupportsActivationType { get { return true; } } public long Version { get { return 0; } set { } } public string SimpleDescription { get { return Name; } } public ActivationTypeId ActivationType { get { return ActivationTypeId.Active; } set { } } #endregion } }