198 lines
5.2 KiB
C#
198 lines
5.2 KiB
C#
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<SupportConceptGoalDC> _Children;
|
|
|
|
private ValueListEntryDC _GoalEntryDC;
|
|
|
|
private bool _IsChecked;
|
|
|
|
private bool _IsExpanded;
|
|
|
|
private bool _ShowNotice;
|
|
|
|
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 => ParentGoal != null;
|
|
|
|
public bool HasNotice => GoalEntryDC != null && !string.IsNullOrEmpty(GoalEntryDC.Notice);
|
|
|
|
public bool ShowNotice
|
|
{
|
|
get => _ShowNotice;
|
|
|
|
set
|
|
{
|
|
_ShowNotice = value;
|
|
|
|
|
|
RaisePropertyChanged("ShowNotice");
|
|
}
|
|
}
|
|
|
|
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
|
|
|
|
public void SetRating(int? rating)
|
|
{
|
|
if (GoalEntryDC != null)
|
|
{
|
|
GoalEntryDC.Rating = rating;
|
|
}
|
|
|
|
if (rating == null)
|
|
{
|
|
foreach (var item in Children)
|
|
{
|
|
item.SetRating(null);
|
|
}
|
|
}
|
|
|
|
RaisePropertyChanged("HasRating");
|
|
RaisePropertyChanged("RatingName");
|
|
|
|
}
|
|
|
|
public bool HasRating => GoalEntryDC != null && GoalEntryDC.Rating.HasValue;
|
|
|
|
|
|
public string RatingName
|
|
{
|
|
get
|
|
{
|
|
if (GoalEntryDC != null && GoalEntryDC.Rating.HasValue)
|
|
{
|
|
switch (GoalEntryDC.Rating.Value)
|
|
{
|
|
case -1:
|
|
return "Keine Bewertung";
|
|
case 0:
|
|
return "xxx.0 - Problem nicht vorhanden (ohne, kein, unerheblich ...) 0 bis 4 %";
|
|
case 1:
|
|
return "xxx.1 - Problem leicht ausgeprägt (schwach, gering ...) 5 bis 24 %";
|
|
case 2:
|
|
return "xxx.2 - Problem mäßig ausgeprägt (mittel, ziemlich ...) 25 bis 49 %";
|
|
case 3:
|
|
return "xxx.3 - Problem erheblich ausgeprägt (hoch, äußerst ...) 50 bis 95 %";
|
|
case 4:
|
|
return "xxx.4 - Problem voll ausgeprägt (komplett, total ...) 96 bis 100 %";
|
|
case 8:
|
|
return "xxx.8 - Nicht spezifiziert";
|
|
case 9:
|
|
return "xxx.9 - Nicht anwendbar";
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
} |