diff --git a/BeWo/View/Detail/MandatorView.xaml b/BeWo/View/Detail/MandatorView.xaml index 9c5d684be..3bba7082a 100644 --- a/BeWo/View/Detail/MandatorView.xaml +++ b/BeWo/View/Detail/MandatorView.xaml @@ -51,6 +51,7 @@ + @@ -85,8 +86,13 @@ Grid.Column="1" Grid.Row="5" Margin="3,5,3,5" Height="23" EditValue="{Binding Path=AnzTageZeiterfassErfolgt, Converter={StaticResource Int2DecimalConverter}}" /> + + + - + + + diff --git a/BeWo/View/Detail/ServiceRecordEditView.xaml b/BeWo/View/Detail/ServiceRecordEditView.xaml index 9588f19f5..06646730a 100644 --- a/BeWo/View/Detail/ServiceRecordEditView.xaml +++ b/BeWo/View/Detail/ServiceRecordEditView.xaml @@ -7,6 +7,7 @@ xmlns:val="clr-namespace:BeWo.Validation" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" + xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared" Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="True"> @@ -121,19 +122,40 @@ - + + + - - - + + + - diff --git a/BeWo/View/Detail/ServiceRecordView2.xaml b/BeWo/View/Detail/ServiceRecordView2.xaml index aa2d60336..306be0c76 100644 --- a/BeWo/View/Detail/ServiceRecordView2.xaml +++ b/BeWo/View/Detail/ServiceRecordView2.xaml @@ -682,22 +682,47 @@ Grid.Column="2" x:Name="endTime1" Height="23" Margin="3,0,3,3" /> + - + - - - + + + + - - - - - @@ -939,16 +964,25 @@ - + + + - - - - - + + + + + + + + + + + + diff --git a/BeWo/View/Detail/ServiceRecordView2.xaml.cs b/BeWo/View/Detail/ServiceRecordView2.xaml.cs index a9bf4d5df..a961b7121 100644 --- a/BeWo/View/Detail/ServiceRecordView2.xaml.cs +++ b/BeWo/View/Detail/ServiceRecordView2.xaml.cs @@ -99,6 +99,8 @@ namespace BeWo.View.Detail ViewModel = pViewModel; + // CheckMinStdSwitch.SelectedIndex = 0; + //if (ViewModel.ServiceRecordTimeInterval == ServiceRecordTimeInterval.LastNDays) //{ // NDayTextbox.Visibility = Visibility.Visible; @@ -689,6 +691,7 @@ namespace BeWo.View.Detail continue; } + vm.IsNew = false; vm.DataContract.ServiceRecordVersion = 1; vm.DataContract.ServiceRecordOid = oids[idx++]; @@ -709,7 +712,6 @@ namespace BeWo.View.Detail } }); } - ServiceFacade.DoMultipleOperationsServicesSync(lToDos); ReloadViewModel(); } @@ -3872,5 +3874,19 @@ namespace BeWo.View.Detail ReloadMedRecordViewModel(ViewModel.BedarfsMedViewModel.NewVM.Customer, ViewModel.BedarfsMedViewModel.NewVM.Employee); } + + private void CheckMinStdSwitch_OnClick(object sender, RoutedEventArgs e) + { + //if (CheckMinStdSwitch.IsChecked == true) + //{ + // MinStdDauerLabel.Content = "Dauer (std)"; + //} + //else + //{ + // MinStdDauerLabel.Content = "Dauer (min)"; + //} + + + } } } \ No newline at end of file diff --git a/BeWo/ViewModel/ServiceRecordVM.cs b/BeWo/ViewModel/ServiceRecordVM.cs index 7a7dd0246..c766626b9 100644 --- a/BeWo/ViewModel/ServiceRecordVM.cs +++ b/BeWo/ViewModel/ServiceRecordVM.cs @@ -88,6 +88,12 @@ namespace BeWo.ViewModel public static string PropertyName_DistanceInMeter = "DistanceInMeter"; + public static string PropertyName_DurationInStunden = "DurationInStunden"; + + public static string PropertyName_DurationSTD = "DurationSTD"; + + public static string PropertyName_EndDate = "EndDate"; + private static readonly DateTime NULL_TIME = new DateTime(2000, 1, 1, 0, 0, 1); private Dictionary> _Category2Services; @@ -108,10 +114,14 @@ namespace BeWo.ViewModel private DateTime? _Date; + private DateTime? _EndDate; + private bool _DeleteAllowed = true; private int? _Duration; + private int? _DurationSTD; + private bool _EditAllowed = true; private CompactEmployeeDC _Employee; @@ -162,6 +172,9 @@ namespace BeWo.ViewModel private int? _DistanceInMeter; + private ZeiterfassungsDauer? _DurationInStunden; + + #endregion #region Constructors and Destructors @@ -367,6 +380,7 @@ namespace BeWo.ViewModel { if (AreDifferent(_Date, value)) { + var oldDate = _Date; _Date = value; TimeCheck(); if (BeWoApp.AppSettings.IsEndDateVisible) @@ -377,6 +391,48 @@ namespace BeWo.ViewModel } } FirePropertyChanged(PropertyName_Date); + + + if (BeWoApp.AppSettings.IsEndDateVisible) + { + if (oldDate != _Date) + { + // decimal dura = DurationSTD.Value/1440; + + // var x = oldDate.Value.Day - _Date.Value.Day; + var x = _Date.Value.Date - oldDate.Value.Date;//_EditableEndDate.Value.Day; + + int daydiff = (int)x.Days * 1440; + + + + if (DurationSTD.HasValue) + { + + if (EditableEndDate.Value.Date <= _Date.Value.Date) + { + DurationSTD = 0; + }else{ + DurationSTD = DurationSTD.Value - daydiff; // berechnung ist fehlerhaft + } + } + else + { + if (EditableEndDate.Value.Date <= oldDate.Value) + { + DurationSTD = 0; + } + else + { + DurationSTD = 0 - daydiff; + } + + } + + } + + } + } } } @@ -418,6 +474,7 @@ namespace BeWo.ViewModel { get { + if(_EndDate == null){ var dt = DateAndTime; if (dt.HasValue) { @@ -437,6 +494,23 @@ namespace BeWo.ViewModel } return dt; + } + else + { + return _EndDate; + } + } + set + { + + if (AreDifferent(_EndDate, value)) + { + _EndDate = value; + + + FirePropertyChanged(PropertyName_EndDate); + } + } } @@ -445,18 +519,42 @@ namespace BeWo.ViewModel get { return String.Format("{0}", DataContract.ServiceRecordOid); } } - [Validation(ValidationRule = ValidationRules.GreaterThanOrEqualZero)] - public int? Duration + [Validation(ValidationRule = ValidationRules.GreaterThanOrEqualZero)] + public int? Duration { - get { return _Duration; } + get + { + if (_DurationInStunden == ZeiterfassungsDauer.Stunden) + { + return _Duration / 60; + } + + return _Duration; + } set { - if (value >= 0 && AreDifferent(_Duration, value)) - { - Console.WriteLine("Change Duration " + value.Value); + var newValue = value; - _Duration = value; + //#################### So Ein Scheisss ################################# + if (_DurationInStunden == ZeiterfassungsDauer.Stunden ) + { + newValue *= 60; + + } + + if(_DurationInStunden == ZeiterfassungsDauer.Minuten ) + { + newValue /= 60; + + } + //###################################################################### + + if (newValue >= 0 && AreDifferent(_Duration, newValue)) + { + Console.WriteLine("Change Duration " + newValue.Value); + + _Duration = newValue; if (StartTime != null ) { @@ -471,7 +569,7 @@ namespace BeWo.ViewModel //} //else //{ - EndTime = StartTime.Value.AddMinutes(value.Value); + EndTime = StartTime.Value.AddMinutes(newValue.Value); //} } @@ -488,18 +586,21 @@ namespace BeWo.ViewModel //} } + TimeCheck(); FirePropertyChanged(PropertyName_Duration); FirePropertyChanged(PropertyName_RoundedDuration); - } - if (value < 0) + } + + if (newValue < 0) { Console.WriteLine("Kleiner 0"); } } } + public string DurationAndRoundedDuration { get @@ -704,6 +805,8 @@ namespace BeWo.ViewModel set { + DateTime neuerwert; + if (String.IsNullOrEmpty(value)) EndTime = null; else @@ -715,11 +818,14 @@ namespace BeWo.ViewModel String dtStr = String.Format("{0:dd.MM.yyyy} {1}", endTime, value); DateTime dt; - + DateTime.TryParse(dtStr, out neuerwert); + if (DateTime.TryParse(dtStr, out dt)) EndTime = dt; else EndTime = null; + + } else { @@ -732,12 +838,73 @@ namespace BeWo.ViewModel String dtStr = String.Format("{0:dd.MM.yyyy} {1}", endTime, value); DateTime dt; + DateTime.TryParse(dtStr, out neuerwert); if (DateTime.TryParse(dtStr, out dt)) EndTime = dt; else EndTime = null; } + + + var start = StartTime.Value; + + //var diff = EndTime.Value.Subtract(start); + var diff = neuerwert.Subtract(start); + + + //Diese Stelle ist wichtig + if (BeWoApp.AppSettings.IsEndDateVisible) + { + if (_Date.Value.Date == _EditableEndDate.Value.Date) + { + + if (_DurationInStunden == ZeiterfassungsDauer.Stunden) + { + if (diff.Hours > 0) // hier noch etwas genauer abfragen/ was ist wenn stunden ausgewählt und nur 30 min + { + DurationSTD = (int)diff.TotalHours; + } + else + { + StartTime = neuerwert; + DurationSTD = 0; + } + } + else + { + if (diff.Minutes > 0 || diff.Hours > 0) + { + DurationSTD = (int) diff.TotalMinutes; + } + else + { + StartTime = neuerwert; + DurationSTD = 0; + } + } + + + } + + }else{ + + if (_DurationInStunden == ZeiterfassungsDauer.Stunden) + { + var x = (decimal) diff.TotalMinutes/60; + + if (x < 0) + { + x = x * -1; + } + DurationSTD = (int)x; + } + else + { + DurationSTD = (int)diff.TotalMinutes; + } + } + } } } @@ -756,13 +923,180 @@ namespace BeWo.ViewModel set { if (BeWoApp.AppSettings.IsEndDateVisible) - { + { + + var olddate = _EditableEndDate; + // if (_EditableEndDate != value){ _EditableEndDate = value; + if (value < Date) { Date = value; } - FirePropertyChanged(PropertyName_EditableEndDate); + + //Scheise muss gefixt werden nervt nähmlich schon + + if (_EditableEndDate.Value.Date < _Date.Value.Date) + { + EditableEndDate = _Date; + } + + + if (StartTime != null && DurationSTD != 0) + { + //Muss unbeding bearbeitet werden + var start = StartTime.Value; + + + var diff = _EditableEndDate.Value.Subtract(start); + + //Mann wie soll ich das den machen + //DurationSTD = (int)diff.TotalMinutes; + if (diff.TotalHours != 0 && diff.TotalDays > 0) // die abfrage könnte fail sein + { + //hier liegt immer noch das problem. + //für die differenz startstunden mit endstunden vergleichen und zu diff total hinzuzählen + + var diffhour = EndTime.Value.Hour - start.Hour; + + + diffhour = diffhour*60; + + if (olddate != _EditableEndDate && olddate > _EditableEndDate) + { + // decimal dura = DurationSTD.Value/1440; + + // var x = olddate.Value.Day - _EditableEndDate.Value.Day; + + //int daydiff = (int) x*1440; + + + + //var ahh = _EndTime.Value.Subtract(start); + + var ahh = _EndTime.Value.Subtract(_EditableEndDate.Value); + // var x = ahh.Days - + + int s = 0; + + if (_DurationInStunden == ZeiterfassungsDauer.Stunden) + { + // s = (int)ahh.Hours; + s = ahh.Days*24; + } + else + { + // s = (int)ahh.Minutes; + s = ahh.Days*1440; + } + + + //if (s < 0) // keine ahnung glaub ich muss dass entfernen + //{ + // s = s * -1; + //} + + + + DurationSTD = DurationSTD - s; + + + + + + // DurationSTD = DurationSTD.Value - daydiff; + + } + else if (olddate != _EditableEndDate && olddate < _EditableEndDate) + { + var x = olddate.Value.Day - _EditableEndDate.Value.Day; + + int daydiff = (int)x * 1440; + + if (daydiff < 0) // keine ahnung glaub ich muss dass entfernen + { + daydiff = daydiff * -1; + } + + + if (_DurationInStunden == ZeiterfassungsDauer.Stunden) + { + daydiff = daydiff/60; + + DurationSTD = DurationSTD.Value + daydiff; + } + else + { + DurationSTD = DurationSTD.Value + daydiff; + } + + } + else + { + if (olddate.Value.Date < _Date.Value.Date) + { + DurationSTD = 0; + } + + } + } + else + { + + // dieser bereich muss kurz bearbeitet werden. + // var ahh = _EndTime.Value.Subtract(start); + + int s = 0; + + var ahh = _EndTime.Value.Subtract(_EditableEndDate.Value); + + if(_DurationInStunden == ZeiterfassungsDauer.Stunden){ + // s = (int)ahh.Hours; + s = s + (ahh.Days * 24); + } + else + { + + s = (ahh.Days * 1440); + } + + + //if (s < 0) // keine ahnung glaub ich muss dass entfernen + //{ + // s = s*-1; + //} + + + DurationSTD = DurationSTD - s; + + } + } + else + { + + StartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, 0, 0); + + _EditableEndDate.Value.AddHours(StartTime.Value.Hour); + + + var stx = _EditableEndDate.Value.Day - StartTime.Value.Day; + + int daydiff = stx*1440; + + + + if (_EditableEndDate.Value.Date < _Date.Value.Date) + { + DurationSTD = 0; + } + + //DurationSTD = daydiff; + + } + + + // FirePropertyChanged(PropertyName_EditableEndDate); + // } } } } @@ -803,16 +1137,28 @@ namespace BeWo.ViewModel { if (BeWoApp.AppSettings.IsEndDateVisible) { - if (_StartTime.Value.Second != 0) + if (_StartTime.Value.Date == null) { StartTime = new DateTime(StartTime.Value.Year, StartTime.Value.Month, StartTime.Value.Day, StartTime.Value.Hour, 0, 0); } - var start = new DateTime(StartTime.Value.Year, StartTime.Value.Month, StartTime.Value.Day, StartTime.Value.Hour, StartTime.Value.Minute, 0); + //var start = new DateTime(StartTime.Value.Year, StartTime.Value.Month, StartTime.Value.Day, StartTime.Value.Hour, StartTime.Value.Minute, 0); - var diff = _EndTime.Value.Subtract(start); + var diff = _EndTime.Value.Subtract(_StartTime.Value); Duration = (int)diff.TotalMinutes; + + + + if(_DurationInStunden == ZeiterfassungsDauer.Stunden) + { + var x = (decimal) diff.TotalMinutes / 60; + DurationSTD = (int)x; + } + else + { + DurationSTD = (int)diff.TotalHours; + } } else { @@ -826,9 +1172,25 @@ namespace BeWo.ViewModel var diff = _EndTime.Value.Subtract(start); Duration = (int)diff.TotalMinutes; + + + //hier abfragen welche zeiterfassung art es ist um die auer ensprechend anzuzeigen + //if (_DurationInStunden == ZeiterfassungsDauer.Minuten) + //{ + // DurationSTD = (int)diff.TotalMinutes; + //} + //else + //{ + // DurationSTD = (int)diff.TotalMinutes % 60; + //} + + DurationSTD = (int)diff.TotalMinutes; + + } } //TimeCheck(); + // TimeCheckForDurationSTD(false, null); FirePropertyChanged(PropertyName_EndTime); } } @@ -1245,6 +1607,7 @@ namespace BeWo.ViewModel set { + var oldStartime = _StartTime; DateTime? newStartTime = value ?? NULL_TIME; Console.WriteLine("Change StartTime " + newStartTime.Value.ToShortTimeString()); @@ -1270,6 +1633,24 @@ namespace BeWo.ViewModel diff = end.Subtract(_StartTime.Value); Duration = (int) diff.TotalMinutes; + + + //hier abfragen welche zeiterfassung art es ist um die auer ensprechend anzuzeigen + //if(_DurationInStunden == ZeiterfassungsDauer.Minuten){ + // DurationSTD = (int) diff.TotalMinutes; + //} + //else + //{ + // DurationSTD = (int)diff.TotalMinutes % 60; + //} + + + decimal x = DurationSTD.Value / 1440; + + var y = (int) 1440 * x; + + DurationSTD = (int)diff.TotalMinutes + (int)y; + } else if (Duration != null) { @@ -1277,7 +1658,8 @@ namespace BeWo.ViewModel } } - TimeCheck(); + // TimeCheck(); + // TimeCheckForDurationSTD(false,null); FirePropertyChanged(PropertyName_StartTime); } } @@ -1330,8 +1712,76 @@ namespace BeWo.ViewModel get { return ServiceRecordType == ServiceRecordTypeId.DefaultActivity; } set { ServiceRecordType = value ? ServiceRecordTypeId.DefaultActivity : ServiceRecordTypeId.Content; } + } + + public ZeiterfassungsDauer? DurationInStunden + { + get + { + if(_DurationInStunden == null) + { + _DurationInStunden = ZeiterfassungsDauer.Minuten; + + return _DurationInStunden; + } + else + { + return _DurationInStunden; + } } + set + { + + if (value == ZeiterfassungsDauer.Minuten && _DurationInStunden == ZeiterfassungsDauer.Stunden && _DurationSTD != null) + { + DurationSTD = _DurationSTD * 60; + + } + else if (value == ZeiterfassungsDauer.Stunden && _DurationInStunden == ZeiterfassungsDauer.Minuten && _DurationSTD != null && _DurationSTD >= 60) + { + DurationSTD = _DurationSTD / 60; + } + + if (AreDifferent(_DurationInStunden, value)) + { + _DurationInStunden = value; + StoreDirtyInformation(AreDifferent(DataContract.DurationInStunden, value), PropertyName_DurationInStunden); + + FirePropertyChanged(PropertyName_DurationInStunden); + FirePropertyChanged(PropertyName_DurationSTD); + + TimeCheckForDurationSTD(_DurationInStunden); + } + } + } + + + + [Validation(ValidationRule = ValidationRules.GreaterThanOrEqualZero)] + public int? DurationSTD + { + get + { + return _DurationSTD; + } + + set + { + if (AreDifferent(_DurationSTD, value)) + { + _DurationSTD = value; + + StoreDirtyInformation(AreDifferent(DataContract.RoundedDuration, value), PropertyName_DurationSTD); + + FirePropertyChanged(PropertyName_DurationSTD); + //FirePropertyChanged(PropertyName_RoundedDuration); + //Timecheck vollführen + TimeCheckForDurationSTD(_DurationInStunden); + } + } + } + #endregion #region Public Methods @@ -1445,6 +1895,9 @@ namespace BeWo.ViewModel copy.GroupOid = GroupOid; copy.GroupRoundedDuration = GroupRoundedDuration; + //?? + copy.DurationInStunden = DurationInStunden; + copy.SelectedGoals.Clear(); foreach (var item in SelectedGoals) { @@ -1467,7 +1920,7 @@ namespace BeWo.ViewModel #endregion #region Methods - + protected override void InitByDataContract(ServiceRecordDC pDataContract) { if (pDataContract.ServiceDescription != null) @@ -1528,6 +1981,8 @@ namespace BeWo.ViewModel _ServiceRecordType = pDataContract.ServiceRecordType; _DistanceInMeter = pDataContract.DistanceInMeter; + _DurationInStunden = pDataContract.DurationInStunden; + if (pDataContract.Goals != null) { _SelectedGoals = new ObservableSortCollection(pDataContract.Goals, Comparer.ValueListEntryDCComparer); @@ -1567,27 +2022,28 @@ namespace BeWo.ViewModel pDataContract.Start = new DateTime(date.Year, date.Month, date.Day, time.Hour, time.Minute, time.Second); - if (BeWoApp.AppSettings.IsEndDateVisible) - { - if (_EndTime == null || _EndTime.Value.Date < pDataContract.Start.Value.Date) - { - _EndTime = pDataContract.Start; - } + if (BeWoApp.AppSettings.IsEndDateVisible) + { + if (_EndTime == null || _EndTime.Value.Date < pDataContract.Start.Value.Date) + { + _EndTime = pDataContract.Start; + } - if (_EndTime == null || pDataContract.Start.Value.Date == _EndTime.Value.Date) - { - pDataContract.End = pDataContract.Start.Value.AddMinutes(duration); - } - else - { - pDataContract.End = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, _EndTime.Value.Second); - } - } - else - { - pDataContract.End = pDataContract.Start.Value.AddMinutes(duration); - } + if (_EndTime == null || pDataContract.Start.Value.Date == _EndTime.Value.Date) + { + pDataContract.End = pDataContract.Start.Value.AddMinutes(duration); + } + else + { + pDataContract.End = new DateTime(_EndTime.Value.Year, _EndTime.Value.Month, _EndTime.Value.Day, _EndTime.Value.Hour, _EndTime.Value.Minute, _EndTime.Value.Second); + } + } + else + { + pDataContract.End = pDataContract.Start.Value.AddMinutes(duration); + } + pDataContract.Notice = _Notice; pDataContract.Notice2 = _Notice2; pDataContract.Notice3 = _Notice3; @@ -1596,6 +2052,8 @@ namespace BeWo.ViewModel pDataContract.ServiceRecordType = _ServiceRecordType; pDataContract.DistanceInMeter = _DistanceInMeter; + pDataContract.DurationInStunden = _DurationInStunden; + pDataContract.Employee = _Employee; pDataContract.Customer = _Customer; pDataContract.SupportConcept = _SupportConcept; @@ -1653,6 +2111,141 @@ namespace BeWo.ViewModel AreDifferent(DataContract.Start,_Date.Value + _StartTime.Value.TimeOfDay), "TIME"); } + private void TimeCheckForDurationSTD(ZeiterfassungsDauer? art) + { + var duration = 0; + if (_DurationSTD.HasValue) + { + duration = _DurationSTD.Value; + } + + if (_EditableEndDate.Value.Date < _Date.Value.Date) + { + duration = 0; + } + + StoreDirtyInformation( + AreDifferent(DataContract.End, (_Date.Value + _StartTime.Value.TimeOfDay).AddMinutes(duration)) || + AreDifferent(DataContract.Start, _Date.Value + _StartTime.Value.TimeOfDay), "TIME"); + + + if (art != null) + { + if (art == ZeiterfassungsDauer.Stunden) + duration = duration * 60; + } + + + if(_StartTime.HasValue){ + if (_StartTime.Value.Year == 2000) + { + _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, DateTime.Now.Hour, 0, 0); + } + } + + + + if (_StartTime != null) + { + _EndTime = _StartTime.Value.AddMinutes(duration); + } + + if (_StartTime == null && _EndTime == null) + { + _StartTime = new DateTime(_Date.Value.Year, _Date.Value.Month, _Date.Value.Day, DateTime.Now.Hour, 0, 0); // DateTime.now Year / Month / day + _EndTime = _StartTime.Value.AddMinutes(duration); + } + + if (_StartTime == null && _EndTime != null) + { + duration = duration * -1; + + _StartTime = _EndTime.Value.AddMinutes(duration); + } + + //Hier TimeCheck für das enddatum falls aktiv + if (BeWoApp.AppSettings.IsEndDateVisible) + { + int eintag = 0; // hier der tagessatz + var adddays = 0; + + if (art == ZeiterfassungsDauer.Minuten) + { + eintag = 1440; + + }else if (art == ZeiterfassungsDauer.Stunden) + { + eintag = 24; + duration = duration/60; + } + + + if (duration == 0 || (_EndTime.Value.Date <= _EditableEndDate.Value.Date && duration < eintag)) // EditableEnddate hat die 11 dabei ist die date_time 10 + { + _EditableEndDate = _Date.Value.Date; + }else + if (duration >= eintag) + { + + decimal dura = duration / eintag; + + var x = (double) dura; + + var zwischen = _EndTime.Value.Subtract(EditableEndDate.Value); + + double eee = 0; + + if (art == ZeiterfassungsDauer.Minuten) + { + eee = zwischen.TotalMinutes; + } + else if(art == ZeiterfassungsDauer.Stunden) + { + eee = zwischen.TotalMinutes; + } + + if(_EndTime.Value.Hour > 0 && _EndTime.Value.Date != EditableEndDate.Value.Date && x <= eee ) + { + _EditableEndDate = _Date.Value.Date.AddDays(x+1); + } + else + { + _EditableEndDate = _Date.Value.Date.AddDays(x); + } + } + else if (EditableEndDate.Value.Date >= _Date.Value.Date && duration < 1440 && art != ZeiterfassungsDauer.Stunden) + { + if (_EndTime.Value.Date != _EditableEndDate.Value.Date && _EndTime.Value.Date < _EditableEndDate.Value.Date) //man warum 10 != 9 deswegen kommt der rein // die abfrage muss verbessert werden + { + _EditableEndDate = _Date.Value.Date.AddDays(1); + + }else{ + + _EditableEndDate = _Date.Value.Date; + } + } + else if (EditableEndDate.Value.Date >= _Date.Value.Date && duration < 24 && art != ZeiterfassungsDauer.Minuten) + { + + if (_EndTime.Value.Date != _EditableEndDate.Value.Date && _EndTime.Value.Date < _EditableEndDate.Value.Date ) + { + _EditableEndDate = _Date.Value.Date.AddDays(1); + + }else{ + _EditableEndDate = _Date.Value.Date; + } + } + } + + + FirePropertyChanged(PropertyName_StartTime); + FirePropertyChanged(PropertyName_EndTime); + FirePropertyChanged(PropertyName_EditableEndDate); + // FirePropertyChanged(PropertyName_EndDate); + // FirePropertyChanged(PropertyName_DurationSTD); + + } + #endregion } } \ No newline at end of file diff --git a/Data/Entities/ServiceRecord.cs b/Data/Entities/ServiceRecord.cs index 068ada24e..acd47b71e 100644 --- a/Data/Entities/ServiceRecord.cs +++ b/Data/Entities/ServiceRecord.cs @@ -46,6 +46,8 @@ namespace BeWo.Data.Entities public static string PropertyName_WohnheimbuchungsOid = "WohnheimbuchungsOid"; + public static string PropertyName_DurationInStunden = "DurationInStunden"; + private long? _WohnheimbuchungsOid; private bool _isCreatedInMobileClient; @@ -94,6 +96,8 @@ namespace BeWo.Data.Entities public virtual int? Relevance { get; set; } + private ZeiterfassungsDauer? _DurationInStunden; + public virtual bool IsCreatedInMobileClient { @@ -532,5 +536,22 @@ namespace BeWo.Data.Entities } } + + public virtual ZeiterfassungsDauer? DurationInStunden + { + get + { + return this._DurationInStunden; + } + + set + { + if (this.AreDifferent(this._DurationInStunden, value)) + { + this._DurationInStunden = value; + } + } + } + } } \ No newline at end of file diff --git a/Data/Mappings/ServiceRecord.hbm.xml b/Data/Mappings/ServiceRecord.hbm.xml index 4c3f416ec..ed8d06a51 100644 --- a/Data/Mappings/ServiceRecord.hbm.xml +++ b/Data/Mappings/ServiceRecord.hbm.xml @@ -36,6 +36,7 @@ + diff --git a/Service/DCEntityMapper/ServiceRecordDC_ServiceRecord.cs b/Service/DCEntityMapper/ServiceRecordDC_ServiceRecord.cs index 15096ab03..75ee4826e 100644 --- a/Service/DCEntityMapper/ServiceRecordDC_ServiceRecord.cs +++ b/Service/DCEntityMapper/ServiceRecordDC_ServiceRecord.cs @@ -27,6 +27,18 @@ namespace BeWo.Service.DCEntityMapper pDataContract.SignatureOid = pEntity.SignatureOid; pDataContract.ServiceRecordType = pEntity.ServiceRecordType ?? ServiceRecordTypeId.DefaultActivity; + + if (pEntity.DurationInStunden != null) + { + pDataContract.DurationInStunden = pEntity.DurationInStunden; + } + else + { + pDataContract.DurationInStunden = ZeiterfassungsDauer.Minuten; + } + + + if (pEntity.ServiceDescription != null) { pDataContract.ServiceDescription = MapperFactory.ServiceDescriptionDC_ServiceDescription.MapToNewDC(pEntity.ServiceDescription); @@ -102,6 +114,8 @@ namespace BeWo.Service.DCEntityMapper pEntity.GroupRoundedDuration = pDataContract.GroupRoundedDuration; pEntity.ServiceRecordType = pDataContract.ServiceRecordType; + pEntity.DurationInStunden = pDataContract.DurationInStunden; + pEntity.IP = pDataContract.IP; if (pEntity.ServiceDescription == null || pEntity.ServiceDescription.Oid != pDataContract.ServiceDescription.ServiceDescriptionOid) diff --git a/Shared/BeWoEntityEnums.cs b/Shared/BeWoEntityEnums.cs index f23076551..11f32546f 100644 --- a/Shared/BeWoEntityEnums.cs +++ b/Shared/BeWoEntityEnums.cs @@ -887,4 +887,10 @@ namespace BS.Shared Mittelmass, Stark } + + public enum ZeiterfassungsDauer + { + Minuten, + Stunden + } } \ No newline at end of file diff --git a/Shared/Core/EnumTranslations.cs b/Shared/Core/EnumTranslations.cs index bafd77f8e..00b5ddbc2 100644 --- a/Shared/Core/EnumTranslations.cs +++ b/Shared/Core/EnumTranslations.cs @@ -42,6 +42,8 @@ namespace BS.Shared.Core public static Dictionary AllTranslations; + public static DictionaryZeiterfassungsDauerTranslations; + static EnumTranslations() { #region UserRightType2Translations @@ -611,8 +613,23 @@ namespace BS.Shared.Core }; #endregion - #region ServiceRecordTimeIntervalTranslations - ServiceRecordTimeIntervalTranslations = new Dictionary + #region ZeiterfassungsDauerTranslations + + ZeiterfassungsDauerTranslations = new Dictionary + { + { + ZeiterfassungsDauer.Minuten, "Minuten" + }, + { + ZeiterfassungsDauer.Stunden, "Stunden" + } + }; + + + #endregion + + #region ServiceRecordTimeIntervalTranslations + ServiceRecordTimeIntervalTranslations = new Dictionary { { ServiceRecordTimeInterval.LastWeek, "Letzten 7 Tage" diff --git a/Shared/DataContracts/ServiceRecordDC.cs b/Shared/DataContracts/ServiceRecordDC.cs index 788d62569..82bdba79f 100644 --- a/Shared/DataContracts/ServiceRecordDC.cs +++ b/Shared/DataContracts/ServiceRecordDC.cs @@ -100,5 +100,10 @@ namespace BS.Shared.DataContracts public long? WohnheimbuchungsOid { get; set; } public bool AlreadyAccounted { get; set; } + + [DataMember] + public ZeiterfassungsDauer? DurationInStunden { get; set; } + + } } \ No newline at end of file