Files
BeWoPlaner/Shared/DataContracts/ClientPartials/SupportConceptGoalDC.cs
Lyndon Jetten e0447d0a05 MoK:
Intervallfinder überarbeitet & Bug gefixt, der zu einem Fehler beim Suchen nach freien Intervallen über mehrere Tage geführt hatte, wenn die Enduhrzeit vor der Startuhrzeit lag.

Berichte mit Parametern.

Verbesserte Mitarbeiter-, Klienten-, Team-, und Organisationsdropdowns mit Suche.

Quittierungsbelegresultate (zum Unterschreiben) wird wie die Zeiterfassung paginiert.

FaC:

neuer Kalender noch nicht fertig.
2024-11-12 18:37:23 +01:00

241 lines
5.9 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;
private bool _CheckRecursive = true;
public long? KeyField => GoalEntryDC?.ValueListEntryOid;
public long? ParentField => ParentGoal?.GoalEntryDC?.ValueListEntryOid;
public bool CheckRecursive {
get { return _CheckRecursive; }
set { _CheckRecursive = value; }
}
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;
if (CheckRecursive)
{
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
{
String filter = this.Name + " " + this.GoalEntryDC?.Abbreviation;
if (this.Children != null)
{
foreach (var child in this.Children)
{
filter += " ";
filter += child.FilterRelevants;
}
}
return filter;
}
}
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 SetRatingType(RatingTypeDC rt)
{
if (GoalEntryDC != null && rt != null)
{
GoalEntryDC.RatingTypeOid = rt.RatingTypeOid.Value;
RatingName = rt.DisplayName;
}
if (rt == null && GoalEntryDC != null)
{
GoalEntryDC.RatingTypeOid = null;
RatingName = "";
//foreach (var item in Children)
//{
// item.SetRatingType(null);
//}
}
RaisePropertyChanged("HasRating");
RaisePropertyChanged("RatingName");
}
public bool HasRating => GoalEntryDC != null && GoalEntryDC.RatingTypeOid.HasValue;
public string RatingName { get; set; }
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);
}
}
public bool IsOfType(ValueListEntryType t)
{
if (_GoalEntryDC != null)
{
return _GoalEntryDC.Type == t;
}
return false;
}
}
}