Files
BeWoPlaner/Shared/DataContracts/ClientPartials/SupportConceptGoalDC.cs

198 lines
5.2 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
2016-06-27 01:45:38 +02:00
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;
2019-10-10 21:46:41 +02:00
private bool _ShowNotice;
2016-06-27 01:45:38 +02:00
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);
2016-06-27 01:45:38 +02:00
2019-10-10 21:46:41 +02:00
public bool ShowNotice
{
get => _ShowNotice;
set
{
_ShowNotice = value;
RaisePropertyChanged("ShowNotice");
}
}
2016-06-27 01:45:38 +02:00
public bool IsChecked
{
get => _IsChecked;
2016-06-27 01:45:38 +02:00
set
{
_IsChecked = value;
foreach (var item in Children)
2016-06-27 01:45:38 +02:00
{
item.IsChecked = value;
}
RaisePropertyChanged("IsChecked");
}
}
public bool IsExpanded
{
get => _IsExpanded;
2016-06-27 01:45:38 +02:00
set
{
_IsExpanded = value;
RaisePropertyChanged("IsExpanded");
}
}
public string Name => DetailDescription;
2016-06-27 01:45:38 +02:00
2016-06-27 01:45:38 +02:00
public SupportConceptGoalDC ParentGoal { get; set; }
2016-06-27 01:45:38 +02:00
public event PropertyChangedEventHandler PropertyChanged;
public SolidColorBrush FilterableBrush => new SolidColorBrush(Colors.Transparent);
2016-06-27 01:45:38 +02:00
protected void RaisePropertyChanged(string propertyName)
{
var propertyChanged = PropertyChanged;
2016-06-27 01:45:38 +02:00
propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public override string ToString()
{
return GoalEntryDC == null ? "-" : GoalEntryDC.TypeDescription;
2016-06-27 01:45:38 +02:00
}
#region IFilterableDC Members
public string IconPath
{
get { return string.Empty; }
}
public string DetailDescription
{
get { return GoalEntryDC.DisplayName; }
2016-06-27 01:45:38 +02:00
}
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
2019-10-10 21:46:41 +02:00
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;
}
}
2016-06-27 01:45:38 +02:00
}
}