230 lines
5.7 KiB
C#
230 lines
5.7 KiB
C#
using System.ComponentModel;
|
|
using System.Windows.Media;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BeWo.ViewModel;
|
|
|
|
namespace BeWo.Core
|
|
{
|
|
public class ServiceCategoryTreeItem : INotifyPropertyChanged, IFilterableDC
|
|
{
|
|
private BindingList<ServiceCategoryTreeItem> _Children;
|
|
|
|
private ServiceCategoryDC _ServiceCategory;
|
|
|
|
private ServiceDescriptionDC _ServiceDescription;
|
|
|
|
private ServiceAccountingDC _ServiceAccounting;
|
|
|
|
private ServiceAccountingVM _ServiceAccountingVM;
|
|
|
|
private bool _IsChecked;
|
|
|
|
private bool _IsExpanded;
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
|
|
public BindingList<ServiceCategoryTreeItem> Children
|
|
{
|
|
get
|
|
{
|
|
return this._Children ?? (this._Children = new BindingList<ServiceCategoryTreeItem>());
|
|
}
|
|
|
|
set
|
|
{
|
|
this._Children = value;
|
|
}
|
|
}
|
|
|
|
public ServiceCategoryTreeItem Parent { get; set; }
|
|
|
|
public ServiceCategoryDC ServiceCategory
|
|
{
|
|
get
|
|
{
|
|
return this._ServiceCategory;
|
|
}
|
|
|
|
set
|
|
{
|
|
this._ServiceCategory = value;
|
|
}
|
|
}
|
|
|
|
public ServiceDescriptionDC ServiceDescription
|
|
{
|
|
get
|
|
{
|
|
return this._ServiceDescription;
|
|
}
|
|
|
|
set
|
|
{
|
|
this._ServiceDescription = value;
|
|
}
|
|
}
|
|
|
|
public ServiceAccountingDC ServiceAccounting
|
|
{
|
|
get
|
|
{
|
|
return this._ServiceAccounting;
|
|
}
|
|
|
|
set
|
|
{
|
|
this._ServiceAccounting = value;
|
|
}
|
|
}
|
|
|
|
public ServiceAccountingVM ServiceAccountingVM
|
|
{
|
|
get
|
|
{
|
|
return this._ServiceAccountingVM;
|
|
}
|
|
|
|
set
|
|
{
|
|
this._ServiceAccountingVM = value;
|
|
}
|
|
}
|
|
|
|
public bool IsChecked
|
|
{
|
|
get
|
|
{
|
|
return this._IsChecked;
|
|
}
|
|
|
|
set
|
|
{
|
|
this._IsChecked = value;
|
|
foreach (var item in this.Children)
|
|
{
|
|
if (item.IsChecked != value)
|
|
item.IsChecked = value;
|
|
}
|
|
|
|
this.RaisePropertyChanged("IsChecked");
|
|
}
|
|
}
|
|
|
|
public bool IsExpanded
|
|
{
|
|
get
|
|
{
|
|
return this._IsExpanded;
|
|
}
|
|
|
|
set
|
|
{
|
|
this._IsExpanded = value;
|
|
this.RaisePropertyChanged("IsExpanded");
|
|
}
|
|
}
|
|
|
|
public SolidColorBrush FilterableBrush { get { return new SolidColorBrush(Colors.Transparent); } }
|
|
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
if (this._ServiceCategory != null)
|
|
{
|
|
return this._ServiceCategory.Name;
|
|
}
|
|
else if (this._ServiceDescription != null)
|
|
{
|
|
return this._ServiceDescription.Name;
|
|
}
|
|
else if (this._ServiceAccounting != null)
|
|
{
|
|
return this._ServiceAccounting.ServiceDescription.Name;
|
|
}
|
|
else if (this._ServiceAccountingVM != null)
|
|
{
|
|
return this._ServiceAccountingVM.ServiceDescription.Name;
|
|
}
|
|
return null;
|
|
}
|
|
set
|
|
{
|
|
if (this._ServiceCategory != null)
|
|
{
|
|
this._ServiceCategory.Name = value;
|
|
}
|
|
else if (this._ServiceDescription != null)
|
|
{
|
|
this._ServiceDescription.Name = value;
|
|
}
|
|
else if (this._ServiceAccounting != null)
|
|
{
|
|
this._ServiceAccounting.ServiceDescription.Name = value;
|
|
}
|
|
else if (this._ServiceAccountingVM != null)
|
|
{
|
|
this._ServiceAccountingVM.ServiceDescription.Name = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected void RaisePropertyChanged(string propertyName)
|
|
{
|
|
PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
|
|
if (propertyChanged != null)
|
|
{
|
|
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
internal void SetChecked(bool checkedValue)
|
|
{
|
|
this._IsChecked = checkedValue;
|
|
}
|
|
|
|
#region IFilterableDC Members
|
|
public string IconPath
|
|
{
|
|
get { return string.Empty; }
|
|
}
|
|
|
|
public string DetailDescription
|
|
{
|
|
get { return Name; }
|
|
}
|
|
|
|
public string FilterRelevants
|
|
{
|
|
get { return Name; }
|
|
}
|
|
|
|
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
|
|
}
|
|
} |