Copy Insert

This commit is contained in:
2024-09-04 16:05:38 +02:00
parent fde0e792da
commit 9c3268b4d4
7 changed files with 66 additions and 15 deletions

View File

@@ -14,13 +14,14 @@ namespace BeWo
public class DebugConfig
{
private static DebugConfig _CurrentConfig;
public static DebugConfig CurrentConfig
{
get
{
#if DEBUG
return FeatureWohnhilfe;
return _CurrentConfig ?? (_CurrentConfig = FeatureWohnhilfe);
#endif

View File

@@ -8,12 +8,13 @@
xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:viewmodel="clr-namespace:BeWo.ViewModel"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:wohnhilfe="clr-namespace:BeWo.View.Controls.Wohnhilfe"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:wohnhilfe="clr-namespace:BeWo.View.Controls.Wohnhilfe" xmlns:converter="clr-namespace:BeWo.Converter"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewmodel:CustomerVM, IsDesignTimeCreatable=true}"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Margin" Value="3"/>
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsEnabled}" Value="False">
@@ -29,7 +30,7 @@
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button Content="Neue Wohnhilfe hinzufügen" Margin="3" Command="{Binding AddWohnhilfeCommand}">
<Button Content="Neue Wohnhilfe hinzufügen" Command="{Binding AddWohnhilfeCommand}">
<!--<Button.Style>
<Style TargetType="Button"
BasedOn="{StaticResource {x:Type Button}}">
@@ -41,6 +42,22 @@
</Style>
</Button.Style>-->
</Button>
<Button Content="Übertragen" ToolTip="Daten aus den Stammdaten in aktuelle Wohnhilfe übernehmen" Command="{Binding InsertDetailsCommand}">
<Button.Visibility>
<MultiBinding Converter="{StaticResource BoolVisibilityMultiConverter }">
<Binding Path="VMList.Count" Converter="{StaticResource CollectionCountToBoolConverter}"/>
<Binding Path="PermissionCustomerWohnhilfeEdit" ElementName="root_control" />
</MultiBinding>
</Button.Visibility>
</Button>
<Button Content="Kopieren" ToolTip="Aktuelle Wohnhilfe kopieren" Command="{Binding CopySelectedWohnhilfeCommand}">
<Button.Visibility>
<MultiBinding Converter="{StaticResource BoolVisibilityMultiConverter }">
<Binding Path="VMList.Count" Converter="{StaticResource CollectionCountToBoolConverter}"/>
<Binding Path="PermissionCustomerWohnhilfeCreate" ElementName="root_control" />
</MultiBinding>
</Button.Visibility>
</Button>
</StackPanel>
<TabControl Grid.Row="1" Margin="5"
ItemsSource="{Binding VMList}"
@@ -52,7 +69,7 @@
<Label Content="{Binding Displayname}" />
<Button VerticalAlignment="Center" Height="20"
ToolTip="Kategorie umbenennen"
Margin="3" Content="!" FontFamily="Wingdings"
Content="!" FontFamily="Wingdings"
Click="Wohnhilfe_Display_Edit_Button_Click">
<Button.Visibility>
<MultiBinding Converter="{StaticResource BoolVisibilityMultiConverter }">
@@ -64,7 +81,7 @@
<Button VerticalAlignment="Center" Height="20"
Tag="{Binding}"
ToolTip="Wohnhilfe entfernen"
Style="{DynamicResource CloseButtonStyle}" Margin="3"
Style="{DynamicResource CloseButtonStyle}"
Command="{Binding Path=DataContext.DeleteWohnhilfeCommand, RelativeSource={RelativeSource AncestorType=TabControl}}">
<Button.Visibility>
<MultiBinding Converter="{StaticResource BoolVisibilityMultiConverter }">

View File

@@ -20,6 +20,7 @@ namespace BeWo.View.Detail
/// </summary>
public partial class CustomerWohnhilfeView : UserControl
{
public bool PermissionCustomerWohnhilfeCreate { get; } = BeWoApp.HasLoggedOnUserRight(BS.Shared.UserRightType.Customer_Wohnhilfe_Create);
public bool PermissionCustomerWohnhilfeEdit { get; } = BeWoApp.HasLoggedOnUserRight(BS.Shared.UserRightType.Customer_Wohnhilfe_Edit);
public bool PermissionCustomerWohnhilfeDelete { get; } = BeWoApp.HasLoggedOnUserRight(BS.Shared.UserRightType.Customer_Wohnhilfe_Delete);

View File

@@ -123,7 +123,14 @@ namespace BeWo.ViewModel
protected override CustomerWohnhilfeDC MapToDataContract(CustomerWohnhilfeDC pDataContract, bool doCommit)
{
throw new NotImplementedException();
pDataContract.Dispalyname = _Displayname;
pDataContract.BereichBundDC = _BereichBundVM.CommitToDataContract();
pDataContract.BereichEinkommenUndArbeitDC = _BereichEinkommenUndArbeitVM.CommitToDataContract();
pDataContract.BereichSozialeKontakteDC = _BereichSozialeKontakteVM.CommitToDataContract();
pDataContract.BereichSozialstrukturDC = _BereichSozialstrukturVM.CommitToDataContract();
return pDataContract;
}
}
}

