MH: Varfields für Wohnheime

This commit is contained in:
2025-11-03 14:19:19 +01:00
parent 2ac47e2d69
commit 591ce4c888
8 changed files with 73 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
xmlns:localWohneinheit="clr-namespace:BeWo.View.Detail.Wohneinheit"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:uvc="clr-namespace:BeWo.View.Controls"
xmlns:val="clr-namespace:BeWo.Validation"
@@ -319,6 +320,11 @@
</Grid>
</ScrollViewer>
</TabItem>
<TabItem Name="tabitem_varFields" Header="{markup:Translate WohnheimVarFieldsTitle}">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<localView:VarFieldView VarFieldList="{Binding VarFields}" />
</ScrollViewer>
</TabItem>
<TabItem Header="{t:Translate Klienten}">
<Grid>
<Grid.ColumnDefinitions>

View File

@@ -48,6 +48,8 @@ namespace BeWo.View.Detail
ViewModel = vm;
_Customers = vm.Customers;
InitializeComponent();
@@ -100,6 +102,11 @@ namespace BeWo.View.Detail
root_wohneinheit.SelectedIndex = 2;
}
#endif
if (vm.VarFields == null || vm.VarFields.VMList.Count == 0)
{
tabitem_varFields.Visibility = Visibility.Collapsed;
}
}
private void UserControl_GotFocus(object sender, RoutedEventArgs e)

View File

