2016-06-27 01:45:38 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using BeWo.Core;
|
|
|
|
|
|
using BeWo.Validation;
|
|
|
|
|
|
using BeWo.ViewModel.ListViewModel;
|
|
|
|
|
|
using BS.Shared;
|
|
|
|
|
|
using BS.Shared.Core;
|
|
|
|
|
|
using BS.Shared.DataContracts;
|
|
|
|
|
|
using BS.Shared.Extensions;
|
|
|
|
|
|
using System.Windows.Forms;
|
2021-12-01 14:09:56 +01:00
|
|
|
|
using BS.Shared.DataContracts.Compact;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
namespace BeWo.ViewModel
|
|
|
|
|
|
{
|
|
|
|
|
|
public class WohnheimVM : AbstractDCMapperVM<WohnheimDC>
|
|
|
|
|
|
{
|
|
|
|
|
|
#region Property Names
|
|
|
|
|
|
|
|
|
|
|
|
public static string PropertyName_WohnheimEmployeeRelations = "WohnheimEmployeeRelations";
|
|
|
|
|
|
public static string PropertyName_WohnheimCustomerRelations = "WohnheimCustomerRelations";
|
2021-12-01 14:09:56 +01:00
|
|
|
|
public static string PropertyName_WohnheimTeamRelations = "WohnheimTeamRelations";
|
2016-06-27 01:45:38 +02:00
|
|
|
|
public static string PropertyName_IsArchived = "IsArchived";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//##################### Erstellte Variablen #######################
|
|
|
|
|
|
public static string PropertyName_WohnheimName = "WohnheimName";
|
|
|
|
|
|
public static string PropertyName_PLZ = "PLZ";
|
|
|
|
|
|
public static string PropertyName_Ort = "Ort";
|
|
|
|
|
|
public static string PropertyName_Bemerkung = "Bemerkung";
|
|
|
|
|
|
public static string PropertyName_Street = "Strasse";
|
2022-03-22 11:38:58 +01:00
|
|
|
|
public static string PropertyName_PflichtbesetzungStart = "PflichtbesetzungStart";
|
|
|
|
|
|
public static string PropertyName_PflichtbesetzungEnde = "PflichtbesetzungEnde";
|
|
|
|
|
|
public static string PropertyName_PflichtbesetzungEinblenden = "PflichtbesetzungEinblenden";
|
2022-03-25 15:05:39 +01:00
|
|
|
|
public static string PropertyName_StandardZeilenanzahl = "StandardZeilenanzahl";
|
2022-06-07 16:14:23 +02:00
|
|
|
|
public static string PropertyName_Sortierungsart = "Sortierungsart";
|
|
|
|
|
|
public static string PropertyName_AbsteigendeSortierung = "AbsteigendeSortierung";
|
2025-11-03 14:19:19 +01:00
|
|
|
|
public static string PropertyName_VarFields = "VarFields";
|
|
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
//##################################################################
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//##################### Erstellte Variablen #######################
|
|
|
|
|
|
private string _WohnheimName;
|
|
|
|
|
|
private string _Strasse;
|
|
|
|
|
|
private string _PLZ;
|
|
|
|
|
|
private string _Ort;
|
|
|
|
|
|
private string _Bemerkung;
|
2022-03-22 11:38:58 +01:00
|
|
|
|
private string _PflichtbesetzungStart;
|
|
|
|
|
|
private string _PflichtbesetzungEnde;
|
|
|
|
|
|
private int _PflichtbesetzungEinblenden;
|
2022-03-25 15:05:39 +01:00
|
|
|
|
private int _StandardZeilenanzahl;
|
2022-06-07 16:14:23 +02:00
|
|
|
|
private int _Sortierungsart;
|
|
|
|
|
|
private int _AbsteigendeSortierung;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
private bool _IsArchived;
|
2025-11-03 14:19:19 +01:00
|
|
|
|
private VarFieldListVM _VarFields;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
//##################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private WohnheimEmployeeRelationListVM _WohnheimEmployeeRelations;
|
|
|
|
|
|
private WohnheimCustomerRelationListVM _WohnheimCustomerRelations;
|
2024-07-16 15:07:59 +02:00
|
|
|
|
private WohneinheitListVM _WohneinheitListVM;
|
2024-08-15 14:10:38 +02:00
|
|
|
|
private WohneinheitBelegungListVM _WohneinheitBelegungListVM;
|
2021-12-01 14:09:56 +01:00
|
|
|
|
private CompactTeamDC _WohnheimTeamRelations;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
2024-08-06 11:52:28 +02:00
|
|
|
|
public WohnheimVM()
|
|
|
|
|
|
{
|
|
|
|
|
|
_WohnheimName = "Design Test";
|
|
|
|
|
|
|
|
|
|
|
|
PermissionWohneinheitView = true;
|
|
|
|
|
|
|
|
|
|
|
|
PermissionWohneinheitBelegungView = true;
|
2024-08-13 09:25:10 +02:00
|
|
|
|
|
2024-08-28 11:27:04 +02:00
|
|
|
|
var vms = new System.ComponentModel.BindingList<WohneinheitVM>()
|
|
|
|
|
|
{
|
|
|
|
|
|
new WohneinheitVM(),
|
|
|
|
|
|
new WohneinheitVM()
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
WohneinheitListVM = new WohneinheitListVM();
|
|
|
|
|
|
WohneinheitListVM.VMList = vms;
|
2024-08-06 11:52:28 +02:00
|
|
|
|
}
|
2024-08-14 16:44:17 +02:00
|
|
|
|
public WohnheimVM(WohnheimDC pWohnheimDC, List<CompactCustomerDC> customers)
|
2016-06-27 01:45:38 +02:00
|
|
|
|
: base(pWohnheimDC, pWohnheimDC.WohnheimOid == null)
|
|
|
|
|
|
{
|
2024-08-14 16:44:17 +02:00
|
|
|
|
Customers = customers;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool IsDirty
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2024-07-23 11:35:36 +02:00
|
|
|
|
return base.IsDirty || WohnheimEmployeeRelations.IsDirty
|
|
|
|
|
|
|| WohnheimCustomerRelations.IsDirty
|
2025-11-03 14:19:19 +01:00
|
|
|
|
|| this._VarFields.IsDirty
|
2024-08-15 14:10:38 +02:00
|
|
|
|
|| WohneinheitListVM.IsDirty
|
|
|
|
|
|
|| WohneinheitBelegungListVM.IsDirty;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-14 16:44:17 +02:00
|
|
|
|
public List<CompactCustomerDC> Customers { get; set; }
|
|
|
|
|
|
|
2024-08-13 12:39:31 +02:00
|
|
|
|
public TimeSpan IntervalRange { get; set; }
|
|
|
|
|
|
public bool IntervalChanging { get; set; }
|
2024-08-26 10:51:16 +02:00
|
|
|
|
|
2024-08-06 11:52:28 +02:00
|
|
|
|
public bool PermissionWohneinheitTabitemView => PermissionWohneinheitView || PermissionWohneinheitBelegungView;
|
|
|
|
|
|
|
|
|
|
|
|
public bool PermissionWohneinheitView { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.WohnheimView_Wohneinheit_View);
|
|
|
|
|
|
public bool PermissionWohneinheitBelegungView { get; } = BeWoApp.HasLoggedOnUserRight(UserRightType.WohnheimView_Wohneinheit_Belegung_View);
|
2024-08-06 15:06:23 +02:00
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
public bool IsArchived
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _IsArchived; }
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (AreDifferent(_IsArchived, value))
|
|
|
|
|
|
{
|
|
|
|
|
|
_IsArchived = value;
|
|
|
|
|
|
StoreDirtyInformation(
|
|
|
|
|
|
(value && DataContract.ActivationType == ActivationTypeId.Active) ||
|
|
|
|
|
|
(!value && DataContract.ActivationType == ActivationTypeId.Archived), PropertyName_IsArchived);
|
|
|
|
|
|
FirePropertyChanged(PropertyName_IsArchived);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//Setter und Getter
|
|
|
|
|
|
public String WohnheimName
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _WohnheimName;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_WohnheimName = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.WohnheimName, value), PropertyName_WohnheimName);
|
|
|
|
|
|
FirePropertyChanged(PropertyName_WohnheimName);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public String Strasse
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _Strasse;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_Strasse = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.Strasse, value), PropertyName_Street);
|
|
|
|
|
|
FirePropertyChanged(PropertyName_Street);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public String PLZ
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _PLZ;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_PLZ = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.PLZ, value), PropertyName_PLZ);
|
|
|
|
|
|
FirePropertyChanged(PropertyName_PLZ);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public String Ort
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _Ort;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_Ort = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.Ort, value), PropertyName_Ort);
|
|
|
|
|
|
FirePropertyChanged(PropertyName_Ort);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public String Bemerkung
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _Bemerkung;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_Bemerkung = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.Bemerkung, value), PropertyName_Bemerkung);
|
|
|
|
|
|
|
|
|
|
|
|
FirePropertyChanged(PropertyName_Bemerkung);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-03-22 11:38:58 +01:00
|
|
|
|
public String PflichtbesetzungStart
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _PflichtbesetzungStart;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_PflichtbesetzungStart = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.PflichtbesetzungStart, value), PropertyName_PflichtbesetzungStart);
|
|
|
|
|
|
|
|
|
|
|
|
FirePropertyChanged(PropertyName_PflichtbesetzungStart);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public String PflichtbesetzungEnde
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _PflichtbesetzungEnde;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_PflichtbesetzungEnde = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.PflichtbesetzungEnde, value), PropertyName_PflichtbesetzungEnde);
|
|
|
|
|
|
|
|
|
|
|
|
FirePropertyChanged(PropertyName_PflichtbesetzungEnde);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public int PflichtbesetzungEinblenden
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _PflichtbesetzungEinblenden;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_PflichtbesetzungEinblenden = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.PflichtbesetzungEinblenden, value), PropertyName_PflichtbesetzungEinblenden);
|
|
|
|
|
|
|
|
|
|
|
|
FirePropertyChanged(PropertyName_PflichtbesetzungEinblenden);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
2022-03-25 15:05:39 +01:00
|
|
|
|
public int StandardZeilenanzahl
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _StandardZeilenanzahl;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_StandardZeilenanzahl = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.StandardZeilenanzahl, value), PropertyName_StandardZeilenanzahl);
|
|
|
|
|
|
|
|
|
|
|
|
FirePropertyChanged(PropertyName_StandardZeilenanzahl);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-07 16:14:23 +02:00
|
|
|
|
public int Sortierungsart
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _Sortierungsart;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_Sortierungsart = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.Sortierungsart, value), PropertyName_Sortierungsart);
|
|
|
|
|
|
|
|
|
|
|
|
FirePropertyChanged(PropertyName_Sortierungsart);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public int AbsteigendeSortierung
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _AbsteigendeSortierung;
|
|
|
|
|
|
}
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_AbsteigendeSortierung = value;
|
|
|
|
|
|
StoreDirtyInformation(AreDifferent(DataContract.AbsteigendeSortierung, value), PropertyName_AbsteigendeSortierung);
|
|
|
|
|
|
|
|
|
|
|
|
FirePropertyChanged(PropertyName_AbsteigendeSortierung);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-03-25 15:05:39 +01:00
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
public WohnheimEmployeeRelationListVM WohnheimEmployeeRelations
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _WohnheimEmployeeRelations; }
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_WohnheimEmployeeRelations = value;
|
|
|
|
|
|
FirePropertyChanged(PropertyName_WohnheimEmployeeRelations);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public WohnheimCustomerRelationListVM WohnheimCustomerRelations
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _WohnheimCustomerRelations; }
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_WohnheimCustomerRelations = value;
|
|
|
|
|
|
FirePropertyChanged(PropertyName_WohnheimCustomerRelations);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-07-16 15:07:59 +02:00
|
|
|
|
public WohneinheitListVM WohneinheitListVM
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _WohneinheitListVM; }
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
2024-08-15 14:10:38 +02:00
|
|
|
|
if (_WohneinheitListVM == value)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
2024-07-16 15:07:59 +02:00
|
|
|
|
_WohneinheitListVM = value;
|
|
|
|
|
|
FirePropertyChanged(nameof(WohneinheitListVM));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-08-15 14:10:38 +02:00
|
|
|
|
public WohneinheitBelegungListVM WohneinheitBelegungListVM
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _WohneinheitBelegungListVM; }
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_WohneinheitBelegungListVM == value)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
_WohneinheitBelegungListVM = value;
|
|
|
|
|
|
FirePropertyChanged(nameof(WohneinheitBelegungListVM));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-07-16 15:07:59 +02:00
|
|
|
|
|
2021-12-01 14:09:56 +01:00
|
|
|
|
public CompactTeamDC WohnheimTeamRelations
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return _WohnheimTeamRelations; }
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_WohnheimTeamRelations = value;
|
|
|
|
|
|
FirePropertyChanged(PropertyName_WohnheimTeamRelations);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-11-03 14:19:19 +01:00
|
|
|
|
public VarFieldListVM VarFields
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return this._VarFields; }
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
if (this.AreDifferent(this._VarFields, value))
|
|
|
|
|
|
{
|
|
|
|
|
|
this._VarFields = value;
|
|
|
|
|
|
this.FirePropertyChanged(PropertyName_VarFields);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
2024-08-16 14:32:48 +02:00
|
|
|
|
|
2024-08-19 11:12:30 +02:00
|
|
|
|
public bool AddBelegung(object wohneinheit_oid = null, DateTime? start = null)
|
2024-08-16 14:32:48 +02:00
|
|
|
|
{
|
2024-09-18 15:44:35 +02:00
|
|
|
|
if (!WohneinheitBelegungListVM.PermissionWohneinheitBelegungManage)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
2024-08-16 14:32:48 +02:00
|
|
|
|
var beleg_list_vm = WohneinheitBelegungListVM;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
2024-08-16 14:32:48 +02:00
|
|
|
|
var vm = beleg_list_vm.NewVM;
|
|
|
|
|
|
|
|
|
|
|
|
var today = DateTime.Today;
|
|
|
|
|
|
var first_next_month = new DateTime(today.Year, today.Month, 1);
|
|
|
|
|
|
|
|
|
|
|
|
vm.StartDate = first_next_month;
|
|
|
|
|
|
|
|
|
|
|
|
if(wohneinheit_oid is long oid)
|
|
|
|
|
|
{
|
|
|
|
|
|
vm.Wohneinheit = WohneinheitListVM.VMList.First(x => x.Oid == oid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-19 11:12:30 +02:00
|
|
|
|
if(start is DateTime startDate)
|
|
|
|
|
|
{
|
|
|
|
|
|
vm.StartDate = startDate;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-16 14:32:48 +02:00
|
|
|
|
beleg_list_vm.CurrentVM = vm;
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
public bool EditBelegung(WohneinheitBelegungVM vm)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (vm is null || !WohneinheitBelegungListVM.VMList.Contains(vm))
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
2024-09-18 15:44:35 +02:00
|
|
|
|
if (!WohneinheitBelegungListVM.PermissionWohneinheitBelegungManage)
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
2024-08-16 14:32:48 +02:00
|
|
|
|
WohneinheitBelegungListVM.EditVM = vm;
|
|
|
|
|
|
WohneinheitBelegungListVM.CurrentVM = vm;
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
protected override void InitByDataContract(WohnheimDC pDataContract)
|
|
|
|
|
|
{
|
2025-11-03 14:19:19 +01:00
|
|
|
|
this._VarFields = new VarFieldListVM(pDataContract.VarFields);
|
|
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
_WohnheimName = pDataContract.WohnheimName;
|
|
|
|
|
|
_Strasse = pDataContract.Strasse;
|
|
|
|
|
|
_PLZ = pDataContract.PLZ;
|
|
|
|
|
|
_Ort = pDataContract.Ort;
|
|
|
|
|
|
_Bemerkung = pDataContract.Bemerkung;
|
2022-03-22 11:38:58 +01:00
|
|
|
|
_PflichtbesetzungStart = pDataContract.PflichtbesetzungStart;
|
|
|
|
|
|
_PflichtbesetzungEnde = pDataContract.PflichtbesetzungEnde;
|
|
|
|
|
|
_PflichtbesetzungEinblenden = pDataContract.PflichtbesetzungEinblenden;
|
2022-03-25 15:05:39 +01:00
|
|
|
|
_StandardZeilenanzahl = pDataContract.StandardZeilenanzahl;
|
2022-06-07 16:14:23 +02:00
|
|
|
|
_Sortierungsart = pDataContract.Sortierungsart;
|
|
|
|
|
|
_AbsteigendeSortierung = pDataContract.AbsteigendeSortierung;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
_IsArchived = pDataContract.ActivationType == ActivationTypeId.Archived;
|
|
|
|
|
|
|
|
|
|
|
|
WohnheimEmployeeRelations = VMFactory.CreateWohnheimEmployeeRelationListVM(pDataContract.RelatedEmployees ?? (pDataContract.RelatedEmployees = new List<WohnheimEmployeeRelationDC>()));
|
|
|
|
|
|
WohnheimCustomerRelations = VMFactory.CreateWohnheimCustomerRelationListVM(pDataContract.RelatedCustomers ?? (pDataContract.RelatedCustomers = new List<WohnheimCustomerRelationDC>()));
|
2024-08-15 14:10:38 +02:00
|
|
|
|
|
|
|
|
|
|
if (pDataContract.Wohneinheiten is null)
|
|
|
|
|
|
pDataContract.Wohneinheiten = new List<WohneinheitDC>();
|
|
|
|
|
|
|
|
|
|
|
|
VMFactory.CreateWohneinheitListVMs(pDataContract.Wohneinheiten, out var einheit, out var beleg);
|
2024-08-19 12:21:29 +02:00
|
|
|
|
|
2024-08-15 14:10:38 +02:00
|
|
|
|
WohneinheitListVM = einheit;
|
|
|
|
|
|
WohneinheitBelegungListVM = beleg;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
protected override WohnheimDC MapToDataContract(WohnheimDC pDataContract, bool doCommit)
|
|
|
|
|
|
{
|
|
|
|
|
|
pDataContract.WohnheimName = _WohnheimName;
|
|
|
|
|
|
pDataContract.Strasse = _Strasse;
|
|
|
|
|
|
pDataContract.PLZ = _PLZ;
|
|
|
|
|
|
pDataContract.Ort = _Ort;
|
|
|
|
|
|
pDataContract.Bemerkung = _Bemerkung;
|
2022-03-22 11:38:58 +01:00
|
|
|
|
pDataContract.PflichtbesetzungStart = _PflichtbesetzungStart;
|
|
|
|
|
|
pDataContract.PflichtbesetzungEnde = _PflichtbesetzungEnde;
|
|
|
|
|
|
pDataContract.PflichtbesetzungEinblenden = _PflichtbesetzungEinblenden;
|
2022-03-25 15:05:39 +01:00
|
|
|
|
pDataContract.StandardZeilenanzahl = _StandardZeilenanzahl;
|
2022-06-07 16:14:23 +02:00
|
|
|
|
pDataContract.Sortierungsart = _Sortierungsart;
|
|
|
|
|
|
pDataContract.AbsteigendeSortierung = _AbsteigendeSortierung;
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
|
|
|
|
|
pDataContract.ActivationType = _IsArchived ? ActivationTypeId.Archived : ActivationTypeId.Active;
|
|
|
|
|
|
|
|
|
|
|
|
pDataContract.RelatedEmployees = _WohnheimEmployeeRelations.CopyToDCList(doCommit);
|
|
|
|
|
|
pDataContract.RelatedCustomers = _WohnheimCustomerRelations.CopyToDCList(doCommit);
|
2024-08-15 14:10:38 +02:00
|
|
|
|
|
2024-08-19 11:12:30 +02:00
|
|
|
|
//pDataContract.Wohneinheiten = _WohneinheitListVM.CopyToDCList(doCommit);
|
2016-06-27 01:45:38 +02:00
|
|
|
|
|
2025-11-03 14:19:19 +01:00
|
|
|
|
if (this._VarFields != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
pDataContract.VarFields = this._VarFields.CopyToDCList(doCommit);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-27 15:23:46 +02:00
|
|
|
|
pDataContract.Wohneinheiten = null;
|
2024-08-15 14:10:38 +02:00
|
|
|
|
var einheit_vm2dc = new Dictionary<WohneinheitVM, WohneinheitDC>();
|
|
|
|
|
|
foreach (var vm in _WohneinheitListVM.VMList)
|
|
|
|
|
|
{
|
|
|
|
|
|
var dc = doCommit ? vm.CommitToDataContract() : vm.CopyToEmptyDataContract();
|
|
|
|
|
|
|
2024-08-22 14:35:06 +02:00
|
|
|
|
if (pDataContract.Wohneinheiten is null)
|
|
|
|
|
|
pDataContract.Wohneinheiten = new List<WohneinheitDC>();
|
|
|
|
|
|
|
2024-08-15 14:10:38 +02:00
|
|
|
|
einheit_vm2dc.Add(vm, dc);
|
2024-08-22 14:35:06 +02:00
|
|
|
|
|
2024-08-27 15:23:46 +02:00
|
|
|
|
pDataContract.Wohneinheiten.Add(dc);
|
2024-08-15 14:10:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var vm in _WohneinheitBelegungListVM.VMList)
|
|
|
|
|
|
{
|
|
|
|
|
|
var dc = doCommit ? vm.CommitToDataContract() : vm.CopyToEmptyDataContract();
|
|
|
|
|
|
|
|
|
|
|
|
if (einheit_vm2dc[vm.Wohneinheit].Belegungen is null)
|
|
|
|
|
|
einheit_vm2dc[vm.Wohneinheit].Belegungen = new List<WohneinheitBelegungDC>();
|
|
|
|
|
|
|
|
|
|
|
|
if (!einheit_vm2dc[vm.Wohneinheit].Belegungen.Contains(dc))
|
|
|
|
|
|
einheit_vm2dc[vm.Wohneinheit].Belegungen.Add(dc);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2016-06-27 01:45:38 +02:00
|
|
|
|
return pDataContract;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|