Files
BeWoPlaner/Shared/DataContracts/ClientPartials/SupportConceptGoalDC.cs
2017-09-26 12:48:29 +02:00

136 lines
3.3 KiB
C#

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<SupportConceptGoalDC> _Children;
private ValueListEntryDC _GoalEntryDC;
private bool _IsChecked;
private bool _IsExpanded;
public List<SupportConceptGoalDC> Children
{
get { return _Children ?? (_Children = new List<SupportConceptGoalDC>()); }
set { _Children = value; }
}
public ValueListEntryDC GoalEntryDC
{
get { return _GoalEntryDC; }
set { _GoalEntryDC = value; }
}
public bool HasParent
{
get { return ParentGoal != null; }
}
public bool IsChecked
{
get { return _IsChecked; }
set
{
_IsChecked = value;
foreach (var item in Children.Where(w => !w.GoalEntryDC.Type.Equals(ValueListEntryType.SupportConceptIndividualGoalCategoryType) || !w.GoalEntryDC.Type.Equals(ValueListEntryType.SupportConceptIndividualGoalType)))
{
item.IsChecked = value;
}
RaisePropertyChanged("IsChecked");
}
}
public bool IsExpanded
{
get { return _IsExpanded; }
set
{
_IsExpanded = value;
RaisePropertyChanged("IsExpanded");
}
}
public string Name
{
get
{
if (_GoalEntryDC != null)
{
return _GoalEntryDC.TypeDescription;
}
return null;
}
}
public SupportConceptGoalDC ParentGoal { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public SolidColorBrush FilterableBrush { get { return new SolidColorBrush(Colors.Transparent); } }
protected void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler propertyChanged = PropertyChanged;
if (propertyChanged != null)
{
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#region IFilterableDC Members
public string IconPath
{
get { return string.Empty; }
}
public string DetailDescription
{
get { return Name; }
}
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
}
}