2016-06-27 01:45:38 +02:00
using System ;
using System.Collections.Generic ;
using System.Globalization ;
using System.Linq ;
using System.Windows ;
using System.Windows.Media ;
2017-04-03 13:39:11 +02:00
using System.Windows.Media.Imaging ;
2016-06-27 01:45:38 +02:00
using BeWo.Core ;
using BeWo.Core.Service ;
using BeWo.Validation ;
using BS.Shared ;
using BS.Shared.Core ;
using BS.Shared.DataContracts ;
using BS.Shared.DataContracts.ClientPartials ;
using BS.Shared.DataContracts.Compact ;
using BS.Shared.Extensions ;
2017-04-03 13:39:11 +02:00
using Brush = System . Windows . Media . Brush ;
using Brushes = System . Windows . Media . Brushes ;
using Color = System . Windows . Media . Color ;
2016-06-27 01:45:38 +02:00
namespace BeWo.ViewModel
{
2026-07-30 14:17:47 +02:00
// Claude: ICustomerRelatedContext -> steuert die Dokumentationspflicht beim Bearbeiten
public class ServiceRecordVM : AbstractDCMapperVM < ServiceRecordDC > , ICustomerRelatedContext
2016-06-27 01:45:38 +02:00
{
2022-11-09 09:44:24 +01:00
public String ATEST { get ; set ; }
2016-06-27 01:45:38 +02:00
#region Constants and Fields
public static string PropertyName_Category = "Category" ;
public static string PropertyName_Category2Services = "Category2Services" ;
2020-12-30 02:46:55 +01:00
public static string PropertyName_SortedCategories = "SortedCategories" ;
2016-06-27 01:45:38 +02:00
public static string PropertyName_CostBearer = "CostBearer" ;
public static string PropertyName_Customer = "Customer" ;
public static string PropertyName_Duration = "Duration" ;
public static string PropertyName_Employee = "Employee" ;
public static string PropertyName_GoalTree = "GoalTree" ;
public static string PropertyName_GroupEmployeeCount = "GroupEmployeeCount" ;
public static string PropertyName_GroupPersonCount = "GroupPersonCount" ;
public static string PropertyName_GroupRoundedDuration = "GroupRoundedDuration" ;
public static string PropertyName_IsGoalTreeVisible = "IsGoalTreeVisible" ;
public static string PropertyName_Notice = "Notice" ;
public static string PropertyName_Notice2 = "Notice2" ;
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
public static string PropertyName_Notice3 = "Notice3" ;
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
public static string PropertyName_Notice4 = "Notice4" ;
public static string PropertyName_Notice5 = "Notice5" ;
2017-07-27 09:58:04 +02:00
public static string PropertyName_RTFNotice = "RTFNotice" ;
public static string PropertyName_RTFNotice2 = "RTFNotice2" ;
public static string PropertyName_RTFNotice3 = "RTFNotice3" ;
public static string PropertyName_RTFNotice4 = "RTFNotice4" ;
public static string PropertyName_RTFNotice5 = "RTFNotice5" ;
2016-06-27 01:45:38 +02:00
public static string PropertyName_PossibleCostBearers = "PossibleCostBearers" ;
public static string PropertyName_PossibleCustomers = "PossibleCustomers" ;
public static string PropertyName_PossibleServiceDescriptions = "PossibleServiceDescriptions" ;
public static string PropertyName_PossibleSupportConcepts = "PossibleSupportConcepts" ;
public static string PropertyName_RoundedDuration = "RoundedDuration" ;
public static string PropertyName_SelectedGoals = "SelectedGoals" ;
public static string PropertyName_ServiceDescription = "ServiceDescription" ;
public static string PropertyName_SupportConcept = "SupportConcept" ;
public static string PropertyName_ServiceRecordType = "ServiceRecordType" ;
public static string PropertyName_IsServiceRecordTypeDefaultActivity = "IsServiceRecordTypeDefaultActivity" ;
public static string PropertyName_IsServiceRecordTypeContent = "IsServiceRecordTypeContent" ;
2020-12-30 02:46:55 +01:00
public static string PropertyName_DistanceInMeter = "DistanceInMeter" ;
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
public static string PropertyName_DauerEinheit = "DauerEinheit" ;
2017-01-11 11:02:58 +01:00
2017-01-19 17:02:07 +01:00
public static string PropertyName_ServiceRecordFormat = "ServiceRecordFormat" ;
2017-01-16 16:13:19 +01:00
public static string PropertyName_OnlyMonth = "OnlyMonth" ;
2017-01-19 17:02:07 +01:00
public static string PropertyName_OnlyYear = "OnlyYear" ;
2017-01-24 13:43:59 +01:00
public static string PropertyName_DurationMonthYearGes = "DurationMonthYearGes" ;
2020-10-12 13:03:05 +02:00
public static string PropertyName_Betrag = "Betrag" ;
2020-12-30 02:46:55 +01:00
public static string PropertyName_EditStartDate = "EditStartDate" ;
public static string PropertyName_EditEndDate = "EditEndDate" ;
public static string PropertyName_StartTimeString = "StartTimeString" ;
public static string PropertyName_EndTimeString = "EndTimeString" ;
2016-06-27 01:45:38 +02:00
private static readonly DateTime NULL_TIME = new DateTime ( 2000 , 1 , 1 , 0 , 0 , 1 ) ;
2017-11-23 10:58:07 +01:00
private static BitmapImage haekchenBitmapImage = null ;
2017-04-03 13:39:11 +02:00
2016-06-27 01:45:38 +02:00
private Dictionary < ServiceCategoryDC , List < ServiceDescriptionDC > > _Category2Services ;
//private readonly List<SupportConceptTreeNodeDC> _Tree;
private List < ValueListEntryDC > _AllGoalCategories ;
private List < ValueListEntryDC > _AllGoals ;
private ServiceCategoryDC _Category ;
private FlatSupportConceptTreeNodeDC _ChoosenNode ;
private CompactOrganisationDC _CostBearer ;
private CompactCustomerDC _Customer ;
private bool _DeleteAllowed = true ;
2020-12-30 02:46:55 +01:00
private decimal _Duration ;
2017-01-11 11:02:58 +01:00
2016-06-27 01:45:38 +02:00
private bool _EditAllowed = true ;
private CompactEmployeeDC _Employee ;
private List < SupportConceptGoalDC > _GoalTree ;
private int? _GroupEmployeeCount ;
private long? _GroupOid ;
private long? _SignatureOid ;
private int? _GroupPersonCount ;
private decimal? _GroupRoundedDuration ;
private string _InsUser ;
private DateTime ? _InsertedOn ;
private string _Notice ;
private string _Notice2 ;
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
private string _Notice3 ;
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
private string _Notice4 ;
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
private string _Notice5 ;
2017-07-27 09:58:04 +02:00
private string _RTFNotice ;
private string _RTFNotice2 ;
private string _RTFNotice3 ;
private string _RTFNotice4 ;
private string _RTFNotice5 ;
2020-10-12 13:03:05 +02:00
private decimal? _Betrag ;
2016-06-27 01:45:38 +02:00
private decimal _RoundedDuration ;
private ObservableSortCollection < ValueListEntryDC > _SelectedGoals ;
private ServiceDescriptionDC _ServiceDescription ;
private CompactSupportConceptDC _SupportConcept ;
private ServiceRecordTypeId _ServiceRecordType = ServiceRecordTypeId . DefaultActivity ;
public List < ServiceAccountingDC > _ServiceAccountings ;
2022-11-09 09:44:24 +01:00
private decimal? _DistanceInMeter ;
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
private ZeiterfassungsDauer _DauerEinheit = ZeiterfassungsDauer . Minuten ;
2017-01-16 16:13:19 +01:00
2020-12-30 02:46:55 +01:00
private ServiceRecordFormate _ServiceRecordFormat ;
2017-01-19 17:02:07 +01:00
2017-01-16 16:13:19 +01:00
private string _OnlyMonth ;
2017-01-19 17:02:07 +01:00
private string _OnlyYear ;
2017-02-21 11:05:27 +01:00
private decimal? _DurationMonthYearGes ;
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
private DateTime ? _StartDate ;
2017-02-09 10:05:55 +01:00
2020-12-30 02:46:55 +01:00
private DateTime ? _EndDate ;
private DateTime ? _EditStartDate ;
private DateTime ? _EditEndDate ;
private string _StartTimeString ;
2017-03-15 15:16:06 +01:00
2020-12-30 02:46:55 +01:00
private string _EndTimeString ;
2024-04-25 02:15:41 +02:00
private List < SupportConceptPeriodStatisticsVM > _Statistics ;
2020-12-30 02:46:55 +01:00
private string [ ] _MonateBinden =
{
"Januar" , "Februar" , "März" , "April" , "Mai" , "Juni" , "Juli" , "August" , "September" , "Oktober" , "November" ,
"Dezember"
} ;
2017-01-11 11:02:58 +01:00
2016-06-27 01:45:38 +02:00
#endregion
#region Constructors and Destructors
public ServiceRecordVM ( )
{
2023-01-26 12:55:56 +01:00
DataContract = new ServiceRecordDC { Notice = "" } ;
_Duration = 0 ;
2016-06-27 01:45:38 +02:00
}
public ServiceRecordVM (
ServiceRecordDC pDC ,
Dictionary < ServiceCategoryDC , List < ServiceDescriptionDC > > pCategory2Services ,
List < ValueListEntryDC > pAllGoalCategories ,
List < ValueListEntryDC > pAllGoals )
: base ( pDC , pDC . ServiceRecordOid = = null )
{
2021-09-23 18:44:18 +02:00
EditAlwaysAllowed = false ;
2016-06-27 01:45:38 +02:00
_Category2Services = pCategory2Services ;
ChangeGoalTree ( pAllGoalCategories , pAllGoals ) ;
}
#endregion
#region Properties
2019-10-10 22:07:42 +02:00
public override bool IsDirty
{
2020-12-30 02:46:55 +01:00
get { return base . IsDirty | | ! SameRatingChecked ( SelectedGoals , this . DataContract . Goals ) ; }
2019-10-10 22:07:42 +02:00
}
2022-11-09 09:44:24 +01:00
public decimal? DistanceInMeter
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
get { return _DistanceInMeter ; }
2016-06-27 01:45:38 +02:00
set
{
2020-12-30 02:46:55 +01:00
if ( AreDifferent ( _DistanceInMeter , value ) )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
_DistanceInMeter = value ;
2022-11-09 09:44:24 +01:00
StoreDirtyInformation ( AreDifferent ( DataContract . DistanceInMeterDecimal , value ) ,
2020-12-30 02:46:55 +01:00
PropertyName_DistanceInMeter ) ;
FirePropertyChanged ( PropertyName_DistanceInMeter ) ;
2016-06-27 01:45:38 +02:00
}
}
}
public decimal AssistanceDuration
{
get
{
if ( GroupOid ! = null )
{
return RoundedDuration ;
}
2025-05-16 14:20:54 +02:00
//if (_Duration != null)
//{
2020-12-30 02:46:55 +01:00
return Duration ;
2025-05-16 14:20:54 +02:00
//}
2016-06-27 01:45:38 +02:00
2025-05-16 14:20:54 +02:00
//return 0;
2016-06-27 01:45:38 +02:00
}
}
2021-02-22 10:14:07 +01:00
//ALT Das kann irgendwann weg
2016-06-27 01:45:38 +02:00
public Brush BackgroundBrush
{
get
{
Brush brush = null ;
2021-02-24 11:00:38 +01:00
//if (_GroupOid != null)
//{
// brush = Application.Current.FindResource("GroupBookingBackgroundBrush") as Brush;
//}
if ( ! String . IsNullOrEmpty ( BackgroundColor ) )
2016-06-27 01:45:38 +02:00
{
2021-02-24 11:00:38 +01:00
return new SolidColorBrush ( ( Color ) System . Windows . Media . ColorConverter . ConvertFromString ( BackgroundColor ) ) ;
2016-06-27 01:45:38 +02:00
}
return brush ? ? Brushes . White ;
}
2020-12-30 02:46:55 +01:00
}
2016-06-27 01:45:38 +02:00
2021-02-22 10:14:07 +01:00
public String BackgroundColor
{
get ; set ;
}
2016-06-27 01:45:38 +02:00
public String CategoryString
{
get { return _Category ! = null ? _Category . ToString ( ) : null ; }
}
public String ServiceDescriptionString
{
get { return _ServiceDescription ! = null ? _ServiceDescription . ToString ( ) : null ; }
}
2020-12-30 02:46:55 +01:00
public List < ValueListEntryDC > AllGoalCategories
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
get { return _AllGoalCategories ; }
2016-06-27 01:45:38 +02:00
set { _AllGoalCategories = value ; }
}
2020-12-30 02:46:55 +01:00
public List < ValueListEntryDC > AllGoals
{
get { return _AllGoals ; }
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
set { _AllGoals = value ; }
}
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
public ServiceCategoryDC Category
{
get { return _Category ; }
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
set
{
if ( AreDifferent ( _Category , value ) )
{
_Category = value ;
ServiceDescription = null ;
FirePropertyChanged ( PropertyName_Category ) ;
FirePropertyChanged ( PropertyName_PossibleServiceDescriptions ) ;
}
}
}
2016-06-27 01:45:38 +02:00
public Dictionary < ServiceCategoryDC , List < ServiceDescriptionDC > > Category2Services
{
get { return _Category2Services ; }
set
{
_Category2Services = value ;
FirePropertyChanged ( PropertyName_Category2Services ) ;
2020-12-30 02:46:55 +01:00
FirePropertyChanged ( PropertyName_SortedCategories ) ;
FirePropertyChanged ( PropertyName_PossibleServiceDescriptions ) ;
2016-06-27 01:45:38 +02:00
}
}
2020-12-30 02:46:55 +01:00
public IList < ServiceCategoryDC > SortedCategories
{
get
{
2016-06-27 01:45:38 +02:00
return Category2Services ! = null ? Category2Services . Keys . OrderBy ( cat = > cat . Position ) . ToList ( ) : null ;
2020-12-30 02:46:55 +01:00
}
}
2016-06-27 01:45:38 +02:00
public FlatSupportConceptTreeNodeDC ChoosenNode
{
get { return _ChoosenNode ; }
set
{
_ChoosenNode = value ;
if ( value ! = null )
{
if ( value . SupportConceptTreeNodeDC ! = null )
{
if ( Employee = = null )
{
Employee = value . SupportConceptTreeNodeDC . Employee ;
}
2020-12-30 02:46:55 +01:00
Customer = value . SupportConceptTreeNodeDC . Customer ;
2016-06-27 01:45:38 +02:00
SupportConcept = value . SupportConceptTreeNodeDC . SupportConcept ;
2020-12-30 02:46:55 +01:00
CostBearer = value . SupportConceptTreeNodeDC . CostBearer ;
2016-06-27 01:45:38 +02:00
}
}
else
{
2020-12-30 02:46:55 +01:00
Employee = null ;
Customer = null ;
2016-06-27 01:45:38 +02:00
SupportConcept = null ;
2020-12-30 02:46:55 +01:00
CostBearer = null ;
2016-06-27 01:45:38 +02:00
}
}
}
public CompactOrganisationDC CostBearer
{
get { return _CostBearer ; }
set
{
if ( AreDifferent ( _CostBearer , value ) )
{
_CostBearer = value ;
StoreDirtyInformation ( ! AreEqual ( DataContract . CostBearer , value ) , PropertyName_CostBearer ) ;
FirePropertyChanged ( PropertyName_CostBearer ) ;
FirePropertyChanged ( PropertyName_RoundedDuration ) ;
}
}
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public CompactCustomerDC Customer
{
get { return _Customer ; }
set
{
if ( AreDifferent ( _Customer , value ) )
{
_Customer = value ;
StoreDirtyInformation ( ! AreEqual ( DataContract . Customer , value ) , PropertyName_Customer ) ;
FirePropertyChanged ( PropertyName_Customer ) ;
}
}
}
2020-12-30 02:46:55 +01:00
public DateTime StartDate
{
get
{
var date = _EditStartDate ? ? DateTime . Now . Date ;
if ( ! String . IsNullOrEmpty ( _StartTimeString ) )
{
String dtStr = String . Format ( "{0:dd.MM.yyyy} {1}" , date , _StartTimeString ) ;
DateTime dt ;
if ( DateTime . TryParse ( dtStr , out dt ) )
_StartDate = dt ;
else
_StartDate = date . Date . AddSeconds ( 1 ) ;
}
else
{
_StartDate = date . Date . AddSeconds ( 1 ) ;
}
return _StartDate . Value ;
}
}
public DateTime EndDate
{
get
{
var date = _EditEndDate ? ? DateTime . Now . Date ;
if ( ! String . IsNullOrEmpty ( _EndTimeString ) )
{
String dtStr = String . Format ( "{0:dd.MM.yyyy} {1}" , date , _EndTimeString ) ;
DateTime dt ;
if ( DateTime . TryParse ( dtStr , out dt ) )
_EndDate = dt ;
else
_EndDate = date . Date . Date . AddSeconds ( 1 ) ;
}
else
{
if ( date . Second = = 0 )
{
date = date . AddSeconds ( 1 ) ;
}
_EndDate = date ;
}
return _EndDate . Value ;
}
}
public DateTime RoundedEndDate
{
get
{
var date = StartDate ;
if ( this . GroupRoundedDuration . HasValue )
{
return date . AddMinutes ( ( double ) GroupRoundedDuration ) ;
}
return date . AddMinutes ( ( double ) RoundedDuration ) ;
}
}
public DateTime ? StartMinutes
{
get
{
if ( StartDate . Second = = 0 )
{
return StartDate ;
}
return null ;
}
}
public DateTime ? RoundedEndMinutes
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
get
{
if ( RoundedEndDate . Second = = 0 )
{
return RoundedEndDate ;
}
return null ;
}
}
public DateTime ? EditStartDate
{
get { return _EditStartDate ; }
2016-06-27 01:45:38 +02:00
set
{
2020-12-30 02:46:55 +01:00
if ( AreDifferent ( _EditStartDate , value ) )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
_EditStartDate = value ;
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
if ( _EditStartDate . HasValue )
2017-01-11 11:02:58 +01:00
{
2020-12-30 02:46:55 +01:00
var newEnddate = _EditStartDate . Value . Date ;
if ( BeWoApp . AppSettings . IsEndDateVisible | | ServiceRecordFormat = = ServiceRecordFormate . ZeiterfassungMitEndDatum )
2018-05-21 16:39:24 +02:00
{
2020-12-30 02:46:55 +01:00
if ( ! EditEndDate . HasValue | | value . Value . Date > EditEndDate . Value . Date )
2018-05-21 16:39:24 +02:00
{
2020-12-30 02:46:55 +01:00
_EditEndDate = new DateTime ( value . Value . Year , value . Value . Month , value . Value . Day , newEnddate . Hour , newEnddate . Minute , newEnddate . Second ) ;
2018-05-23 10:37:57 +02:00
2020-12-30 02:46:55 +01:00
FirePropertyChanged ( PropertyName_EditEndDate ) ;
2018-05-23 10:37:57 +02:00
}
}
2020-09-23 22:10:52 +02:00
else
{
2020-12-30 02:46:55 +01:00
_EditEndDate = _EditStartDate ;
if ( Duration > 0 )
2020-09-23 22:10:52 +02:00
{
2020-12-30 02:46:55 +01:00
if ( DauerEinheit = = ZeiterfassungsDauer . Minuten )
_EditEndDate = _EditStartDate . Value . Date . AddMinutes ( ( double ) Duration ) ;
else
_EditEndDate = _EditStartDate . Value . Date . AddHours ( ( double ) Duration ) ;
2020-09-23 22:10:52 +02:00
}
2018-05-23 10:37:57 +02:00
2020-12-30 02:46:55 +01:00
if ( String . IsNullOrEmpty ( _EndTimeString ) & & _EditEndDate . Value . Second = = 0 )
{
_EditEndDate = _EditEndDate . Value . AddSeconds ( 1 ) ;
}
FirePropertyChanged ( PropertyName_EditEndDate ) ;
2020-09-23 22:10:52 +02:00
}
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
}
StoreDirtyInformation ( ! AreEqual ( DataContract . Start , EditStartDate ) , PropertyName_EditStartDate ) ;
FirePropertyChanged ( PropertyName_EditStartDate ) ;
UpdateDurationAfterDateChange ( ) ;
}
}
}
public DateTime ? EditEndDate
{
get { return _EditEndDate ; }
set
{
if ( AreDifferent ( _EditEndDate , value ) )
{
_EditEndDate = value ;
if ( BeWoApp . AppSettings . IsEndDateVisible | |
ServiceRecordFormat = = ServiceRecordFormate . ZeiterfassungMitEndDatum )
{
if ( _EditEndDate . HasValue )
2017-01-11 11:02:58 +01:00
{
2020-12-30 02:46:55 +01:00
var newStartdate = _EditEndDate . Value . Date ;
if ( EditStartDate . HasValue )
{
newStartdate = EditStartDate . Value ;
}
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
if ( ! EditStartDate . HasValue | | value . Value . Date < EditStartDate . Value . Date )
{
_EditStartDate = new DateTime ( value . Value . Year , value . Value . Month , value . Value . Day ,
newStartdate . Hour , newStartdate . Minute , newStartdate . Second ) ;
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
FirePropertyChanged ( PropertyName_EditStartDate ) ;
}
}
2017-01-24 13:43:59 +01:00
}
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
StoreDirtyInformation ( ! AreEqual ( DataContract . End , EditEndDate ) , PropertyName_EditEndDate ) ;
FirePropertyChanged ( PropertyName_EditEndDate ) ;
UpdateDurationAfterDateChange ( ) ;
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
}
}
2020-12-30 02:46:55 +01:00
public String StartTimeString
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
get { return _StartTimeString ; }
set
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
String newTime = value ;
//if (!String.IsNullOrEmpty(newTime) && String.IsNullOrEmpty(EndTimeString))
//{
// _StartTimeString = newTime;
// FirePropertyChanged(PropertyName_StartTimeString);
// return;
//}
2016-06-27 01:45:38 +02:00
2017-03-15 15:16:06 +01:00
2020-12-30 02:46:55 +01:00
if ( ! String . IsNullOrEmpty ( newTime ) )
{
var dtStr = String . Format ( "{0:dd.MM.yyyy} {1}" , DateTime . Now . Date , newTime ) ;
DateTime dt ;
if ( DateTime . TryParse ( dtStr , out dt ) )
{
newTime = String . Format ( "{0:HH:mm}" , dt ) ;
}
}
2017-03-15 15:16:06 +01:00
2020-12-30 02:46:55 +01:00
if ( AreDifferent ( _StartTimeString , newTime ) )
{
_StartTimeString = newTime ;
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
StoreDirtyInformation ( ! AreEqual ( String . Format ( "{0:HH:mm}" , DataContract . Start ) , value ) , PropertyName_StartTimeString ) ;
FirePropertyChanged ( PropertyName_StartTimeString ) ;
CheckEndDateAfterStartDateChange ( ) ;
UpdateDurationAfterDateChange ( ) ;
2017-03-15 15:38:21 +01:00
}
2020-12-30 02:46:55 +01:00
2017-03-15 15:38:21 +01:00
2016-06-27 01:45:38 +02:00
}
}
2020-12-30 02:46:55 +01:00
private void CheckEndDateAfterStartDateChange ( )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
if ( ! String . IsNullOrEmpty ( StartTimeString ) & & String . IsNullOrEmpty ( EndTimeString ) )
{
var endTimeString = StartTimeString ;
if ( Duration > 0 )
{
UpdateEndTimeStringAfterDurationChange ( ) ;
//var dtStr = String.Format("{0:dd.MM.yyyy} {1}", DateTime.Now.Date, endTimeString);
//DateTime dt;
//if (DateTime.TryParse(dtStr, out dt))
//{
// endTimeString = String.Format("{0:HH:mm}", dt);
//}
}
else
{
EndTimeString = endTimeString ;
}
}
else if ( ! String . IsNullOrEmpty ( StartTimeString ) & & ! String . IsNullOrEmpty ( EndTimeString ) )
{
if ( StartDate > EndDate )
{
EndTimeString = StartTimeString ;
EditEndDate = EditStartDate ;
}
}
else if ( String . IsNullOrEmpty ( StartTimeString ) & & ! String . IsNullOrEmpty ( EndTimeString ) )
{
_EndTimeString = "" ;
if ( DauerEinheit = = ZeiterfassungsDauer . Minuten )
EditEndDate = StartDate . Date . AddMinutes ( ( double ) Duration ) . AddSeconds ( 1 ) ;
else
EditEndDate = StartDate . Date . AddHours ( ( double ) Duration ) . AddSeconds ( 1 ) ;
FirePropertyChanged ( PropertyName_EndTimeString ) ;
}
else if ( String . IsNullOrEmpty ( StartTimeString ) & & String . IsNullOrEmpty ( EndTimeString ) )
{
if ( DauerEinheit = = ZeiterfassungsDauer . Minuten )
EditEndDate = StartDate . Date . AddMinutes ( ( double ) Duration ) . AddSeconds ( 1 ) ;
else
EditEndDate = StartDate . Date . AddHours ( ( double ) Duration ) . AddSeconds ( 1 ) ;
}
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
public String EndTimeString
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
get { return _EndTimeString ; }
set
{
String newTime = value ;
if ( String . IsNullOrEmpty ( newTime ) & & ! String . IsNullOrEmpty ( StartTimeString ) )
{
_EndTimeString = newTime ;
FirePropertyChanged ( PropertyName_EndTimeString ) ;
return ;
}
if ( ! String . IsNullOrEmpty ( newTime ) )
{
var dtStr = String . Format ( "{0:dd.MM.yyyy} {1}" , DateTime . Now . Date , newTime ) ;
DateTime dt ;
if ( DateTime . TryParse ( dtStr , out dt ) )
{
newTime = String . Format ( "{0:HH:mm}" , dt ) ;
}
}
if ( AreDifferent ( _EndTimeString , newTime ) )
{
_EndTimeString = newTime ;
StoreDirtyInformation ( ! AreEqual ( String . Format ( "{0:HH:mm}" , DataContract . End ) , value ) , PropertyName_EndTimeString ) ;
FirePropertyChanged ( PropertyName_EndTimeString ) ;
CheckStartDateAfterEndDateChange ( ) ;
UpdateDurationAfterDateChange ( ) ;
UpdateEndDateWithDuration ( ) ;
}
}
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
private void CheckStartDateAfterEndDateChange ( )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
if ( ! String . IsNullOrEmpty ( EndTimeString ) & & String . IsNullOrEmpty ( StartTimeString ) )
{
StartTimeString = EndTimeString ;
}
else if ( ! String . IsNullOrEmpty ( StartTimeString ) & & ! String . IsNullOrEmpty ( EndTimeString ) )
{
if ( StartDate > EndDate )
{
StartTimeString = EndTimeString ;
EditEndDate = EditStartDate ;
}
}
else if ( ! String . IsNullOrEmpty ( StartTimeString ) & & String . IsNullOrEmpty ( EndTimeString ) )
{
//_StartTimeString = "";
UpdateEndDateWithDuration ( ) ;
FirePropertyChanged ( PropertyName_StartTimeString ) ;
}
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
private void UpdateEndDateWithDuration ( )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
DateTime newEndDate = DateTime . MinValue ;
if ( Duration > 0 )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
if ( String . IsNullOrEmpty ( StartTimeString ) )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
newEndDate = StartDate . Date ;
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
else
{
newEndDate = StartDate ;
2017-01-11 11:02:58 +01:00
}
2020-12-30 02:46:55 +01:00
if ( DauerEinheit = = ZeiterfassungsDauer . Minuten )
newEndDate = newEndDate . AddMinutes ( ( double ) Duration ) ;
2017-01-11 11:02:58 +01:00
else
2020-12-30 02:46:55 +01:00
newEndDate = newEndDate . AddHours ( ( double ) Duration ) ;
if ( String . IsNullOrEmpty ( _EndTimeString ) & & newEndDate . Second = = 0 )
2017-01-11 11:02:58 +01:00
{
2020-12-30 02:46:55 +01:00
newEndDate = newEndDate . AddSeconds ( 1 ) ;
2017-01-11 11:02:58 +01:00
}
2020-12-30 02:46:55 +01:00
EditEndDate = newEndDate ;
2017-01-11 11:02:58 +01:00
}
2020-12-30 02:46:55 +01:00
else
2017-01-11 11:02:58 +01:00
{
2020-12-30 02:46:55 +01:00
EditEndDate = EditStartDate ;
}
}
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
private void UpdateDurationAfterDateChange ( )
{
var x = EndDate . Subtract ( StartDate ) ;
decimal newDuration = 0 ;
if ( DauerEinheit = = ZeiterfassungsDauer . Minuten )
{
newDuration = ( decimal ) x . TotalMinutes ;
}
else
{
newDuration = ( decimal ) x . TotalHours ;
}
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
if ( _Duration ! = newDuration )
{
_Duration = newDuration ;
FirePropertyChanged ( PropertyName_Duration ) ;
}
}
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
private void UpdateEndTimeStringAfterDurationChange ( )
{
var date = StartDate ;
if ( DauerEinheit = = ZeiterfassungsDauer . Minuten )
_EditEndDate = date . AddMinutes ( ( double ) _Duration ) ;
else
_EditEndDate = date . AddHours ( ( double ) _Duration ) ;
FirePropertyChanged ( PropertyName_EditEndDate ) ;
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
if ( ! String . IsNullOrEmpty ( EndTimeString ) | | StartDate . Second = = 0 )
{
_EndTimeString = String . Format ( "{0:HH:mm}" , _EditEndDate ) ;
FirePropertyChanged ( PropertyName_EndTimeString ) ;
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
}
public String Id
{
get { return String . Format ( "{0}" , DataContract . ServiceRecordOid ) ; }
}
2020-12-30 02:46:55 +01:00
[Validation(ValidationRule = ValidationRules.GreaterThanOrEqualZero)]
public decimal Duration
2016-06-27 01:45:38 +02:00
{
2017-01-11 11:02:58 +01:00
get
{
2020-12-30 02:46:55 +01:00
return _Duration ;
2017-01-24 13:43:59 +01:00
}
2017-01-11 11:02:58 +01:00
2017-01-24 13:43:59 +01:00
set
2020-12-30 02:46:55 +01:00
{
2017-01-24 13:43:59 +01:00
if ( AreDifferent ( _Duration , value ) )
2017-01-11 11:02:58 +01:00
{
2017-01-16 16:13:19 +01:00
_Duration = value ;
2017-01-31 07:15:00 +01:00
2020-12-30 02:46:55 +01:00
UpdateEndTimeStringAfterDurationChange ( ) ;
StoreDirtyInformation ( ! AreEqual ( String . Format ( "{0:HH:mm}" , DataContract . End ) , EndTimeString ) , PropertyName_EndTimeString ) ;
FirePropertyChanged ( PropertyName_Duration ) ;
2016-06-27 01:45:38 +02:00
FirePropertyChanged ( PropertyName_RoundedDuration ) ;
2020-12-30 02:46:55 +01:00
}
2016-06-27 01:45:38 +02:00
}
}
2017-01-11 11:02:58 +01:00
2016-06-27 01:45:38 +02:00
public string DurationAndRoundedDuration
{
get
{
var rd = BeWoWpfUtils . GetDecimalValueWithMaxDecimal ( RoundedDuration , 2 ) ;
if ( Category ! = null & & Category . Percentage > 0 & & Category . Percentage < 100 )
{
2018-04-18 14:33:21 +02:00
rd = rd * Category . Percentage / 100 ;
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
2018-05-21 16:39:24 +02:00
//if(_ServiceRecordFormat == ServiceRecordFormate.ZeiterfassungMitEndDatum) {
2017-02-01 09:24:33 +01:00
2018-05-21 16:39:24 +02:00
// var strResult = _GroupOid != null ? string.Format("{0} ({0})", rd) : $"{DurationSTD} ({rd})";
2017-02-01 09:24:33 +01:00
2018-05-21 16:39:24 +02:00
// return strResult;
//}
2020-12-30 02:46:55 +01:00
2018-04-18 14:33:21 +02:00
if ( _ServiceRecordFormat = = ServiceRecordFormate . ZeiterfassungMitMonatJahr )
2017-01-31 07:15:00 +01:00
{
2020-12-30 02:46:55 +01:00
var strResult = _GroupOid ! = null
? string . Format ( "{0:0.##} ({0:0.##})" , rd )
: $"{DurationMonthYearGes} ({rd})" ;
2017-01-31 07:15:00 +01:00
2017-02-01 09:24:33 +01:00
return strResult ;
}
2020-12-30 02:46:55 +01:00
if ( DauerEinheit = = ZeiterfassungsDauer . Stunden )
2017-02-01 09:24:33 +01:00
{
2020-12-30 02:46:55 +01:00
return _GroupOid ! = null
? string . Format ( "{0:0.##} ({0:0.##})" , rd / 60 )
: $"{Duration:0.##} ({rd / 60:0.##})" ;
2017-02-01 09:24:33 +01:00
}
2017-01-31 07:15:00 +01:00
2018-04-18 14:33:21 +02:00
return _GroupOid ! = null ? $"{rd} ({rd})" : $"{Duration} ({rd})" ;
2016-06-27 01:45:38 +02:00
}
}
2020-12-30 02:46:55 +01:00
2021-09-23 18:44:18 +02:00
public bool EditAlwaysAllowed { get ; set ; }
2016-06-27 01:45:38 +02:00
public bool EditAllowed
{
get
{
2021-09-23 18:44:18 +02:00
if ( EditAlwaysAllowed )
{
return true ;
}
2016-06-27 01:45:38 +02:00
var allowed = false ;
if ( BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecordView_Edit ) )
{
allowed = true ;
}
else if ( BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowChangeWithin24Hours ) )
{
if ( _InsertedOn ! = null )
{
2022-01-17 19:04:46 +01:00
if ( DateTime . Now < _InsertedOn . Value . AddHours ( BeWoApp . AppSettings . ServiceRecordAllowChangeHours ) )
2016-06-27 01:45:38 +02:00
{
allowed = true ;
}
}
}
if ( allowed & & BeWoApp . AppSettings . MaxDaysEditServiceRecordsAllowed > 0 )
{
if ( ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowEditAfterMaxDaysInNextMonth ) )
{
2020-12-30 02:46:55 +01:00
var dt = new DateTime ( StartDate . Year , StartDate . Month , 1 ) ;
dt = dt . AddMonths ( 1 ) ;
dt = dt . AddDays ( BeWoApp . AppSettings . MaxDaysEditServiceRecordsAllowed ) ;
if ( DateTime . Now > = dt )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
allowed = false ;
2016-06-27 01:45:38 +02:00
}
}
}
2020-12-30 02:46:55 +01:00
if ( allowed & & ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowEditForOtherEmployees ) )
{
2016-06-27 01:45:38 +02:00
if ( BeWoApp . LoggedOnEmployee . EmployeeOid ! = Employee . EmployeeOid )
2020-12-30 02:46:55 +01:00
allowed = false ;
}
if ( allowed & & GroupOid . HasValue )
{
if ( ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowCreatingGroupBooking ) )
{
allowed = false ;
}
}
2025-10-24 01:52:15 +02:00
if ( allowed & & BeWoApp . AppSettings . AnzTageZeiterfassErfolgt > 0 & & this . SupportConcept ! = null )
2020-12-30 02:46:55 +01:00
{
if ( ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecordAllowEditAfterMindays ) )
{
var dt = new DateTime ( StartDate . Year , StartDate . Month , StartDate . Day ) ;
dt = dt . AddDays ( BeWoApp . AppSettings . AnzTageZeiterfassErfolgt + 1 ) ;
if ( DateTime . Now > = dt )
{
allowed = false ;
}
}
}
2016-06-27 01:45:38 +02:00
return _EditAllowed & & allowed ;
}
set { _EditAllowed = value ; }
}
public bool DeleteAllowed
{
get
{
var allowed = false ;
if ( BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecordView_Delete ) )
{
allowed = true ;
}
else if ( BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowChangeWithin24Hours ) )
{
if ( _InsertedOn ! = null )
{
2022-01-17 19:04:46 +01:00
if ( DateTime . Now < _InsertedOn . Value . AddHours ( BeWoApp . AppSettings . ServiceRecordAllowChangeHours ) )
2016-06-27 01:45:38 +02:00
{
allowed = true ;
}
}
}
if ( allowed & & BeWoApp . AppSettings . MaxDaysEditServiceRecordsAllowed > 0 )
{
if ( ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowEditAfterMaxDaysInNextMonth ) )
{
2020-12-30 02:46:55 +01:00
if ( StartDate ! = null )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
var dt = new DateTime ( StartDate . Year , StartDate . Month , 1 ) ;
2016-06-27 01:45:38 +02:00
dt = dt . AddMonths ( 1 ) ;
dt = dt . AddDays ( BeWoApp . AppSettings . MaxDaysEditServiceRecordsAllowed ) ;
if ( DateTime . Now > = dt )
{
allowed = false ;
}
}
}
}
2020-12-30 02:46:55 +01:00
if ( allowed & & BeWoApp . AppSettings . AnzTageZeiterfassErfolgt > 0 )
{
if ( ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecordAllowEditAfterMindays ) )
{
if ( StartDate ! = null )
{
var dt = new DateTime ( StartDate . Year , StartDate . Month , StartDate . Day ) ;
dt = dt . AddDays ( BeWoApp . AppSettings . AnzTageZeiterfassErfolgt + 1 ) ;
if ( DateTime . Now > = dt )
{
allowed = false ;
}
}
}
}
if ( allowed & & ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowEditForOtherEmployees ) )
{
2016-06-27 01:45:38 +02:00
if ( BeWoApp . LoggedOnEmployee . EmployeeOid ! = Employee . EmployeeOid )
2020-12-30 02:46:55 +01:00
allowed = false ;
}
if ( allowed & & GroupOid . HasValue )
{
if ( ! BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_AllowCreatingGroupBooking ) )
{
allowed = false ;
}
}
2016-06-27 01:45:38 +02:00
return _DeleteAllowed & & allowed ;
}
set { _DeleteAllowed = value ; }
}
public static bool IsHistoryAllowed
2020-12-30 02:46:55 +01:00
{
2016-06-27 01:45:38 +02:00
get { return BeWoApp . LoggedOnUser . HasRight ( UserRightType . ServiceRecord_ShowHistory ) ; }
2020-12-30 02:46:55 +01:00
}
2016-06-27 01:45:38 +02:00
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public CompactEmployeeDC Employee
{
get { return _Employee ; }
set
{
if ( AreDifferent ( _Employee , value ) )
{
_Employee = value ;
StoreDirtyInformation ( ! AreEqual ( DataContract . Employee , value ) , PropertyName_Employee ) ;
FirePropertyChanged ( PropertyName_Employee ) ;
}
}
}
public string EmployeeName
2020-12-30 02:46:55 +01:00
{
get
{
if ( _Employee ! = null )
{
return _Employee . FirstName + " " + _Employee . LastName ;
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
return string . Empty ;
2016-06-27 01:45:38 +02:00
}
}
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
public List < SupportConceptGoalDC > GoalTree
{
get { return _GoalTree ; }
set
{
_GoalTree = value ;
FirePropertyChanged ( PropertyName_GoalTree ) ;
FirePropertyChanged ( PropertyName_IsGoalTreeVisible ) ;
}
}
public int? GroupEmployeeCount
{
get { return _GroupEmployeeCount ; }
set
{
if ( AreDifferent ( _GroupEmployeeCount , value ) )
{
_GroupEmployeeCount = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . GroupEmployeeCount , value ) , PropertyName_GroupEmployeeCount ) ;
FirePropertyChanged ( PropertyName_GroupEmployeeCount ) ;
}
}
}
public long? GroupOid
{
get { return _GroupOid ; }
set { _GroupOid = value ; }
}
public long? SignatureOid
{
get { return _SignatureOid ; }
set { _SignatureOid = value ; }
}
2020-12-30 02:46:55 +01:00
public ImageSource HatUnterschriftImage
2017-02-09 10:05:55 +01:00
{
get
{
if ( _SignatureOid ! = null ) {
2017-04-03 13:39:11 +02:00
2017-11-23 10:58:07 +01:00
if ( haekchenBitmapImage = = null )
2017-04-03 13:39:11 +02:00
{
2017-11-23 10:58:07 +01:00
haekchenBitmapImage = CreateImage ( "pack://application:,,,/BeWoPlaner;component/Ressources/Icons/Haeckchen.png" ) ;
2017-04-03 13:39:11 +02:00
}
2017-11-23 10:58:07 +01:00
return haekchenBitmapImage ;
2017-02-09 10:05:55 +01:00
}
else
{
2017-04-03 13:39:11 +02:00
return null ;
2017-02-09 10:05:55 +01:00
}
}
}
2017-04-03 13:39:11 +02:00
private BitmapImage CreateImage ( String path )
{
BitmapImage bix = new BitmapImage ( ) ;
bix . BeginInit ( ) ;
bix . CreateOptions = BitmapCreateOptions . PreservePixelFormat ;
bix . CacheOption = BitmapCacheOption . OnLoad ;
2017-11-23 10:58:07 +01:00
bix . UriSource = new Uri ( path ) ;
2017-04-03 13:39:11 +02:00
bix . EndInit ( ) ;
return bix ;
}
2016-06-27 01:45:38 +02:00
public int? GroupPersonCount
{
get { return _GroupPersonCount ; }
set
{
if ( AreDifferent ( _GroupPersonCount , value ) )
{
_GroupPersonCount = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . GroupPersonCount , value ) , PropertyName_GroupPersonCount ) ;
FirePropertyChanged ( PropertyName_GroupPersonCount ) ;
}
}
}
public decimal? GroupRoundedDuration
{
get { return _GroupRoundedDuration ; }
set
{
if ( AreDifferent ( _GroupRoundedDuration , value ) )
{
_GroupRoundedDuration = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . GroupRoundedDuration , value ) , PropertyName_GroupRoundedDuration ) ;
FirePropertyChanged ( PropertyName_GroupRoundedDuration ) ;
}
}
}
public int Index { get ; set ; }
public string InsUser
{
get { return _InsUser ; }
set { _InsUser = value ; }
}
public string InsertedOn
{
get
{
if ( _InsertedOn ! = null )
{
return _InsertedOn . Value . ToShortDateString ( ) + " " + _InsertedOn . Value . ToShortTimeString ( ) ;
}
return null ;
}
}
2019-07-12 17:36:37 +02:00
public DateTime ? InsertedOnDateTime
{
get { return _InsertedOn ; }
}
2016-06-27 01:45:38 +02:00
public bool IsGoalTreeVisible
{
get { return _GoalTree ! = null & & _GoalTree . Count > 0 ; }
}
public string LongDateString
{
get
{
var date = string . Empty ;
2017-02-01 09:24:33 +01:00
2016-06-27 01:45:38 +02:00
string time = string . Empty ;
2017-01-26 09:56:57 +01:00
string endtime = string . Empty ;
2020-12-30 02:46:55 +01:00
var timeDt = StartDate ;
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
if ( timeDt . Second = = 0 )
{
time = timeDt . ToShortTimeString ( ) ;
2017-03-09 12:39:57 +01:00
2020-12-30 02:46:55 +01:00
if ( DauerEinheit = = ZeiterfassungsDauer . Stunden )
{
if ( GroupOid ! = null & & GroupRoundedDuration ! = null )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
timeDt = timeDt . AddMinutes ( ( double ) GroupRoundedDuration ) ;
2016-06-27 01:45:38 +02:00
}
else
{
2020-12-30 02:46:55 +01:00
timeDt = timeDt . AddMinutes ( ( double ) RoundedDuration ) ;
}
}
else
{
if ( GroupOid ! = null & & GroupRoundedDuration ! = null )
{
timeDt = timeDt . AddMinutes ( ( double ) GroupRoundedDuration ) ;
}
else
{
timeDt = timeDt . AddMinutes ( ( double ) RoundedDuration ) ;
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
}
2017-03-09 12:39:57 +01:00
2020-12-30 02:46:55 +01:00
endtime = timeDt . ToShortTimeString ( ) ;
2017-01-26 09:56:57 +01:00
2020-12-30 02:46:55 +01:00
//time = time + " - " + timeDt.ToShortTimeString();
2017-01-26 09:56:57 +01:00
}
2020-12-30 02:46:55 +01:00
if ( endtime . Equals ( "" ) & & time . Equals ( "" ) )
2017-01-26 09:56:57 +01:00
{
2020-12-30 02:46:55 +01:00
date = DateTimeFormatInfo . CurrentInfo . GetAbbreviatedDayName ( StartDate . DayOfWeek ) + ", " + StartDate . ToShortDateString ( ) ;
}
else {
if ( EndDate . Date ! = StartDate . Date )
{
time = StartDate . TimeOfDay . ToString ( ) ;
endtime = EndDate . TimeOfDay . ToString ( ) ;
2017-01-26 09:56:57 +01:00
2020-12-30 02:46:55 +01:00
date = DateTimeFormatInfo . CurrentInfo . GetAbbreviatedDayName ( StartDate . DayOfWeek ) + ", " + StartDate . ToShortDateString ( ) + " " + time + " - " + EndDate . ToShortDateString ( ) + " " + endtime ;
}
else
2017-01-26 09:56:57 +01:00
{
2020-12-30 02:46:55 +01:00
time = time + " - " + endtime ;
date = DateTimeFormatInfo . CurrentInfo . GetAbbreviatedDayName ( StartDate . DayOfWeek ) + ", " + StartDate . ToShortDateString ( ) + " " + time ;
2016-06-27 01:45:38 +02:00
}
2017-03-15 15:16:06 +01:00
2020-12-30 02:46:55 +01:00
}
2016-06-27 01:45:38 +02:00
2017-01-26 09:56:57 +01:00
//date += " " + time;
2016-06-27 01:45:38 +02:00
if ( GroupOid ! = null & & GroupPersonCount ! = null & & GroupRoundedDuration ! = null )
{
2020-12-30 02:46:55 +01:00
if ( DauerEinheit = = ZeiterfassungsDauer . Stunden )
2018-05-23 10:37:57 +02:00
{
date + = " Gruppe (" + GroupPersonCount . Value + " Teilnehmer, " + GroupEmployeeCount . Value +
" Betreuer). Dauer: " +
BeWoWpfUtils . GetDecimalValueWithMaxDecimal ( GroupRoundedDuration . Value / 60 , 2 ) + " Stunden." ;
}
else
{
date + = " Gruppe (" + GroupPersonCount . Value + " Teilnehmer, " + GroupEmployeeCount . Value +
" Betreuer). Dauer: " +
BeWoWpfUtils . GetDecimalValueWithMaxDecimal ( GroupRoundedDuration . Value , 2 ) + " Minuten." ;
}
2016-06-27 01:45:38 +02:00
}
return date ;
}
}
public Brush MouseOverBackgroundBrush
{
get
{
Brush brush = null ;
if ( _GroupOid ! = null )
{
brush = Application . Current . FindResource ( "GroupBookingMouseOverBackgroundBrush" ) as Brush ;
}
return brush ? ? new SolidColorBrush ( Color . FromArgb ( 0xFF , 0xCC , 0xE0 , 0xFF ) ) ;
}
}
2026-07-30 14:17:47 +02:00
// Claude: Klientenbezug fuer die Dokumentationspflicht beim Bearbeiten eines bestehenden
// Eintrags (ServiceRecordEditView / ServiceRecordGroupEditView binden direkt an dieses VM).
// Beim Laden aus dem DataContract ist Customer gesetzt, wenn der Eintrag zu einem
// Klienten gehoert - kundenlose Eintraege haben Customer == null.
// Achtung: Am PrototypeVM der Neuerfassung ist Customer immer null; dort liefert
// ServiceRecordListVM.IsCustomerRelated den Kontext (DataItem hat im AttributeValidator
// Vorrang), weil der Kunde erst nach der Validierung an den Klon geschrieben wird.
public bool IsCustomerRelated
{
get { return Customer ! = null ; }
}
2016-06-27 01:45:38 +02:00
[Validation(ValidationRule = ValidationRules.EmptyNoticeInNewServiceRecordsAllowed)]
public string Notice
{
get { return _Notice ; }
set
{
if ( AreDifferent ( _Notice , value ) )
{
_Notice = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . Notice , value ) , PropertyName_Notice ) ;
FirePropertyChanged ( PropertyName_Notice ) ;
}
}
}
public string Notice2
{
get { return _Notice2 ; }
set
{
if ( AreDifferent ( _Notice2 , value ) )
{
_Notice2 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . Notice2 , value ) , PropertyName_Notice2 ) ;
FirePropertyChanged ( PropertyName_Notice2 ) ;
}
}
}
public string Notice3
{
get { return _Notice3 ; }
set
{
if ( AreDifferent ( _Notice3 , value ) )
{
_Notice3 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . Notice3 , value ) , PropertyName_Notice3 ) ;
FirePropertyChanged ( PropertyName_Notice3 ) ;
}
}
}
public string Notice4
{
get { return _Notice4 ; }
set
{
if ( AreDifferent ( _Notice4 , value ) )
{
_Notice4 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . Notice4 , value ) , PropertyName_Notice4 ) ;
FirePropertyChanged ( PropertyName_Notice4 ) ;
}
}
}
public string Notice5
{
get { return _Notice5 ; }
set
{
if ( AreDifferent ( _Notice5 , value ) )
{
_Notice5 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . Notice5 , value ) , PropertyName_Notice5 ) ;
FirePropertyChanged ( PropertyName_Notice5 ) ;
}
}
}
2024-06-24 16:30:36 +02:00
public string DocField1 { get ; set ; }
public string DocField2 { get ; set ; }
public string DocField3 { get ; set ; }
public string DocField4 { get ; set ; }
public string DocField5 { get ; set ; }
public string AllNotices
{
get
{
if ( String . IsNullOrEmpty ( DocField2 ) ) // Nur ein Dokufeld vorhanden
{
return Notice ;
}
String all = "" ;
if ( ! String . IsNullOrEmpty ( Notice ) )
{
all = String . Format ( "{0}:\n{1}" , DocField1 , Notice ) ;
}
if ( ! String . IsNullOrEmpty ( Notice2 ) )
{
if ( all . Length > 0 )
{
all + = "\n\n" ;
}
all + = String . Format ( "{0}:\n{1}" , DocField2 , Notice2 ) ;
}
if ( ! String . IsNullOrEmpty ( Notice3 ) )
{
if ( all . Length > 0 )
{
all + = "\n\n" ;
}
all + = String . Format ( "{0}:\n{1}" , DocField3 , Notice3 ) ;
}
if ( ! String . IsNullOrEmpty ( Notice4 ) )
{
if ( all . Length > 0 )
{
all + = "\n\n" ;
}
all + = String . Format ( "{0}:\n{1}" , DocField4 , Notice4 ) ;
}
if ( ! String . IsNullOrEmpty ( Notice5 ) )
{
if ( all . Length > 0 )
{
all + = "\n\n" ;
}
all + = String . Format ( "{0}:\n{1}" , DocField5 , Notice5 ) ;
}
return all ;
}
set { }
}
2017-07-27 09:58:04 +02:00
public string RTFNotice
{
get { return _RTFNotice ; }
set
{
if ( AreDifferent ( _RTFNotice , value ) )
{
_RTFNotice = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . RTFNotice1 , value ) , PropertyName_RTFNotice ) ;
FirePropertyChanged ( PropertyName_RTFNotice ) ;
}
}
}
public string RTFNotice2
{
get { return _RTFNotice2 ; }
set
{
if ( AreDifferent ( _RTFNotice2 , value ) )
{
_RTFNotice2 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . RTFNotice2 , value ) , PropertyName_RTFNotice2 ) ;
FirePropertyChanged ( PropertyName_RTFNotice2 ) ;
}
}
}
public string RTFNotice3
{
get { return _RTFNotice3 ; }
set
{
if ( AreDifferent ( _RTFNotice3 , value ) )
{
_RTFNotice3 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . RTFNotice3 , value ) , PropertyName_RTFNotice3 ) ;
FirePropertyChanged ( PropertyName_RTFNotice3 ) ;
}
}
}
public string RTFNotice4
{
get { return _RTFNotice4 ; }
set
{
if ( AreDifferent ( _RTFNotice4 , value ) )
{
_RTFNotice4 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . RTFNotice4 , value ) , PropertyName_RTFNotice4 ) ;
FirePropertyChanged ( PropertyName_RTFNotice4 ) ;
}
}
}
public string RTFNotice5
{
get { return _RTFNotice5 ; }
set
{
if ( AreDifferent ( _RTFNotice5 , value ) )
{
_RTFNotice5 = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . RTFNotice5 , value ) , PropertyName_RTFNotice5 ) ;
FirePropertyChanged ( PropertyName_RTFNotice5 ) ;
}
}
}
2016-06-27 01:45:38 +02:00
public List < ServiceDescriptionDC > PossibleServiceDescriptions
{
get
{
if ( _Category = = null )
{
return null ;
}
return _Category2Services . ContainsKey ( _Category ) ? _Category2Services [ _Category ] : null ;
}
}
2017-03-08 13:05:45 +01:00
public decimal RoundedDurationAnzeige
{
get
{
2020-12-30 02:46:55 +01:00
if ( _ServiceRecordFormat = = ServiceRecordFormate . ZeiterfassungMitMonatJahr | | DauerEinheit = = ZeiterfassungsDauer . Stunden )
2017-03-08 13:05:45 +01:00
{
return _RoundedDuration / 60 ;
}
else
{
return _RoundedDuration ;
}
}
}
2016-06-27 01:45:38 +02:00
public decimal RoundedDuration
{
get { return _RoundedDuration ; }
set { _RoundedDuration = value ; }
2020-10-12 13:03:05 +02:00
}
public decimal? Betrag
{
get { return _Betrag ; }
set
{
if ( AreDifferent ( _Betrag , value ) )
{
_Betrag = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . Betrag , value ) , PropertyName_Betrag ) ;
FirePropertyChanged ( PropertyName_Betrag ) ;
}
2016-06-27 01:45:38 +02:00
}
2020-10-12 13:03:05 +02:00
}
2016-06-27 01:45:38 +02:00
public Brush SelectedBackgroundBrush
{
get
{
Brush brush = null ;
if ( _GroupOid ! = null )
{
brush = Application . Current . FindResource ( "GroupBookingSelectedBackgroundBrush" ) as Brush ;
}
return brush ? ? new SolidColorBrush ( Color . FromArgb ( 0xFF , 0x93 , 0xBC , 0xFF ) ) ;
}
}
public bool HasGoals
{
get { return SelectedGoals . Count > 0 ; }
}
public String GoalString
{
get
{
var goals = "" ;
foreach ( var goal in SelectedGoals )
{
if ( goals . Length > 0 )
goals + = ", " ;
2019-10-10 22:07:42 +02:00
goals + = CreateGoalString ( goal ) ;
2016-06-27 01:45:38 +02:00
}
return goals ;
}
}
2020-09-23 22:10:52 +02:00
public String OnlyGoalString
{
get
{
2024-06-07 14:34:27 +02:00
//CB: Ich muss das hier so kompliziert machen, weil ich eine unsortierte Liste von Zielen und Maßnahmen in ein sortierte Liste innerhalb der Ziele/Maßnahmen Baumstruktur überführen muss
2020-09-23 22:10:52 +02:00
var goals = new List < ValueListEntryDC > ( ) ;
2024-06-07 14:34:27 +02:00
var firstLevelGoals = new List < ValueListEntryDC > ( ) ;
Dictionary < long , ValueListEntryDC > oid2Entry = new Dictionary < long , ValueListEntryDC > ( ) ;
Dictionary < long , List < ValueListEntryDC > > oid2ChildList = new Dictionary < long , List < ValueListEntryDC > > ( ) ;
2020-09-23 22:10:52 +02:00
foreach ( var goal in SelectedGoals )
{
if ( goal . Type = = ValueListEntryType . SupportConceptGoalCategoryType | | goal . Type = = ValueListEntryType . SupportConceptIndividualGoalCategoryType )
{
if ( ! goals . Contains ( goal ) )
{
goals . Add ( goal ) ;
}
}
else if ( goal . ParentOid . HasValue )
{
var parent = Cache . GetInstance ( ) . GetGoalEntry ( goal . ParentOid . Value ) ;
if ( parent ! = null & & ! goals . Contains ( parent ) )
{
goals . Add ( parent ) ;
}
}
}
2024-06-07 14:34:27 +02:00
foreach ( var item in goals )
{
2024-06-19 16:13:56 +02:00
if ( item . ValueListEntryOid . HasValue & & ! oid2Entry . ContainsKey ( item . ValueListEntryOid . Value ) )
2024-06-07 14:34:27 +02:00
{
oid2Entry . Add ( item . ValueListEntryOid . Value , item ) ;
}
}
foreach ( var item in goals )
{
if ( ! item . ParentOid . HasValue | | ! oid2Entry . ContainsKey ( item . ParentOid . Value ) )
{
firstLevelGoals . Add ( item ) ;
}
if ( item . ParentOid . HasValue )
{
if ( ! oid2ChildList . ContainsKey ( item . ParentOid . Value ) )
{
oid2ChildList . Add ( item . ParentOid . Value , new List < ValueListEntryDC > ( ) ) ;
}
oid2ChildList [ item . ParentOid . Value ] . Add ( item ) ;
}
}
var sortedGoals = new List < ValueListEntryDC > ( ) ;
foreach ( var item in firstLevelGoals . OrderBy ( g = > g . DisplayName ) )
{
AddGoalWithChildren ( item , oid2ChildList , sortedGoals ) ;
}
2020-09-23 22:10:52 +02:00
var goalString = "" ;
2024-06-07 14:34:27 +02:00
foreach ( var goal in sortedGoals )
2020-09-23 22:10:52 +02:00
{
if ( goalString . Length > 0 )
goalString + = ", " ;
goalString + = CreateGoalString ( goal ) ;
}
return goalString ;
}
}
2024-06-07 14:34:27 +02:00
private void AddGoalWithChildren ( ValueListEntryDC item , Dictionary < long , List < ValueListEntryDC > > oid2ChildList , List < ValueListEntryDC > sortedGoals )
{
sortedGoals . Add ( item ) ;
if ( oid2ChildList . ContainsKey ( item . ValueListEntryOid . Value ) )
{
foreach ( var child in oid2ChildList [ item . ValueListEntryOid . Value ] . OrderBy ( g = > g . DisplayName ) )
{
AddGoalWithChildren ( child , oid2ChildList , sortedGoals ) ;
}
}
}
2020-09-23 22:10:52 +02:00
public String MassnahmenString
{
get
{
var goals = "" ;
foreach ( var goal in SelectedGoals )
{
if ( goal . Type = = ValueListEntryType . SupportConceptGoalType | | goal . Type = = ValueListEntryType . SupportConceptIndividualGoalType )
{
if ( goals . Length > 0 )
goals + = ", " ;
goals + = CreateGoalString ( goal ) ;
}
}
return goals ;
}
}
2019-10-10 22:07:42 +02:00
private string CreateGoalString ( ValueListEntryDC goal )
{
String name = goal . TypeDescription ;
2022-12-15 23:16:04 +01:00
if ( goal . CatalogOid . HasValue )
{
if ( goal . CatalogItem = = null )
{
goal . CatalogItem = Cache . GetInstance ( ) . GetValueListEntry ( ValueListEntryType . MassnahmenKatalog , goal . CatalogOid . Value ) ;
}
if ( goal . CatalogItem ! = null )
{
name = goal . CatalogItem . TypeDescription ;
}
}
2019-10-10 22:07:42 +02:00
if ( ! String . IsNullOrWhiteSpace ( goal . Abbreviation ) )
{
String code = goal . Abbreviation ;
2020-08-17 15:50:00 +02:00
if ( goal . RatingTypeOid . HasValue )
2019-10-10 22:07:42 +02:00
{
2020-09-23 22:10:52 +02:00
var rdc = Cache . GetInstance ( ) . GetAllRatingTypeList ( ) . FirstOrDefault ( r = > r . RatingTypeOid = = goal . RatingTypeOid ) ;
if ( rdc ! = null & & rdc . RatingId . HasValue )
{
code = String . Format ( "{0}.{1}" , code , rdc . RatingId . Value ) ;
}
2019-10-10 22:07:42 +02:00
}
name = String . Format ( "{0}: {1}" , code , name ) ;
}
return name ;
}
2024-06-24 16:30:36 +02:00
2016-06-27 01:45:38 +02:00
public ObservableSortCollection < ValueListEntryDC > SelectedGoals
{
get
{
return _SelectedGoals ? ? ( _SelectedGoals = new ObservableSortCollection < ValueListEntryDC > ( Comparer . ValueListEntryDCComparer ) ) ;
}
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public ServiceDescriptionDC ServiceDescription
{
get { return _ServiceDescription ; }
set
{
if ( AreDifferent ( _ServiceDescription , value ) )
{
_ServiceDescription = value ;
StoreDirtyInformation ( ! AreEqual ( DataContract . ServiceDescription , value ) , PropertyName_ServiceDescription ) ;
FirePropertyChanged ( PropertyName_ServiceDescription ) ;
}
}
}
public string ShortNotice
{
get
{
var desc = Notice ;
if ( desc . IndexOf ( "\r\n" ) > 0 )
{
desc = desc . Substring ( 0 , desc . IndexOf ( "\r\n" ) ) ;
}
return desc ;
}
}
2020-12-30 02:46:55 +01:00
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
//public DateTime? StartTime
//{
// get
// {
// if(_StartTime != null)
// return _StartTime.Value.Second != 0 ? null : _StartTime;
// else
// {
// return new DateTime();
// }
// }
2017-01-16 16:13:19 +01:00
2020-12-30 02:46:55 +01:00
// set
// {
// DateTime? newStartTime = value ?? NULL_TIME;
2016-06-27 01:45:38 +02:00
2020-12-30 02:46:55 +01:00
// Console.WriteLine("Change StartTime " + newStartTime.Value.ToShortTimeString());
// if ((_StartTime == null && newStartTime != NULL_TIME) ||
// (_StartTime != null && _StartTime.Value.TimeOfDay != newStartTime.Value.TimeOfDay))
// {
// _StartTime = newStartTime;
// if (_StartTime.Value.Second == 0)
// {
// if (_EndTime == null && Duration.HasValue)
// {
// if (_DurationInStunden == ZeiterfassungsDauer.Stunden)
// {
// _EndTime = _StartTime.Value.AddHours((int)Duration.Value);
// }
// else
// {
// _EndTime = _StartTime.Value.AddMinutes((int)Duration.Value);
// }
// }
// if (_EndTime != null)
// {
// var end = new DateTime(_StartTime.Value.Year, _StartTime.Value.Month, _StartTime.Value.Day,
// _EndTime.Value.Hour, _EndTime.Value.Minute, 0);
// if (_EndTime.Value.Second > 0 && Duration.HasValue)
// {
// end = new DateTime(_StartTime.Value.Year, _StartTime.Value.Month, _StartTime.Value.Day,
// _StartTime.Value.Hour, _StartTime.Value.Minute, 0);
// if (_DurationInStunden == ZeiterfassungsDauer.Stunden)
// {
// end = end.AddHours((int)Duration.Value);
// }
// else
// {
// end = end.AddMinutes((int)Duration.Value);
// }
// }
// var diff = end.Subtract(_StartTime.Value);
// if (diff.TotalSeconds < 0)
// {
// EndTime = _StartTime;
// end = EndTime.Value;
// }
// diff = end.Subtract(_StartTime.Value);
// if (BeWoApp.AppSettings.IsEndDateVisible && ServiceRecordFormat == null || ServiceRecordFormat == ServiceRecordFormate.ZeiterfassungMitEndDatum)
// {
// EditableEndDate = end;
// }
// if (_DurationInStunden == ZeiterfassungsDauer.Stunden)
// {
// Duration = (decimal) diff.TotalHours;
// }
// else
// {
// Duration = (decimal)diff.TotalMinutes;
// }
// FirePropertyChanged(PropertyName_Duration);
// TimeCheck();
// }
// //else
// //{
// // if (BeWoApp.AppSettings.IsEndDateVisible)
// // {
// // if (_DurationInStunden == ZeiterfassungsDauer.Stunden)
// // {
// // EndTime = _StartTime.Value.AddHours(DurationSTD.Value);
// // }else{
// // EndTime = _StartTime.Value.AddMinutes(DurationSTD.Value);
// // }
// // }else{
// // if (_DurationInStunden == ZeiterfassungsDauer.Stunden)
// // {
// // EndTime = _StartTime.Value.AddHours(Duration.Value);
// // }else{
// // EndTime = _StartTime.Value.AddMinutes(Duration.Value);
// // }
// // }
// //}
// }
// else
// {
// TimeCheck();
// }
// StoreDirtyInformation(true, PropertyName_SupportConcept);
// FirePropertyChanged(PropertyName_StartTime);
// var test = this.IsDirty;
// }
// }
//}
2016-06-27 01:45:38 +02:00
public CompactSupportConceptDC SupportConcept
{
get { return _SupportConcept ; }
set
{
if ( AreDifferent ( _SupportConcept , value ) )
{
_SupportConcept = value ;
CostBearer = null ;
StoreDirtyInformation ( ! AreEqual ( DataContract . SupportConcept , value ) , PropertyName_SupportConcept ) ;
FirePropertyChanged ( PropertyName_SupportConcept ) ;
FirePropertyChanged ( PropertyName_PossibleCostBearers ) ;
}
}
}
public ServiceRecordTypeId ServiceRecordType
{
get { return _ServiceRecordType ; }
set
{
if ( AreDifferent ( _ServiceRecordType , value ) )
{
_ServiceRecordType = value ;
StoreDirtyInformation ( ! AreEqual ( DataContract . ServiceRecordType , value ) , PropertyName_ServiceRecordType ) ;
FirePropertyChanged ( PropertyName_ServiceRecordType ) ;
FirePropertyChanged ( PropertyName_IsServiceRecordTypeContent ) ;
FirePropertyChanged ( PropertyName_IsServiceRecordTypeDefaultActivity ) ;
}
}
}
public bool IsServiceRecordTypeContent
{
get { return ServiceRecordType = = ServiceRecordTypeId . Content ; }
set { ServiceRecordType = value ? ServiceRecordTypeId . Content : ServiceRecordTypeId . DefaultActivity ; }
}
public bool IsServiceRecordTypeDefaultActivity
{
get { return ServiceRecordType = = ServiceRecordTypeId . DefaultActivity ; }
set { ServiceRecordType = value ? ServiceRecordTypeId . DefaultActivity : ServiceRecordTypeId . Content ; }
2017-01-11 11:02:58 +01:00
}
2020-12-30 02:46:55 +01:00
public ZeiterfassungsDauer DauerEinheit
2017-01-11 11:02:58 +01:00
{
2020-12-30 02:46:55 +01:00
get { return _DauerEinheit ; }
2017-01-11 11:02:58 +01:00
set
{
2020-12-30 02:46:55 +01:00
if ( AreDifferent ( _DauerEinheit , value ) )
2017-01-11 11:02:58 +01:00
{
2020-12-30 02:46:55 +01:00
if ( value = = ZeiterfassungsDauer . Minuten & & _DauerEinheit = = ZeiterfassungsDauer . Stunden )
2017-03-15 15:16:06 +01:00
{
2020-12-30 02:46:55 +01:00
_Duration * = 60 ;
2017-03-15 15:16:06 +01:00
}
2020-12-30 02:46:55 +01:00
else if ( value = = ZeiterfassungsDauer . Stunden & & _DauerEinheit = = ZeiterfassungsDauer . Minuten )
2017-03-15 15:16:06 +01:00
{
2020-12-30 02:46:55 +01:00
_Duration / = 60 ;
2017-03-15 15:16:06 +01:00
}
2017-01-16 16:13:19 +01:00
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
_DauerEinheit = value ;
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
StoreDirtyInformation ( AreDifferent ( DataContract . DurationInStunden , value ) , PropertyName_DauerEinheit ) ;
2017-03-28 10:51:31 +02:00
2020-12-30 02:46:55 +01:00
FirePropertyChanged ( PropertyName_DauerEinheit ) ;
FirePropertyChanged ( PropertyName_Duration ) ;
2017-01-11 11:02:58 +01:00
}
}
}
2020-12-30 02:46:55 +01:00
public ServiceRecordFormate ServiceRecordFormat
2017-01-19 17:02:07 +01:00
{
get { return _ServiceRecordFormat ; }
set
{
if ( AreDifferent ( _ServiceRecordFormat , value ) )
{
_ServiceRecordFormat = value ;
StoreDirtyInformation ( AreDifferent ( DataContract . ServiceRecordFormat , value ) , PropertyName_ServiceRecordFormat ) ;
FirePropertyChanged ( PropertyName_ServiceRecordFormat ) ;
}
}
}
2017-01-24 13:43:59 +01:00
2017-01-16 16:13:19 +01:00
public string OnlyMonth
{
2017-01-19 17:02:07 +01:00
get
{
if ( _OnlyMonth . IsNullOrEmpty ( ) )
{
_OnlyMonth = DateTime . Now . ToString ( "MMMM" ) ;
}
return _OnlyMonth ;
}
2017-01-16 16:13:19 +01:00
set
{
if ( AreDifferent ( _OnlyMonth , value ) )
{
_OnlyMonth = value ;
FirePropertyChanged ( PropertyName_OnlyMonth ) ;
}
}
}
2017-01-19 17:02:07 +01:00
public string [ ] MonateBinden
{
get { return _MonateBinden ; }
}
public string [ ] JahreBind ( )
{
string [ ] s = new string [ 11 ] ;
int x = - 5 ;
for ( int i = 0 ; i < 11 ; i + + )
{
var a = DateTime . Now . Year + x ;
s [ i ] = a . ToString ( ) ;
x + + ;
}
return s ;
}
public string [ ] JahreBinden
{
get { return JahreBind ( ) ; }
}
2020-12-30 02:46:55 +01:00
public string OnlyYear
{
get
{
if ( _OnlyYear . IsNullOrEmpty ( ) )
{
_OnlyYear = DateTime . Now . Year . ToString ( ) ;
}
2017-06-11 15:50:31 +02:00
2020-12-30 02:46:55 +01:00
return _OnlyYear ;
}
set
{
if ( AreDifferent ( _OnlyYear , value ) )
{
_OnlyYear = value ;
FirePropertyChanged ( PropertyName_OnlyYear ) ;
}
2017-01-24 13:43:59 +01:00
}
}
2020-12-30 02:46:55 +01:00
2017-01-24 13:43:59 +01:00
[Validation(ValidationRule = ValidationRules.GreaterThanOrEqualZero)]
2017-02-21 11:05:27 +01:00
public decimal? DurationMonthYearGes
2017-01-24 13:43:59 +01:00
{
get
{
2017-01-31 07:15:00 +01:00
if ( _DurationMonthYearGes = = null )
{
return 0 ;
}
else
{
return _DurationMonthYearGes ;
}
2017-01-24 13:43:59 +01:00
}
set
{
if ( AreDifferent ( _DurationMonthYearGes , value ) )
{
_DurationMonthYearGes = value ;
2017-01-31 07:15:00 +01:00
StoreDirtyInformation ( AreDifferent ( DataContract . RoundedDuration , value ) ,
PropertyName_DurationMonthYearGes ) ;
2017-01-24 13:43:59 +01:00
2017-01-31 07:15:00 +01:00
FirePropertyChanged ( PropertyName_DurationMonthYearGes ) ;
FirePropertyChanged ( PropertyName_RoundedDuration ) ;
TimeCheckMonatJahr ( ) ;
}
2017-01-11 11:02:58 +01:00
}
}
2024-04-25 02:15:41 +02:00
2016-06-27 01:45:38 +02:00
#endregion
2024-04-25 02:15:41 +02:00
public List < SupportConceptPeriodStatisticsVM > Statistics
{
get { return _Statistics ; }
set
{
_Statistics = value ;
FirePropertyChanged ( "Statistics" ) ;
FirePropertyChanged ( "HasStatistics" ) ;
}
}
public bool HasStatistics
{
get { return _Statistics ! = null & & _Statistics . Count > 0 ; }
}
2016-06-27 01:45:38 +02:00
#region Public Methods
public void ChangeGoalTree ( List < ValueListEntryDC > goalCats , List < ValueListEntryDC > goals ) //, List<ValueListEntryDC> goalsAndCats)
{
2019-10-10 22:07:42 +02:00
//if (!MussGoalTreeAktualisieren(goalCats, goals))
//{
//ValueListEntryDC kopieren?
_AllGoalCategories = goalCats ;
_AllGoals = goals ;
2016-06-27 01:45:38 +02:00
2019-10-10 22:07:42 +02:00
var newList = new List < ValueListEntryDC > ( ) ;
2016-06-27 01:45:38 +02:00
2019-10-10 22:07:42 +02:00
if ( _AllGoalCategories ! = null )
{
newList . AddRange ( _AllGoalCategories ) ;
}
if ( _AllGoals ! = null )
{
newList . AddRange ( _AllGoals ) ;
}
2016-06-27 01:45:38 +02:00
2019-10-10 22:07:42 +02:00
GoalTree = SupportConceptService . CreateGoalTree ( newList , SelectedGoals ) ;
2020-09-23 22:10:52 +02:00
AddPropertyChangedHandler ( GoalTree ) ;
2019-10-10 22:07:42 +02:00
2016-06-27 01:45:38 +02:00
}
2020-09-23 22:10:52 +02:00
private void AddPropertyChangedHandler ( List < SupportConceptGoalDC > goalTree )
{
if ( goalTree ! = null )
{
foreach ( var goal in goalTree )
{
goal . PropertyChanged + = ( s , e ) = >
{
var selectedGoal = s as SupportConceptGoalDC ;
if ( selectedGoal ! = null )
{
if ( selectedGoal . IsChecked )
{
if ( ! SelectedGoals . Contains ( selectedGoal . GoalEntryDC ) )
{
SelectedGoals . Add ( selectedGoal . GoalEntryDC ) ;
}
}
else
{
SelectedGoals . Remove ( selectedGoal . GoalEntryDC ) ;
}
}
} ;
AddPropertyChangedHandler ( goal . Children ) ;
}
}
}
2019-10-10 22:07:42 +02:00
//private bool MussGoalTreeAktualisieren(List<ValueListEntryDC> goalCats, List<ValueListEntryDC> goals)
//{
// if (IstGleich(goalCats, _AllGoalCategories) && IstGleich(_AllGoals, goals))
// {
// }
// return false;
//}
2016-06-27 01:45:38 +02:00
public void UpdateServiceAccountings ( List < ServiceAccountingDC > serviceAccountings , Dictionary < ServiceCategoryDC , List < ServiceDescriptionDC > > allDict , bool hilfeplanAusgewaehlt )
{
_ServiceAccountings = serviceAccountings ;
var newCategoryDict = new Dictionary < ServiceCategoryDC , List < ServiceDescriptionDC > > ( ) ;
foreach ( var cat in allDict . Keys )
{
bool add = true ;
if ( hilfeplanAusgewaehlt & & cat . OhneHilfeplan . HasValue & & cat . OhneHilfeplan . Value = = AccountingvisibilityType . NichtKlientenbezogen )
{
add = false ;
}
else if ( ! hilfeplanAusgewaehlt & & cat . OhneHilfeplan . HasValue & & cat . OhneHilfeplan . Value = = AccountingvisibilityType . NurKlientenbezogen )
{
add = false ;
}
2025-02-14 13:45:44 +01:00
else if ( cat . OhneHilfeplan . HasValue & & cat . OhneHilfeplan . Value = = AccountingvisibilityType . Never )
{
add = false ;
}
2016-06-27 01:45:38 +02:00
if ( add )
{
newCategoryDict . Add ( cat , allDict [ cat ] ) ;
}
}
ServiceCategoryDC firstCat = null ;
if ( _ServiceAccountings ! = null & & allDict ! = null )
{
2025-07-04 00:30:36 +02:00
var globalServices = _ServiceAccountings . FindAll ( sa = > sa . ServiceDescription . ScopeType = = ScopeTypeId . Global & & ( ! sa . ServiceDescription . Category . OhneHilfeplan . HasValue | | sa . ServiceDescription . Category . OhneHilfeplan . Value ! = AccountingvisibilityType . Never ) ) ;
var individualServices = _ServiceAccountings . FindAll ( sa = > sa . ServiceDescription . ScopeType = = ScopeTypeId . Individual & & ( ! sa . ServiceDescription . Category . OhneHilfeplan . HasValue | | sa . ServiceDescription . Category . OhneHilfeplan . Value ! = AccountingvisibilityType . Never ) ) ;
2016-06-27 01:45:38 +02:00
if ( globalServices . Count > 0 )
{
newCategoryDict = new Dictionary < ServiceCategoryDC , List < ServiceDescriptionDC > > ( ) ;
foreach ( var cat in allDict . Keys )
{
var sdList = allDict [ cat ] ;
var newSdList = sdList . Where ( sd = > globalServices . Exists ( sa = > sa . ServiceDescription . Equals ( sd ) ) ) . ToList ( ) ;
if ( newSdList . Count > 0 )
{
if ( firstCat = = null | | cat . Position < firstCat . Position )
firstCat = cat ;
newCategoryDict . Add ( cat , newSdList ) ;
}
}
}
if ( individualServices . Count > 0 )
{
newCategoryDict . Add ( individualServices [ 0 ] . ServiceDescription . Category ,
individualServices . Select ( sa = > sa . ServiceDescription ) . ToList ( ) ) ;
}
}
Category2Services = newCategoryDict ;
2020-09-23 22:10:52 +02:00
2016-06-27 01:45:38 +02:00
if ( Category = = null )
2020-09-23 22:10:52 +02:00
{
if ( firstCat = = null )
{
firstCat = SortedCategories . FirstOrDefault ( ) ;
}
2016-06-27 01:45:38 +02:00
Category = firstCat ;
2020-09-23 22:10:52 +02:00
}
2016-06-27 01:45:38 +02:00
}
public ServiceRecordVM Clone ( )
{
var dc = new ServiceRecordDC ( ) ;
return new ServiceRecordVM ( CopyToDataContract ( dc ) , _Category2Services , _AllGoalCategories , _AllGoals ) ;
}
public void CopyTo ( ServiceRecordVM copy )
{
copy . Notice = Notice ;
copy . Notice2 = Notice2 ;
copy . Notice3 = Notice3 ;
copy . Notice4 = Notice4 ;
copy . Notice5 = Notice5 ;
2017-07-27 09:58:04 +02:00
copy . RTFNotice = RTFNotice ;
copy . RTFNotice2 = RTFNotice2 ;
copy . RTFNotice3 = RTFNotice3 ;
copy . RTFNotice4 = RTFNotice4 ;
copy . RTFNotice5 = RTFNotice5 ;
2020-12-30 02:46:55 +01:00
copy . EditStartDate = EditStartDate ;
copy . StartTimeString = StartTimeString ;
copy . EditEndDate = EditEndDate ;
copy . EndTimeString = EndTimeString ;
2016-06-27 01:45:38 +02:00
copy . Duration = Duration ;
copy . RoundedDuration = RoundedDuration ;
copy . ServiceRecordType = ServiceRecordType ;
copy . DistanceInMeter = DistanceInMeter ;
copy . Employee = Employee ;
copy . Customer = Customer ;
copy . SupportConcept = SupportConcept ;
copy . CostBearer = CostBearer ;
copy . Category = Category ;
copy . ServiceDescription = ServiceDescription ;
copy . GroupEmployeeCount = GroupEmployeeCount ;
copy . GroupPersonCount = GroupPersonCount ;
copy . GroupOid = GroupOid ;
copy . GroupRoundedDuration = GroupRoundedDuration ;
2020-12-30 02:46:55 +01:00
copy . SignatureOid = SignatureOid ;
copy . DauerEinheit = DauerEinheit ;
copy . ServiceRecordFormat = ServiceRecordFormat ;
2020-10-12 13:03:05 +02:00
copy . Betrag = Betrag ;
2021-02-22 10:14:07 +01:00
copy . BackgroundColor = BackgroundColor ;
2017-01-11 11:02:58 +01:00
2016-06-27 01:45:38 +02:00
copy . SelectedGoals . Clear ( ) ;
foreach ( var item in SelectedGoals )
{
copy . SelectedGoals . Add ( item ) ;
}
copy . GoalTree = GoalTree ;
}
public void SetInsertedOn ( DateTime dt )
{
_InsertedOn = dt ;
}
public override string ToString ( )
{
2020-12-30 02:46:55 +01:00
return _Customer + ": " + StartDate . ToLongDateString ( ) + string . Format ( "- Dauer: {0:0.00} min" , RoundedDuration ) ;
2016-06-27 01:45:38 +02:00
}
#endregion
#region Methods
2017-01-11 11:02:58 +01:00
2016-06-27 01:45:38 +02:00
protected override void InitByDataContract ( ServiceRecordDC pDataContract )
2020-12-30 02:46:55 +01:00
{
_DauerEinheit = pDataContract . DurationInStunden ? ? ZeiterfassungsDauer . Minuten ;
_EditStartDate = pDataContract . Start ? ? DateTime . Now . Date . AddSeconds ( 1 ) ;
_EditEndDate = pDataContract . End ? ? DateTime . Now . Date . AddSeconds ( 1 ) ;
if ( pDataContract . Start . HasValue & & pDataContract . Start . Value . Second = = 0 )
{
_StartTimeString = String . Format ( "{0:HH:mm}" , pDataContract . Start ) ;
}
if ( pDataContract . End . HasValue & & pDataContract . End . Value . Second = = 0 )
{
_EndTimeString = String . Format ( "{0:HH:mm}" , pDataContract . End ) ;
}
if ( _DauerEinheit = = ZeiterfassungsDauer . Stunden )
{
_Duration = ( decimal ) ( _EditEndDate . Value - _EditStartDate . Value ) . TotalHours ;
}
else
{
_Duration = ( _EditEndDate . Value - _EditStartDate . Value ) . GetTotalMinutes ( ) ;
}
_Notice = pDataContract . Notice ;
_Notice2 = pDataContract . Notice2 ;
_Notice3 = pDataContract . Notice3 ;
_Notice4 = pDataContract . Notice4 ;
_Notice5 = pDataContract . Notice5 ;
_RTFNotice = pDataContract . RTFNotice1 ;
_RTFNotice2 = pDataContract . RTFNotice2 ;
_RTFNotice3 = pDataContract . RTFNotice3 ;
_RTFNotice4 = pDataContract . RTFNotice4 ;
_RTFNotice5 = pDataContract . RTFNotice5 ;
_ServiceDescription = pDataContract . ServiceDescription ;
_Employee = pDataContract . Employee ;
_Customer = pDataContract . Customer ;
_SupportConcept = pDataContract . SupportConcept ;
_CostBearer = pDataContract . CostBearer ;
_ServiceDescription = pDataContract . ServiceDescription ;
2017-01-31 07:15:00 +01:00
2020-12-30 02:46:55 +01:00
if ( pDataContract . ServiceDescription ! = null )
{
2016-06-27 01:45:38 +02:00
_Category = pDataContract . ServiceDescription . Category ;
2020-12-30 02:46:55 +01:00
}
2020-09-23 22:10:52 +02:00
2020-12-30 02:46:55 +01:00
_RoundedDuration = pDataContract . RoundedDuration ;
_InsertedOn = pDataContract . InsertedOn ;
_InsUser = pDataContract . InsUser ;
_GroupEmployeeCount = pDataContract . GroupEmployeeCount ;
_GroupPersonCount = pDataContract . GroupPersonCount ;
_GroupRoundedDuration = pDataContract . GroupRoundedDuration ;
_GroupOid = pDataContract . GroupOid ;
_ServiceRecordType = pDataContract . ServiceRecordType ;
2022-11-09 09:44:24 +01:00
_DistanceInMeter = pDataContract . DistanceInMeterDecimal ;
2020-12-30 02:46:55 +01:00
_Betrag = pDataContract . Betrag ;
_ServiceRecordFormat = pDataContract . ServiceRecordFormat ? ? ServiceRecordFormate . OriginaleZeiterfassung ;
_SignatureOid = pDataContract . SignatureOid ;
2021-02-22 10:14:07 +01:00
BackgroundColor = pDataContract . BackgroundColor ;
2020-09-23 22:10:52 +02:00
2020-12-30 02:46:55 +01:00
if ( pDataContract . Goals ! = null )
2016-06-27 01:45:38 +02:00
{
2020-12-30 02:46:55 +01:00
_SelectedGoals = new ObservableSortCollection < ValueListEntryDC > ( GoalService . CopyGoals ( pDataContract . Goals , true ) , Comparer . ValueListEntryDCComparer ) ;
2016-06-27 01:45:38 +02:00
}
2020-12-30 02:46:55 +01:00
SelectedGoals . CollectionChanged + = ( s , e ) = >
{
StoreDirtyInformation ( ! SelectedGoals . ContainsSameItemsAs ( pDataContract . Goals ) ,
PropertyName_SelectedGoals ) ;
} ;
2016-06-27 01:45:38 +02:00
if ( pDataContract . ServiceRecordType = = ServiceRecordTypeId . Wohnheimbuchung )
{
_EditAllowed = _DeleteAllowed = false ;
}
}
2019-10-10 22:07:42 +02:00
private bool SameRatingChecked ( ObservableSortCollection < ValueListEntryDC > selectedGoals , List < ValueListEntryDC > goals )
{
if ( goals ! = null )
{
foreach ( var selectedGoal in selectedGoals )
{
foreach ( var goalDc in goals )
{
if ( selectedGoal . Equals ( goalDc ) )
{
bool equalRating = true ;
2020-08-17 15:50:00 +02:00
if ( selectedGoal . RatingTypeOid = = null & & goalDc . RatingTypeOid = = null )
2019-10-10 22:07:42 +02:00
{
equalRating = true ;
}
2020-08-17 15:50:00 +02:00
else if ( selectedGoal . RatingTypeOid = = null & & goalDc . RatingTypeOid ! = null )
2019-10-10 22:07:42 +02:00
{
equalRating = false ;
}
2020-08-17 15:50:00 +02:00
else if ( selectedGoal . RatingTypeOid ! = null & & goalDc . RatingTypeOid = = null )
2019-10-10 22:07:42 +02:00
{
equalRating = false ;
}
2020-08-17 15:50:00 +02:00
else if ( selectedGoal . RatingTypeOid ! = null & & goalDc . RatingTypeOid ! = null & &
selectedGoal . RatingTypeOid ! = goalDc . RatingTypeOid )
2019-10-10 22:07:42 +02:00
{
equalRating = false ;
}
if ( ! equalRating )
{
StoreDirtyInformation ( true , "Rating" ) ;
return false ;
}
}
}
}
}
StoreDirtyInformation ( false , "Rating" ) ;
return true ;
}
2016-06-27 01:45:38 +02:00
protected override ServiceRecordDC MapToDataContract ( ServiceRecordDC pDataContract , bool doCommit )
{
return CopyToDataContract ( pDataContract ) ;
}
private ServiceRecordDC CopyToDataContract ( ServiceRecordDC pDataContract )
2017-01-31 07:15:00 +01:00
{
2017-02-17 13:57:11 +01:00
2020-12-30 02:46:55 +01:00
pDataContract . ServiceRecordFormat = ServiceRecordFormate . OriginaleZeiterfassung ;
if ( ! String . IsNullOrEmpty ( StartTimeString ) & & String . IsNullOrEmpty ( EndTimeString ) )
{
DateTime newEndDate = StartDate ;
if ( DauerEinheit = = ZeiterfassungsDauer . Minuten )
newEndDate = newEndDate . AddMinutes ( ( double ) Duration ) ;
2018-05-23 10:37:57 +02:00
else
2020-12-30 02:46:55 +01:00
newEndDate = newEndDate . AddHours ( ( double ) Duration ) ;
EndTimeString = String . Format ( "{0:HH:mm}" , newEndDate ) ;
2017-01-24 13:43:59 +01:00
}
2020-12-30 02:46:55 +01:00
else if ( String . IsNullOrEmpty ( StartTimeString ) & & ! String . IsNullOrEmpty ( EndTimeString ) )
2017-01-24 13:43:59 +01:00
{
2020-12-30 02:46:55 +01:00
//_EndTimeString = "";
}
if ( BeWoApp . AppSettings . IsEndDateVisible )
{
pDataContract . ServiceRecordFormat = ServiceRecordFormate . ZeiterfassungMitEndDatum ;
2017-01-11 11:02:58 +01:00
}
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
pDataContract . Start = StartDate ;
pDataContract . End = EndDate ;
var d = Duration ;
if ( DauerEinheit = = ZeiterfassungsDauer . Stunden )
{
d * = 60 ;
2017-01-11 11:02:58 +01:00
}
2017-03-15 15:16:06 +01:00
2020-12-30 02:46:55 +01:00
pDataContract . RoundedDuration = d ;
2017-01-11 11:02:58 +01:00
2016-06-27 01:45:38 +02:00
pDataContract . Notice = _Notice ;
pDataContract . Notice2 = _Notice2 ;
pDataContract . Notice3 = _Notice3 ;
pDataContract . Notice4 = _Notice4 ;
pDataContract . Notice5 = _Notice5 ;
2017-07-27 09:58:04 +02:00
pDataContract . RTFNotice1 = _RTFNotice ;
pDataContract . RTFNotice2 = _RTFNotice2 ;
pDataContract . RTFNotice3 = _RTFNotice3 ;
pDataContract . RTFNotice4 = _RTFNotice4 ;
pDataContract . RTFNotice5 = _RTFNotice5 ;
2016-06-27 01:45:38 +02:00
pDataContract . ServiceRecordType = _ServiceRecordType ;
2022-11-09 09:44:24 +01:00
pDataContract . DistanceInMeter = null ; // Die Eigenschaft muss leider drin bleiben um die Abwärtskompatibilität zu gewährleistung
pDataContract . DistanceInMeterDecimal = _DistanceInMeter ;
2020-12-30 02:46:55 +01:00
pDataContract . DurationInStunden = DauerEinheit ;
2016-06-27 01:45:38 +02:00
pDataContract . Employee = _Employee ;
pDataContract . Customer = _Customer ;
pDataContract . SupportConcept = _SupportConcept ;
pDataContract . CostBearer = _CostBearer ;
pDataContract . RoundedDuration = RoundedDuration ;
pDataContract . ServiceDescription = _ServiceDescription ;
2020-10-12 13:03:05 +02:00
pDataContract . Betrag = _Betrag ;
2019-10-10 22:07:42 +02:00
//Hack Story dirty information
SameRatingChecked ( SelectedGoals , this . DataContract . Goals ) ;
2016-06-27 01:45:38 +02:00
pDataContract . Goals = GetSelectedGoals ( ) ;
2019-10-10 22:07:42 +02:00
#if DEBUG
if ( pDataContract . Goals . Count = = 0 )
{
int test = 0 ;
}
#endif
2016-06-27 01:45:38 +02:00
pDataContract . GroupEmployeeCount = GroupEmployeeCount ;
pDataContract . GroupPersonCount = GroupPersonCount ;
pDataContract . GroupRoundedDuration = GroupRoundedDuration ;
pDataContract . GroupOid = GroupOid ;
2021-02-22 10:14:07 +01:00
pDataContract . BackgroundColor = BackgroundColor ;
2021-07-05 18:05:43 +02:00
pDataContract . SignatureOid = _SignatureOid ;
2016-06-27 01:45:38 +02:00
return pDataContract ;
}
private List < ValueListEntryDC > GetSelectedGoals ( )
{
var goals = new List < ValueListEntryDC > ( ) ;
AddCheckedGoals ( GoalTree , goals ) ;
return goals ;
}
private static void AddCheckedGoals ( IEnumerable < SupportConceptGoalDC > goals , ICollection < ValueListEntryDC > selectedGoals )
{
foreach ( var item in goals )
{
2020-09-23 22:10:52 +02:00
if ( item . IsChecked )
{
selectedGoals . Add ( item . GoalEntryDC ) ;
}
2016-06-27 01:45:38 +02:00
if ( item . Children = = null | | item . Children . Count = = 0 )
{
2020-09-23 22:10:52 +02:00
//if (item.IsChecked)
//{
// selectedGoals.Add(item.GoalEntryDC);
//}
2016-06-27 01:45:38 +02:00
}
else
{
2020-09-23 22:10:52 +02:00
2016-06-27 01:45:38 +02:00
AddCheckedGoals ( item . Children , selectedGoals ) ;
}
}
}
2020-12-30 02:46:55 +01:00
2016-06-27 01:45:38 +02:00
2017-01-31 07:15:00 +01:00
private void TimeCheckMonatJahr ( )
{
2017-02-21 11:05:27 +01:00
//var duration = 0;
decimal duration = 0 ;
2017-02-21 12:41:12 +01:00
if ( _DurationMonthYearGes . HasValue )
2017-01-31 07:15:00 +01:00
{
duration = _DurationMonthYearGes . Value ;
}
var dates = DateTime . Parse ( "1." + _OnlyMonth + _OnlyYear ) ;
2017-03-08 13:05:45 +01:00
var StartDatetime = new DateTime ( dates . Year , dates . Month , 1 , 0 , 0 , 1 ) ;
2017-01-31 07:15:00 +01:00
StoreDirtyInformation (
2017-03-08 13:05:45 +01:00
AreDifferent ( DataContract . End , StartDatetime . AddHours ( ( double ) duration ) . AddSeconds ( 1 ) ) | |
2017-01-31 07:15:00 +01:00
AreDifferent ( DataContract . Start , StartDatetime ) , "TIME" ) ;
}
2020-12-30 02:46:55 +01:00
//private void TimeCheckForDurationSTD()
//{
// double duration = 0;
2017-02-21 11:05:27 +01:00
2020-12-30 02:46:55 +01:00
// if (_DurationSTD.HasValue) {
// duration = (double)_DurationSTD.Value;
// }
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
// //####################### ich glaub das wars ##########################
// if (_DurationInStunden == ZeiterfassungsDauer.Minuten)
// {
// if (_StartTime != null && _EndTime != null)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day,
// _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
// _EndTime = _StartTime.Value.AddMinutes(duration);
2017-03-27 11:05:32 +02:00
2020-12-30 02:46:55 +01:00
// if (_EndTime.Value.Second > 1)
// {
// _EndTime = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour , _EndTime.Value.Minute, 0);
// }
2017-03-27 11:05:32 +02:00
2020-12-30 02:46:55 +01:00
// }
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
// if (_StartTime == null && _EndTime != null && duration == 0)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, _EndTime.Value.Second);
// }
// else if (_StartTime == null && _EndTime != null)
// {
// _StartTime = _EndTime.Value.AddMinutes(duration * -1);
// }
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
// if (_StartTime != null && _EndTime == null && duration == 0)
// {
// _EndTime = new DateTime(_EditableEndDate.Value.Year, _EditableEndDate.Value.Month, _EditableEndDate.Value.Day, _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
// }
// else if (_StartTime != null && _EndTime == null)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day,
// _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
// _EndTime = _StartTime.Value.AddMinutes(duration);
2017-03-27 11:05:32 +02:00
2020-12-30 02:46:55 +01:00
// if (_EndTime.Value.Second > 1)
// {
// _EndTime = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, 0);
// }
// }
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
// if (_StartTime == null && _EndTime == null && duration == 0)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, 0, 0, 1);
// _EndTime = new DateTime(_EditableEndDate.Value.Year, _EditableEndDate.Value.Month, _EditableEndDate.Value.Day, 0, 0, 1);
// }
// else if (_StartTime == null && _EndTime == null)
// {
// //start 1 sek und end duration + 1 sek
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, 0, 0, 1);
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// _EndTime = new DateTime(_EditableEndDate.Value.Year, _EditableEndDate.Value.Month, _EditableEndDate.Value.Day, 0, 0, 1);
// _EndTime = _EndTime.Value.AddMinutes(duration);
// }
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// _Date = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
// _EditableEndDate = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, _EndTime.Value.Second);
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// var diff = _EditableEndDate.Value.Subtract(_Date.Value);
// duration = (double)diff.TotalMinutes;
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// _DurationSTD = (decimal)duration;
2020-09-23 22:10:52 +02:00
2020-12-30 02:46:55 +01:00
// //StoreDirtyInformation(AreDifferent(DataContract.End, (_Date.Value + _StartTime.Value.TimeOfDay).AddMinutes((double)duration)) || AreDifferent(DataContract.Start, _Date.Value + _StartTime.Value.TimeOfDay), "TIME");
// StoreDirtyInformation(AreDifferent(DataContract.End, _EndTime) || AreDifferent(DataContract.Start, _StartTime), "TIME");
// }
// else if (_DurationInStunden == ZeiterfassungsDauer.Stunden)
// {
// if (_StartTime != null && _EndTime != null)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day,
// _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
2017-01-11 11:02:58 +01:00
2020-12-30 02:46:55 +01:00
// _EndTime = _StartTime.Value.AddHours(duration);
2017-03-27 11:05:32 +02:00
2020-12-30 02:46:55 +01:00
// if (_EndTime.Value.Second > 1)
// {
// _EndTime = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, 0);
// }
// }
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// if (_StartTime == null && _EndTime != null && duration == 0)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, _EndTime.Value.Second);
// }
// else if (_StartTime == null && _EndTime != null)
// {
// _StartTime = _EndTime.Value.AddHours(duration * -1);
// }
2017-01-11 11:02:58 +01:00
2017-01-19 17:02:07 +01:00
2020-12-30 02:46:55 +01:00
// if (_StartTime != null && _EndTime == null && duration == 0)
// {
// _EndTime = new DateTime(_EditableEndDate.Value.Year, _EditableEndDate.Value.Month, _EditableEndDate.Value.Day, _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
// }
// else if (_StartTime != null && _EndTime == null)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day,
// _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// _EndTime = _StartTime.Value.AddHours(duration);
2017-03-27 11:05:32 +02:00
2020-12-30 02:46:55 +01:00
// if (_EndTime.Value.Second > 1)
// {
// _EndTime = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, 0);
// }
// }
2017-01-24 13:43:59 +01:00
2017-01-19 17:02:07 +01:00
2020-12-30 02:46:55 +01:00
// if (_StartTime == null && _EndTime == null && duration == 0)
// {
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, 0, 0, 1);
// _EndTime = new DateTime(_EditableEndDate.Value.Year, _EditableEndDate.Value.Month, _EditableEndDate.Value.Day, 0, 0, 1);
// }
// else if (_StartTime == null && _EndTime == null)
// {
// //start 1 sek und end duration + 1 sek
// _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, 0, 0, 1);
2017-01-19 17:02:07 +01:00
2020-12-30 02:46:55 +01:00
// _EndTime = new DateTime(_EditableEndDate.Value.Year, _EditableEndDate.Value.Month, _EditableEndDate.Value.Day, 0, 0, 1);
// _EndTime = _EndTime.Value.AddHours(duration);
// }
2017-01-19 17:02:07 +01:00
2020-12-30 02:46:55 +01:00
// _Date = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, _StartTime.Value.Hour, _StartTime.Value.Minute, _StartTime.Value.Second);
// _EditableEndDate = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, _EndTime.Value.Second);
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// var diff = _EditableEndDate.Value.Subtract(_Date.Value);
// duration = (double)diff.TotalHours;
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// _DurationSTD = (decimal)Math.Round(duration,2);
2020-09-23 22:10:52 +02:00
2020-12-30 02:46:55 +01:00
// StoreDirtyInformation(AreDifferent(DataContract.End, _EndTime) || AreDifferent(DataContract.Start, _StartTime), "TIME");
// }
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// FirePropertyChanged(PropertyName_DurationSTD);
// FirePropertyChanged(PropertyName_StartTime);
// FirePropertyChanged(PropertyName_EndTime);
// FirePropertyChanged(PropertyName_Date);
// FirePropertyChanged(PropertyName_EditableEndDate);
2017-01-24 13:43:59 +01:00
2020-12-30 02:46:55 +01:00
// }
2016-06-27 01:45:38 +02:00
#endregion
}
}