2019-08-26 16:11:00 +02:00
|
|
|
|
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;
|
|
|
|
|
|
|
2020-09-23 22:10:52 +02:00
|
|
|
|
private bool _CheckRecursive = true;
|
|
|
|
|
|
|
2020-03-03 09:27:02 +01:00
|
|
|
|
public long? KeyField => GoalEntryDC?.ValueListEntryOid;
|
|
|
|
|
|
|
|
|
|
|
|
public long? ParentField => ParentGoal?.GoalEntryDC?.ValueListEntryOid;
|
|
|
|
|
|
|
2020-09-23 22:10:52 +02:00
|
|
|
|
public bool CheckRecursive {
|
|
|
|
|
|
get { return _CheckRecursive; }
|
|
|
|
|
|
set { _CheckRecursive = value; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-08-26 16:11:00 +02:00
|
|
|
|
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
|
|
|
|
|
|
{
|
2019-08-26 16:11:00 +02:00
|
|
|
|
get => _IsChecked;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_IsChecked = value;
|
2020-09-23 22:10:52 +02:00
|
|
|
|
if (CheckRecursive)
|
2016-06-27 01:45:38 +02:00
|
|
|
|
{
|
2020-09-23 22:10:52 +02:00
|
|
|
|
foreach (var item in Children)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.IsChecked = value;
|
|
|
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RaisePropertyChanged("IsChecked");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsExpanded
|
|
|
|
|
|
{
|
2019-08-26 16:11:00 +02:00
|
|
|
|
get => _IsExpanded;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_IsExpanded = value;
|
|
|
|
|
|
RaisePropertyChanged("IsExpanded");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2019-08-26 16:11:00 +02:00
|
|
|
|
public string Name => DetailDescription;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
public SupportConceptGoalDC ParentGoal { get; set; }
|
2017-09-26 12:48:29 +02:00
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
2017-09-26 12:48:29 +02:00
|
|
|
|
|
2019-08-26 16:11:00 +02:00
|
|
|
|
public SolidColorBrush FilterableBrush => new SolidColorBrush(Colors.Transparent);
|
2017-09-26 12:48:29 +02:00
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
protected void RaisePropertyChanged(string propertyName)
|
|
|
|
|
|
{
|
2019-08-26 16:11:00 +02:00
|
|
|
|
var propertyChanged = PropertyChanged;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
2019-08-26 16:11:00 +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
|
|
|
|
|
|
{
|
2019-08-26 16:11:00 +02:00
|
|
|
|
get { return GoalEntryDC.DisplayName; }
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public string FilterRelevants
|
|
|
|
|
|
{
|
2020-04-08 14:25:01 +02:00
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
String filter = this.Name + " " + this.GoalEntryDC?.Abbreviation;
|
|
|
|
|
|
|
|
|
|
|
|
if (this.Children != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var child in this.Children)
|
|
|
|
|
|
{
|
|
|
|
|
|
filter += " ";
|
|
|
|
|
|
filter += child.FilterRelevants;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return filter;
|
|
|
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-08-17 15:50:00 +02:00
|
|
|
|
public void SetRatingType(RatingTypeDC rt)
|
2019-10-10 21:46:41 +02:00
|
|
|
|
{
|
2020-08-17 15:50:00 +02:00
|
|
|
|
if (GoalEntryDC != null && rt != null)
|
2019-10-10 21:46:41 +02:00
|
|
|
|
{
|
2020-08-17 15:50:00 +02:00
|
|
|
|
GoalEntryDC.RatingTypeOid = rt.RatingTypeOid.Value;
|
|
|
|
|
|
|
|
|
|
|
|
RatingName = rt.DisplayName;
|
2019-10-10 21:46:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-09-23 22:10:52 +02:00
|
|
|
|
if (rt == null && GoalEntryDC != null)
|
2019-10-10 21:46:41 +02:00
|
|
|
|
{
|
2020-09-23 22:10:52 +02:00
|
|
|
|
GoalEntryDC.RatingTypeOid = null;
|
|
|
|
|
|
|
|
|
|
|
|
RatingName = "";
|
|
|
|
|
|
//foreach (var item in Children)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// item.SetRatingType(null);
|
|
|
|
|
|
//}
|
2019-10-10 21:46:41 +02:00
|
|
|
|
}
|
2020-08-17 15:50:00 +02:00
|
|
|
|
|
2019-10-10 21:46:41 +02:00
|
|
|
|
RaisePropertyChanged("HasRating");
|
|
|
|
|
|
RaisePropertyChanged("RatingName");
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-08-17 15:50:00 +02:00
|
|
|
|
public bool HasRating => GoalEntryDC != null && GoalEntryDC.RatingTypeOid.HasValue;
|
|
|
|
|
|
|
|
|
|
|
|
public string RatingName { get; set; }
|
2019-10-10 21:46:41 +02:00
|
|
|
|
|
2024-02-20 12:36:59 +01:00
|
|
|
|
public bool IsZiel
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsOfType(ValueListEntryType.SupportConceptGoalCategoryType);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsIndZiel
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsOfType(ValueListEntryType.SupportConceptIndividualGoalCategoryType);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsMassnahme
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsOfType(ValueListEntryType.SupportConceptGoalType);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsIndMassnahme
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return IsOfType(ValueListEntryType.SupportConceptIndividualGoalType);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2019-10-10 21:46:41 +02:00
|
|
|
|
|
2024-02-20 12:36:59 +01:00
|
|
|
|
public bool IsOfType(ValueListEntryType t)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_GoalEntryDC != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return _GoalEntryDC.Type == t;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|