Controllogik BeginnSozialeKontakte + Tage berechnung
This commit is contained in:
@@ -287,7 +287,7 @@
|
||||
<Label Grid.Row="1" Grid.Column="3">W4020 Soziale Kontakte</Label>
|
||||
<ComboBox Grid.Row="1" Grid.Column="4" SelectedValue="{Binding EndeSozialeKontakte}" ItemsSource="{Binding WohnhilfeBoolDataTypes}"/>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource StackpanelDetailsStyle}">
|
||||
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource StackpanelDetailsStyle}" IsEnabled="{Binding CanEditBeginnKontakt}">
|
||||
<CheckBox IsChecked="{Binding BeginnKontaktPartner}">zu Partner/Partnerin</CheckBox>
|
||||
<CheckBox IsChecked="{Binding BeginnKontaktMindKinder}">zu eigenen minderjährigen Kindern</CheckBox>
|
||||
<CheckBox IsChecked="{Binding BeginnKontaktVolljahrKinderElternVerwandten}">zu volljährigen Kindern, Eltern, Verwandten</CheckBox>
|
||||
@@ -296,7 +296,7 @@
|
||||
<CheckBox IsChecked="{Binding BeginnKontaktSonstige}">sonstige</CheckBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="2" Style="{StaticResource StackpanelDetailsStyle}">
|
||||
<StackPanel Grid.Row="2" Grid.Column="3" Grid.ColumnSpan="2" Style="{StaticResource StackpanelDetailsStyle}" IsEnabled="{Binding CanEditEndeKontakt}">
|
||||
<CheckBox IsChecked="{Binding EndeKontaktPartner}">zu Partner/Partnerin</CheckBox>
|
||||
<CheckBox IsChecked="{Binding EndeKontaktMindKinder}">zu eigenen minderjährigen Kindern</CheckBox>
|
||||
<CheckBox IsChecked="{Binding EndeKontaktVolljahrKinderElternVerwandten}">zu volljährigen Kindern, Eltern, Verwandten</CheckBox>
|
||||
|
||||
@@ -102,8 +102,7 @@
|
||||
<DataTemplate>
|
||||
<wohnhilfe:CustomerWohnhilfeControl
|
||||
ParentWidth="{Binding Path=ActualWidth, ElementName=tabcontrol_NotizenKategorien}"
|
||||
IsLarge="{Binding DataContext.IsLarge, ElementName=tabcontrol_NotizenKategorien, Mode=TwoWay,Converter={StaticResource TestDebugConverter}}"
|
||||
/>
|
||||
IsLarge="{Binding DataContext.IsLarge, ElementName=tabcontrol_NotizenKategorien, Mode=TwoWay}" />
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
</TabControl>
|
||||
|
||||
@@ -9,6 +9,9 @@ namespace BeWo.ViewModel.Wohnhilfe
|
||||
{
|
||||
public class CustomerWohnhilfeBereichSozialeKontakteVM : AbstractDCMapperVM<CustomerWohnhilfeBereichSozialeKontakteDC>
|
||||
{
|
||||
private bool _CanEditBeginnKontakt;
|
||||
private bool _CanEditEndeKontakt;
|
||||
|
||||
private WohnhilfeBoolData _BeginnSozialeKontakte;
|
||||
private bool _BeginnKontaktPartner;
|
||||
private bool _BeginnKontaktMindKinder;
|
||||
@@ -45,6 +48,33 @@ namespace BeWo.ViewModel.Wohnhilfe
|
||||
public IEnumerable<Krankenversicherung> KrankenversicherungTypes => Utils.GetAllEnumValues<Krankenversicherung>();
|
||||
public IEnumerable<KontaktArzt> KontaktArztTypes => Utils.GetAllEnumValues<KontaktArzt>();
|
||||
|
||||
|
||||
public bool CanEditBeginnKontakt
|
||||
{
|
||||
get { return _CanEditBeginnKontakt; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_CanEditBeginnKontakt, value))
|
||||
return;
|
||||
|
||||
_CanEditBeginnKontakt = value;
|
||||
FirePropertyChanged(nameof(CanEditBeginnKontakt));
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanEditEndeKontakt
|
||||
{
|
||||
get { return _CanEditEndeKontakt; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_CanEditEndeKontakt, value))
|
||||
return;
|
||||
|
||||
_CanEditEndeKontakt = value;
|
||||
FirePropertyChanged(nameof(CanEditEndeKontakt));
|
||||
}
|
||||
}
|
||||
|
||||
public WohnhilfeBoolData BeginnSozialeKontakte
|
||||
{
|
||||
get { return _BeginnSozialeKontakte; }
|
||||
@@ -56,6 +86,8 @@ namespace BeWo.ViewModel.Wohnhilfe
|
||||
_BeginnSozialeKontakte = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.BeginnSozialeKontakte, value), nameof(BeginnSozialeKontakte));
|
||||
FirePropertyChanged(nameof(BeginnSozialeKontakte));
|
||||
|
||||
CanEditBeginnKontakt = value == WohnhilfeBoolData.Ja;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,6 +186,8 @@ namespace BeWo.ViewModel.Wohnhilfe
|
||||
_EndeSozialeKontakte = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.EndeSozialeKontakte, value), nameof(EndeSozialeKontakte));
|
||||
FirePropertyChanged(nameof(EndeSozialeKontakte));
|
||||
|
||||
CanEditEndeKontakt = value == WohnhilfeBoolData.Ja;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,8 @@ namespace BeWo.ViewModel.Wohnhilfe
|
||||
_Betreuungsbeginn = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Betreuungsbeginn, value), nameof(Betreuungsbeginn));
|
||||
FirePropertyChanged(nameof(Betreuungsbeginn));
|
||||
|
||||
UpdateBetreuungsdauerInTagen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +140,8 @@ namespace BeWo.ViewModel.Wohnhilfe
|
||||
_Betreuungsende = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Betreuungsende, value), nameof(Betreuungsende));
|
||||
FirePropertyChanged(nameof(Betreuungsende));
|
||||
|
||||
UpdateBetreuungsdauerInTagen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,5 +340,21 @@ namespace BeWo.ViewModel.Wohnhilfe
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
|
||||
private void UpdateBetreuungsdauerInTagen()
|
||||
{
|
||||
if (!_Betreuungsbeginn.HasValue || !_Betreuungsende.HasValue)
|
||||
return;
|
||||
|
||||
var beginn = _Betreuungsbeginn.Value;
|
||||
var ende = _Betreuungsende.Value;
|
||||
|
||||
if (beginn > ende)
|
||||
return;
|
||||
|
||||
var timespan = ende - beginn;
|
||||
|
||||
BetreuungsdauerInTagen = (int)timespan.TotalDays + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user