View File

@@ -153,7 +153,6 @@ namespace BeWo.ViewModel.ListViewModel
}
}
public virtual VMType AddNewVMToList()
{
VMList.Add(NewVM);
@@ -194,7 +193,7 @@ namespace BeWo.ViewModel.ListViewModel
FirePropertyChanged(nameof(VMList));
NewVM = null;
return EditVM;
return SelectedVM;
}
public virtual List<DCType> CommitAdded()

View File

@@ -14,6 +14,8 @@ namespace BeWo.ViewModel.ListViewModel
{
public DelegateCommand AddWohnhilfeCommand { get; set; }
public DelegateCommand DeleteWohnhilfeCommand { get; set; }
public DelegateCommand CopySelectedWohnhilfeCommand { get; set; }
public DelegateCommand InsertDetailsCommand { get; set; }
public CustomerVM Customer { get; set; }
@@ -25,18 +27,41 @@ namespace BeWo.ViewModel.ListViewModel
AddWohnhilfeCommand = new DelegateCommand(() => AddNewVMToListAndSelect(true), CanAddWohnhilfe);
DeleteWohnhilfeCommand = new DelegateCommand(() => DeleteSelectedVM($"Wohnhilfe '{SelectedVM.Displayname}'"), CanDeleteWohnhilfe);
//AddWohnhilfeCommand.RaiseCanExecuteChanged();
DeleteWohnhilfeCommand = new DelegateCommand(() => DeleteSelectedVM($"Wohnhilfe '{SelectedVM.Displayname}'"));
CopySelectedWohnhilfeCommand = new DelegateCommand(CopySelectedWohnhilfe);
InsertDetailsCommand = new DelegateCommand(InsertDetails);
}
public void CopySelectedWohnhilfe()
{
var old_vm = SelectedVM;
var new_vm = AddNewVMToListAndSelect(true);
new_vm.BereichBundVM.AlterAmStichtag = old_vm.BereichBundVM.AlterAmStichtag;
new_vm.BereichBundVM.Angebot = old_vm.BereichBundVM.Angebot;
new_vm.BereichBundVM.BerichtseinheitID = old_vm.BereichBundVM.BerichtseinheitID;
new_vm.BereichBundVM.Geschlecht = old_vm.BereichBundVM.Geschlecht;
new_vm.BereichBundVM.Haushaltsgrosse = old_vm.BereichBundVM.Haushaltsgrosse;
new_vm.BereichBundVM.OrtDerEinrichtung = old_vm.BereichBundVM.OrtDerEinrichtung;
new_vm.BereichBundVM.Unterbringungsart = old_vm.BereichBundVM.Unterbringungsart;
new_vm.BereichBundVM.Verbandszugehorigkeit = old_vm.BereichBundVM.Verbandszugehorigkeit;
new_vm.BereichSozialstrukturVM.Geburtsdatum = old_vm.BereichSozialstrukturVM.Geburtsdatum;
}
public void InsertDetails()
{
var selected_vm = SelectedVM;
selected_vm.BereichSozialstrukturVM.Geburtsdatum = Customer.DateOfBirth;
}
public bool CanAddWohnhilfe()
{
return BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Wohnhilfe_Create);
}
public bool CanDeleteWohnhilfe()
{
return BeWoApp.HasLoggedOnUserRight(UserRightType.Customer_Wohnhilfe_Delete);
}
}
}

View File

@@ -107,6 +107,7 @@ namespace BeWo.ViewModel.Wohnhilfe
}
}
[Validation(ValidationRule = ValidationRules.GreaterThanZero)]
public Unterbringungsart? Unterbringungsart
{
get { return _Unterbringungsart; }