@@ -35,6 +35,8 @@ namespace BeWo.ViewModel
public static string PropertyName_StandardZeilenanzahl = "StandardZeilenanzahl";
public static string PropertyName_Sortierungsart = "Sortierungsart";
public static string PropertyName_AbsteigendeSortierung = "AbsteigendeSortierung";
public static string PropertyName_VarFields = "VarFields";
//##################################################################
#endregion
@@ -51,6 +53,7 @@ namespace BeWo.ViewModel
private int _Sortierungsart;
private int _AbsteigendeSortierung;
private bool _IsArchived;
private VarFieldListVM _VarFields;
//##################################################################
@@ -90,6 +93,7 @@ namespace BeWo.ViewModel
{
return base.IsDirty || WohnheimEmployeeRelations.IsDirty
|| WohnheimCustomerRelations.IsDirty
|| this._VarFields.IsDirty
|| WohneinheitListVM.IsDirty
|| WohneinheitBelegungListVM.IsDirty;
}
@@ -342,8 +346,20 @@ namespace BeWo.ViewModel
FirePropertyChanged(PropertyName_WohnheimTeamRelations);
}
}
public VarFieldListVM VarFields
{
get { return this._VarFields; }
set
{
if (this.AreDifferent(this._VarFields, value))
{
this._VarFields = value;
this.FirePropertyChanged(PropertyName_VarFields);
}
}
}
public bool AddBelegung(object wohneinheit_oid = null, DateTime? start = null)
{
@@ -389,6 +405,8 @@ namespace BeWo.ViewModel
protected override void InitByDataContract(WohnheimDC pDataContract)
{
this._VarFields = new VarFieldListVM(pDataContract.VarFields);
_WohnheimName = pDataContract.WohnheimName;
_Strasse = pDataContract.Strasse;
_PLZ = pDataContract.PLZ;
@@ -435,6 +453,11 @@ namespace BeWo.ViewModel
//pDataContract.Wohneinheiten = _WohneinheitListVM.CopyToDCList(doCommit);
if (this._VarFields != null)
{
pDataContract.VarFields = this._VarFields.CopyToDCList(doCommit);
}
pDataContract.Wohneinheiten = null;
var einheit_vm2dc = new Dictionary<WohneinheitVM, WohneinheitDC>();
foreach (var vm in _WohneinheitListVM.VMList)

View File

@@ -31,12 +31,16 @@ namespace BeWo.Data.Entities
public static string PropertyName_AbsteigendeSortierung = "AbsteigendeSortierung";
public static string PropertyName_VarFieldValueList = "VarFieldValueList";
private IList<Employee2Wohnheim> _Employee2WohnheimList;
private IList<Customer2Wohnheim> _Customer2WohnheimList;
private IList<Wohneinheit> _Wohneinheiten;
private IList<VarFieldValue> _VarFieldValueList;
public virtual string WohnheimName { get; set; }
public virtual string Strasse { get; set; }
@@ -58,6 +62,23 @@ namespace BeWo.Data.Entities
public virtual int Sortierungsart { get; set; }
public virtual int AbsteigendeSortierung { get; set; }
public Wohnheim()
{
this._Tid = TableID.Wohnheim;
}
public virtual IList<VarFieldValue> VarFieldValueList
{
get { return _VarFieldValueList ?? (_VarFieldValueList = new List<VarFieldValue>()); }
set
{
if (AreDifferent(_VarFieldValueList, value))
{
_VarFieldValueList = value;
}
}
}
public virtual IList<Employee2Wohnheim> Employee2WohnheimList

View File

@@ -37,5 +37,9 @@
<key column="WohnheimOid" not-null="true"/>
<one-to-many class="BeWo.Data.Entities.Wohneinheit,BeWo.Data" />
</bag>
<bag name="VarFieldValueList" table="VarFieldValue" generic="true" cascade="all-delete-orphan" where="ObjectTid = 103 AND IsActive=1" batch-size="250">
<key column="ObjectOid" />
<one-to-many class="BeWo.Data.Entities.VarFieldValue, BeWo.Data" />
</bag>
</class>
</hibernate-mapping>

View File

@@ -1,6 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BS.Shared;
@@ -32,6 +32,9 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.RelatedCustomers = MapperFactory.CustomerWohnheimRelDC_Customer2WohnheimMapper.MapToNewDCs(pEntity.Customer2WohnheimList);
pDataContract.Wohneinheiten = MapperFactory.WohneinheitDC_Wohneinheit.MapToNewDCs(pEntity.Wohneinheiten);
var defs = DAOFactory.SearchDAO.GetVarFieldDefs(TableID.Wohnheim);
pDataContract.VarFields = MapperFactory.VarFieldDC_VarField.VarFieldMapToDCs(defs, pEntity.VarFieldValueList);
return pDataContract;
}
@@ -51,10 +54,13 @@ namespace BeWo.Service.DCEntityMapper
pEntity.Sortierungsart = pDataContract.Sortierungsart;
pEntity.AbsteigendeSortierung = pDataContract.AbsteigendeSortierung;
pEntity.VarFieldValueList = MapperFactory.VarFieldDC_VarField.VarFieldMergeToEntity(pEntity.VarFieldValueList, pDataContract.VarFields, pEntity);
MapperFactory.EmployeeWohnheimRelDC_Employee2WohnheimMapper.MergeWithEntitys(pDataContract.RelatedEmployees, pEntity.Employee2WohnheimList);
MapperFactory.CustomerWohnheimRelDC_Customer2WohnheimMapper.MergeWithEntitys(pDataContract.RelatedCustomers, pEntity.Customer2WohnheimList);
MapperFactory.WohneinheitDC_Wohneinheit.MergeWithEntitys(pDataContract.Wohneinheiten, pEntity.Wohneinheiten, pEntity);
return pEntity;
}

View File

@@ -67,6 +67,7 @@ namespace BeWo.Service.Plugins
AddOrReplaceTranslation(dict, "OrganisationVarFieldsTitle", "Weitere Eigenschaften");
AddOrReplaceTranslation(dict, "PersonVarFieldsTitle", "Weitere Eigenschaften");
AddOrReplaceTranslation(dict, "TeamVarFieldsTitle", "Weitere Eigenschaften");
AddOrReplaceTranslation(dict, "WohnheimVarFieldsTitle", "Weitere Eigenschaften");
AddOrReplaceTranslation(dict, "NotizenHeader", "Notizen");
AddOrReplaceTranslation(dict, "CustomerNotizen", "Notizen");

View File

@@ -54,6 +54,9 @@ namespace BS.Shared.DataContracts
[DataMember]
public List<WohneinheitDC> Wohneinheiten { get; set; }
[DataMember]
public List<VarFieldDC> VarFields { get; set; }
public override string ToString()
{
return WohnheimName;