Files
BeWoPlaner/BeWo/ViewModel/CustomerVM.cs
Lyndon 3ec0fba1a0 Textbausteine mit Anlegemenü in der Verwaltung und in der Zeiterfassung
Archivieren von Klienten ist wieder möglich

Die Distanz im Mobilklienten wird beim editieren eines Zeiterfassungseintrags korrekt angezeigt

Gruppenbuchungen wurden im Mobilklienten deaktiviert
2018-05-25 15:07:47 +02:00

1913 lines
67 KiB
C#

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using BeWo.Core;
using BeWo.Validation;
using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
namespace BeWo.ViewModel
{
public class CustomerVM : AbstractDCMapperVM<CustomerDC>
{
#region PropertyNames
public static string PropertyName_AbsenceTimes = "AbsenceTimes";
public static string PropertyName_Ansprechpartner = "Ansprechpartner";
public static string PropertyName_AssessmentSheetCategories = "AssessmentSheetCategories";
public static string PropertyName_Childs = "Childs";
public static string PropertyName_Confidant = "Confidant";
public static string PropertyName_ConfidantString = "ConfidantString";
public static string PropertyName_CostBearers = "CostBearers";
public static string PropertyName_CustomerCareTypes = "CustomerCareTypes";
public static string PropertyName_DateOfBirth = "DateOfBirth";
public static string PropertyName_DebitorNumber = "DebitorNumber";
public static string PropertyName_CostCenter = "CostCenter";
public static string PropertyName_Diagnosis = "Diagnosis";
public static string PropertyName_Disabilities = "Disabilities";
public static string PropertyName_EMail = "EMail";
public static string PropertyName_EmployeeRelations = "EmployeeRelations";
public static string PropertyName_WohnheimRelations = "WohnheimRelations";
public static string PropertyName_TeamRelations = "TeamRelations";
public static string PropertyName_EnvironmentPersons = "EnvironmentPersons";
public static string PropertyName_EnvironmentPersonsWithFamily = "EnvironmentPersonsWithFamily";
public static string PropertyName_EnvironmentOrganisations = "EnvironmentOrganisations";
public static string PropertyName_EquityContribution = "EquityContribution";
public static string PropertyName_FamilyStatus = "FamilyStatus";
public static string PropertyName_FamilyDataRelation = "FamilyDataRelation";
public static string PropertyName_Fax = "Fax";
public static string PropertyName_FirstName = "FirstName";
public static string PropertyName_ICD10Diagnosis = "ICD10Diagnosis";
public static string PropertyName_InvoiceAddressLine1 = "InvoiceAddressLine1";
public static string PropertyName_InvoiceAddressLine2 = "InvoiceAddressLine2";
public static string PropertyName_InvoiceAddressPostalCode = "InvoiceAddressPostalCode";
public static string PropertyName_InvoiceAddressStreet = "InvoiceAddressStreet";
public static string PropertyName_InvoiceAddressTown = "InvoiceAddressTown";
public static string PropertyName_IsAdvised = "IsAdvised";
public static string PropertyName_IsAdvisedOrAttended = "IsAdvisedOrAttended";
public static string PropertyName_IsArchived = "IsArchived";
public static string PropertyName_IsMigrant = "IsMigrant";
public static string PropertyName_IsAttended = "IsAttended";
public static string PropertyName_IsFemale = "IsFemale";
public static string PropertyName_IsMale = "IsMale";
public static string PropertyName_LastName = "LastName";
public static string PropertyName_Medication = "Medication";
public static string PropertyName_Environment = "Environment";
public static string PropertyName_MobilePhone = "MobilePhone";
public static string PropertyName_Notice = "Notice";
public static string PropertyName_Jugendamt = "Jugendamt";
public static string PropertyName_Phone = "Phone";
public static string PropertyName_PlacementList = "PlacementList";
public static string PropertyName_PostalCode = "PostalCode";
public static string PropertyName_Profession = "Profession";
public static string PropertyName_ReferenceNumber = "ReferenceNumber";
public static string PropertyName_Representative = "Representative";
public static string PropertyName_RepresentativeString = "RepresentativeString";
public static string PropertyName_Sex = "Sex";
public static string PropertyName_Street = "Street";
public static string PropertyName_TerminationDate = "TerminationDate";
public static string PropertyName_TerminationReason = "TerminationReason";
public static string PropertyName_Town = "Town";
public static string PropertyName_VarFields = "VarFields";
public static string PropertyName_Kindesmutter = "Kindesmutter";
public static string PropertyName_Kindesvater = "Kindesvater";
public static string PropertyName_Geschwister = "Geschwister";
public static string PropertyName_Vormund = "Vormund";
public static string PropertyName_AddressLine1 = "AddressLine1";
public static string PropertyName_DistanceInMeter = "DistanceInMeter";
public static string PropertyName_MedArten = "MedArten";
public static string PropertyName_Medikamentenverordnungslisten = "Medikamentenverordnungslisten";
public static string PropertyName_MedVerordnungslisten = "MedVerordnungslisten";
public static string PropertyName_AssistanceBegin = "AssistanceBegin";
public static string PropertyName_Schwerbehindertenausweis = "Schwerbehindertenausweis";
public static string PropertyName_AusstVersAmt = "AusstVersAmt";
public static string PropertyName_AusweisGueltigVon = "AusweisGueltigVon";
public static string PropertyName_AusweisGueltigBis = "AusweisGueltigBis";
public static string PropertyName_AusweisUnbefristetGueltig = "AusweisUnbefristetGueltig";
public static string PropertyName_BeiblattGueltigBis = "BeiblattGueltigBis";
public static string PropertyName_GradDerBehinderung = "GradDerBehinderung";
public static string PropertyName_MerkzeichenListe = "MerkzeichenListe";
public static string PropertyName_BehinderungsartenListe = "BehinderungsartenListe";
public static string PropertyName_CustomerAlias = "CustomerAlias";
public static string PropertyName_Wohnheimbuchungen = "Wohnheimbuchungen";
public static string PropertyName_Pflegegrad = "Pflegegrad";
public static string PropertyName_CustomerImage = "CustomerImage";
public static string PropertyName_Nationalitaet = "Nationalitaet";
public static string PropertyName_AufenthaltsStatus = "AufenthaltsStatus";
public static string PropertyName_VertretungGewuenscht = "VertretungGewuenscht";
public static string PropertyName_AbWelchemKrankheitsTag = "AbWelchemKrankheitsTag";
public static string PropertyName_VertretungDringendErforderlich = "VertretungDringendErforderlich";
public static string PropertyName_ActivationType = "ActivationType";
#endregion
private readonly ObservableSortCollection<ValueListEntryDC> _PossibleCustomerCareTypes;
private readonly ObservableSortCollection<ValueListEntryDC> _PossibleDisabilities;
private AbsenceTimeListVM _AbsenceTimes;
private CompactPersonDC _Ansprechpartner;
private BindingList<AssessmentSheetCategoryDC> _AssessmentSheetCategories;
private BindingList<MedArtDC> _MedArten;
private string _Childs;
private CustomerCostBearerRelationListVM _CostBearers;
private string _CostCenter;
private ObservableSortCollection<ValueListEntryDC> _CustomerCareTypes;
private DateTime? _DateOfBirth;
private string _DebitorNumber;
private string _Diagnosis;
private ObservableSortCollection<ValueListEntryDC> _Disabilities;
private string _EMail;
private CustomerEmployeeRelationListVM _EmployeeRelations;
private WohnheimCustomerRelationListVM _WohnheimRelations;
private bool _EnableLogging;
private string _Environment;
private CustomerOrganisationRelationListVM _EnvironmentOrganisations;
private CustomerPersonRelationListVM _EnvironmentPersons;
private CustomerPersonRelationListVM _EnvironmentPersonsWithFamily;
private decimal? _EquityContribution;
private FamilyStatus? _FamilyStatus;
private string _Fax;
private string _FirstName;
private string _Geschwister;
private string _ICD10Diagnosis;
private AssessmentSheetCategoryListVM _IndividualAssessmentSheetCategories;
private string _InvoiceAddressLine1;
private string _InvoiceAddressLine2;
private string _InvoiceAddressPostalCode;
private string _InvoiceAddressStreet;
private string _InvoiceAddressTown;
private bool _IsAdvised;
private bool _IsArchived;
private bool _IsMigrant;
private bool _IsAttended;
private bool _IsFemale;
private bool _IsMale;
private CompactOrganisationDC _Jugendamt;
private string _Kindesmutter;
private string _Kindesvater;
private string _LastName;
private StringBuilder _Log;
private string _Medication;
private string _MobilePhone;
private string _Notice;
private string _Phone;
private PlacementListVM _PlacementList;
private ObservableSortCollection<ValueListEntryDC> _PlacementObjectives;
private string _PostalCode;
private string _Profession;
private string _ReferenceNumber;
private string _Street;
private string _AddressLine1;
private CustomerTeamRelationListVM _TeamRelations;
private DateTime? _TerminationDate;
private ValueListEntryDC _TerminationReason;
private ObservableSortCollection<ValueListEntryDC> _TerminationReasons;
private string _Town;
private VarFieldListVM _VarFields;
private int? _DistanceInMeter;
private string _Vormund;
private DateTime? _AssistanceBegin;
private string _AusstVersAmt;
private DateTime? _AusweisGueltigVon;
private DateTime? _AusweisGueltigBis;
private bool _AusweisUnbefristetGueltig;
private DateTime? _BeiblattGueltigBis;
private string _GradDerBehinderung;
private ObservableCollection<Merkzeichen> _MerkzeichenListe;
private ObservableCollection<Behinderungsart> _BehinderungsartenListe;
private string _CustomerAlias;
private Pflegegrad? _Pflegegrad;
private byte[] _CustomerImage;
private bool _VertretungGewuenscht;
private int _AbWelchemKrankheitsTag;
private bool _VertretungDringendErforderlich;
private ActivationTypeId _ActivationType;
private ValueListEntryDC _Nationalitaet;
private ObservableSortCollection<ValueListEntryDC> _Nationalitaeten;
private ValueListEntryDC _AufenthaltsStatus;
private ObservableSortCollection<ValueListEntryDC> _AufenthaltsStatuse;
private ObservableSortCollection<ValueListEntryDC> _RoleInFamilys;
public CustomerVM(CustomerDC pDataContract, IEnumerable<ValueListEntryDC> pValueList, List<AssessmentSheetCategoryDC> pPossibleASCs,
List<AssessmentSheetValueDC> pPossibleASVs, List<MedArtDC> pPossibleMedArten)
: base(pDataContract, pDataContract.CustomerOid == null)
{
var possibleDisabilities = pValueList.Where(vle => vle.Type == ValueListEntryType.DisabilityType);
var possibleCustomerCareTypes = pValueList.Where(vle => vle.Type == ValueListEntryType.CustomerCareType);
var possibleTerminationReasons = pValueList.Where(vle => vle.Type == ValueListEntryType.TerminationReasonType);
var possiblePlacementObjectives = pValueList.Where(vle => vle.Type == ValueListEntryType.PlacementObjectiveType);
var possibleNationalitaeten = pValueList.Where(vle => vle.Type == ValueListEntryType.Nationality);
var possibleAufenthaltsStatuse = pValueList.Where(vle => vle.Type == ValueListEntryType.Aufenthaltsstatus);
var possibleFamilyStatuse = pValueList.Where(vle => vle.Type == ValueListEntryType.RoleInFamily);
_PossibleDisabilities = pDataContract.Disabilities != null
? new ObservableSortCollection<ValueListEntryDC>(possibleDisabilities.Except(pDataContract.Disabilities), Comparer.ValueListEntryDCComparer)
: new ObservableSortCollection<ValueListEntryDC>(possibleDisabilities, Comparer.ValueListEntryDCComparer);
_PossibleCustomerCareTypes = new ObservableSortCollection<ValueListEntryDC>(possibleCustomerCareTypes, Comparer.ValueListEntryDCComparer);
_TerminationReasons = new ObservableSortCollection<ValueListEntryDC>(possibleTerminationReasons, Comparer.ValueListEntryDCComparer);
_PlacementObjectives = new ObservableSortCollection<ValueListEntryDC>(possiblePlacementObjectives, Comparer.ValueListEntryDCComparer);
_Nationalitaeten = new ObservableSortCollection<ValueListEntryDC>(possibleNationalitaeten,Comparer.ValueListEntryDCComparer);
_AufenthaltsStatuse = new ObservableSortCollection<ValueListEntryDC>(possibleAufenthaltsStatuse, Comparer.ValueListEntryDCComparer);
_RoleInFamilys = new ObservableSortCollection<ValueListEntryDC>(possibleFamilyStatuse,Comparer.ValueListEntryDCComparer);
_MedArten = new BindingList<MedArtDC>(pPossibleMedArten);
pPossibleASCs.Sort((x, y) => x.Position.CompareTo(y.Position));
_AssessmentSheetCategories = new BindingList<AssessmentSheetCategoryDC>(pPossibleASCs);
foreach (var i in _AssessmentSheetCategories)
{
i.IsSelected = pDataContract.AssessmentSheetCategoryDCs != null &&
pDataContract.AssessmentSheetCategoryDCs.Exists(j => j.AssessmentSheetCategoryOid.Equals(i.AssessmentSheetCategoryOid));
}
_AssessmentSheetCategories.ListChanged += (s, e) => StoreDirtyInformation(true, "AssessmentSheetCategories");
if (pDataContract.AssessmentSheetCategoryDCs != null)
{
var individualServices = pDataContract.AssessmentSheetCategoryDCs.FindAll(cat => cat.ScopeType == ScopeTypeId.Individual);
_IndividualAssessmentSheetCategories = new AssessmentSheetCategoryListVM(individualServices, pPossibleASVs);
//this._ServiceAccountings = new ServiceAccountingListVM(pDataContract.ServiceAccountings);
}
else
{
_IndividualAssessmentSheetCategories = new AssessmentSheetCategoryListVM(new List<AssessmentSheetCategoryDC>(), pPossibleASVs);
}
}
//Wird noch benötigt
//public BargeldverwaltungsVM Bargeldverwaltung
//{
// get { return _Bargeldverwaltung; }
// set
// {
// _Bargeldverwaltung = value;
// StoreDirtyInformation(AreDifferent(DataContract.Bargeldverwaltung, value), PropertyName_Bargeldverwaltung);
// FirePropertyChanged(PropertyName_Bargeldverwaltung);
// }
//}
public AbsenceTimeListVM AbsenceTimes
{
get { return _AbsenceTimes; }
set
{
_AbsenceTimes = value;
FirePropertyChanged(PropertyName_AbsenceTimes);
}
}
public CompactPersonDC Ansprechpartner
{
get { return _Ansprechpartner; }
set
{
if (!AreDifferent(_Ansprechpartner, value))
return;
_Ansprechpartner = value;
StoreDirtyInformation(AreDifferent(DataContract.Ansprechpartner, value), PropertyName_Ansprechpartner);
FirePropertyChanged(PropertyName_Ansprechpartner);
}
}
public BindingList<MedArtDC> MedArten
{
get { return _MedArten; }
set
{
_MedArten = value;
FirePropertyChanged(PropertyName_MedArten);
}
}
public BindingList<AssessmentSheetCategoryDC> AssessmentSheetCategories
{
get { return _AssessmentSheetCategories; }
set
{
_AssessmentSheetCategories = value;
FirePropertyChanged(PropertyName_AssessmentSheetCategories);
}
}
public AssessmentSheetCategoryListVM IndividualAssessmentSheetCategories
{
get { return _IndividualAssessmentSheetCategories; }
set
{
_IndividualAssessmentSheetCategories = value;
FirePropertyChanged("IndividualAssessmentSheetCategories");
}
}
public string Childs
{
get { return _Childs; }
set
{
if (AreDifferent(_Childs, value))
{
_Childs = value;
StoreDirtyInformation(AreDifferent(DataContract.Childs, value), PropertyName_Childs);
FirePropertyChanged(PropertyName_Childs);
}
}
}
public CustomerCostBearerRelationListVM CostBearers
{
get { return _CostBearers; }
set
{
_CostBearers = value;
FirePropertyChanged(PropertyName_CostBearers);
}
}
public ObservableSortCollection<ValueListEntryDC> CustomerCareTypes
{
get { return _CustomerCareTypes ?? (_CustomerCareTypes = new ObservableSortCollection<ValueListEntryDC>(Comparer.ValueListEntryDCComparer)); }
}
public DateTime? DateOfBirth
{
get { return _DateOfBirth; }
set
{
if (AreDifferent(_DateOfBirth, value))
{
_DateOfBirth = value;
StoreDirtyInformation(AreDifferent(DataContract.DateOfBirth, value), PropertyName_DateOfBirth);
FirePropertyChanged(PropertyName_DateOfBirth);
}
}
}
public string DebitorNumber
{
get { return _DebitorNumber; }
set
{
if (AreDifferent(_DebitorNumber, value))
{
_DebitorNumber = value;
StoreDirtyInformation(AreDifferent(DataContract.DebitorNumber, value), PropertyName_DebitorNumber);
FirePropertyChanged(PropertyName_DebitorNumber);
}
}
}
public string CostCenter
{
get { return _CostCenter; }
set
{
if (AreDifferent(_CostCenter, value))
{
_CostCenter = value;
StoreDirtyInformation(AreDifferent(DataContract.CostCenter, value), PropertyName_CostCenter);
FirePropertyChanged(PropertyName_CostCenter);
}
}
}
public string Diagnosis
{
get { return _Diagnosis; }
set
{
if (AreDifferent(_Diagnosis, value))
{
_Diagnosis = value;
StoreDirtyInformation(AreDifferent(DataContract.Diagnosis, value), PropertyName_Diagnosis);
FirePropertyChanged(PropertyName_Diagnosis);
}
}
}
public ObservableSortCollection<ValueListEntryDC> Disabilities
{
get { return _Disabilities ?? (_Disabilities = new ObservableSortCollection<ValueListEntryDC>(Comparer.ValueListEntryDCComparer)); }
}
public string EMail
{
get { return _EMail; }
set
{
if (AreDifferent(_EMail, value))
{
_EMail = value;
StoreDirtyInformation(
DataContract.ContactInformations.Where(con => con.ContactType == ContactType.business_Mail && con.ContactValue == value).SingleOrDefault() == null, PropertyName_EMail);
FirePropertyChanged(PropertyName_EMail);
}
}
}
public CustomerEmployeeRelationListVM EmployeeRelations
{
get { return _EmployeeRelations; }
set
{
_EmployeeRelations = value;
FirePropertyChanged(PropertyName_EmployeeRelations);
}
}
public WohnheimCustomerRelationListVM WohnheimRelations
{
get { return _WohnheimRelations; }
set
{
_WohnheimRelations = value;
FirePropertyChanged(PropertyName_WohnheimRelations);
}
}
public CustomerTeamRelationListVM TeamRelations
{
get { return _TeamRelations; }
set
{
_TeamRelations = value;
FirePropertyChanged(PropertyName_TeamRelations);
}
}
public CustomerPersonRelationListVM EnvironmentPersons
{
get
{
return _EnvironmentPersons;
}
set
{
_EnvironmentPersons = value;
FirePropertyChanged(PropertyName_EnvironmentPersons);
}
}
public CustomerPersonRelationListVM EnvironmentPersonsWithFamily
{
get
{
return _EnvironmentPersonsWithFamily;
}
set
{
_EnvironmentPersonsWithFamily = value;
FirePropertyChanged(PropertyName_EnvironmentPersonsWithFamily);
}
}
public CustomerOrganisationRelationListVM EnvironmentOrganisations
{
get { return _EnvironmentOrganisations; }
set
{
_EnvironmentOrganisations = value;
FirePropertyChanged(PropertyName_EnvironmentOrganisations);
}
}
public string EquityContribution
{
get { return String.Format("{0:n}", _EquityContribution); }
set
{
decimal d = 0;
Decimal.TryParse(value, out d);
if (AreDifferent(_EquityContribution, d))
{
_EquityContribution = d;
StoreDirtyInformation(AreDifferent(DataContract.EquityContribution, d), PropertyName_EquityContribution);
FirePropertyChanged(PropertyName_EquityContribution);
}
}
}
public FamilyStatus? FamilyStatus
{
get { return _FamilyStatus; }
set
{
if (AreDifferent(_FamilyStatus, value))
{
_FamilyStatus = value;
StoreDirtyInformation(AreDifferent(DataContract.FamilyStatus, value), PropertyName_FamilyStatus);
FirePropertyChanged(PropertyName_FamilyStatus);
}
}
}
public string Fax
{
get { return _Fax; }
set
{
if (AreDifferent(_Fax, value))
{
_Fax = value;
StoreDirtyInformation(
DataContract.ContactInformations.SingleOrDefault(con => con.ContactType == ContactType.business_Fax && con.ContactValue == value) == null, PropertyName_Fax);
FirePropertyChanged(PropertyName_Fax);
}
}
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string FirstName
{
get { return _FirstName; }
set
{
if (AreDifferent(_FirstName, value))
{
_FirstName = value;
StoreDirtyInformation(AreDifferent(DataContract.FirstName, value), PropertyName_FirstName);
FirePropertyChanged(PropertyName_FirstName);
}
}
}
public BindingList<String> ICD10Codes { get; set; }
public string ICD10Diagnosis
{
get { return _ICD10Diagnosis; }
set
{
if (AreDifferent(_ICD10Diagnosis, value))
{
_ICD10Diagnosis = value;
StoreDirtyInformation(AreDifferent(DataContract.ICD10Diagnosis, value), PropertyName_ICD10Diagnosis);
FirePropertyChanged(PropertyName_ICD10Diagnosis);
}
}
}
public string InvoiceAddressLine1
{
get { return _InvoiceAddressLine1; }
set
{
if (AreDifferent(_InvoiceAddressLine1, value))
{
_InvoiceAddressLine1 = value;
StoreDirtyInformation(AreDifferent(DataContract.InvoiceAddressLine1, value), PropertyName_InvoiceAddressLine1);
FirePropertyChanged(PropertyName_InvoiceAddressLine1);
}
}
}
public string InvoiceAddressLine2
{
get { return _InvoiceAddressLine2; }
set
{
if (AreDifferent(_InvoiceAddressLine2, value))
{
_InvoiceAddressLine2 = value;
StoreDirtyInformation(AreDifferent(DataContract.InvoiceAddressLine2, value), PropertyName_InvoiceAddressLine2);
FirePropertyChanged(PropertyName_InvoiceAddressLine2);
}
}
}
public string InvoiceAddressPostalCode
{
get { return _InvoiceAddressPostalCode; }
set
{
if (AreDifferent(_InvoiceAddressPostalCode, value))
{
_InvoiceAddressPostalCode = value;
StoreDirtyInformation(AreDifferent(DataContract.InvoiceAddressPostalCode, value), PropertyName_InvoiceAddressPostalCode);
FirePropertyChanged(PropertyName_InvoiceAddressPostalCode);
}
}
}
public string InvoiceAddressStreet
{
get { return _InvoiceAddressStreet; }
set
{
if (AreDifferent(_InvoiceAddressStreet, value))
{
_InvoiceAddressStreet = value;
StoreDirtyInformation(AreDifferent(DataContract.InvoiceAddressStreet, value), PropertyName_InvoiceAddressStreet);
FirePropertyChanged(PropertyName_InvoiceAddressStreet);
}
}
}
public string InvoiceAddressTown
{
get { return _InvoiceAddressTown; }
set
{
if (AreDifferent(_InvoiceAddressTown, value))
{
_InvoiceAddressTown = value;
StoreDirtyInformation(AreDifferent(DataContract.InvoiceAddressTown, value), PropertyName_InvoiceAddressTown);
FirePropertyChanged(PropertyName_InvoiceAddressTown);
}
}
}
public bool IsAdvised
{
get { return _IsAdvised; }
set
{
if (_IsAdvised != value)
{
_IsAdvised = value;
_IsAttended = !value;
StoreDirtyInformation(AreDifferent(DataContract.IsAdvisedOrAttended, value), PropertyName_IsAdvisedOrAttended);
FirePropertyChanged(PropertyName_IsAttended);
FirePropertyChanged(PropertyName_IsAdvised);
}
}
}
public bool IsArchived
{
get => _IsArchived;
set
{
if(AreDifferent(_IsArchived, value))
{
_IsArchived = value;
StoreDirtyInformation(value && DataContract.ActivationType == ActivationTypeId.Active || !value && DataContract.ActivationType == ActivationTypeId.Archived, PropertyName_IsArchived);
FirePropertyChanged(PropertyName_IsArchived);
ActivationType = value ? ActivationType = ActivationTypeId.Archived : ActivationType = ActivationTypeId.Active;
}
}
}
public ActivationTypeId ActivationType
{
get => _ActivationType;
set
{
if(AreDifferent(_ActivationType, value))
{
_ActivationType = value;
StoreDirtyInformation(AreDifferent(DataContract.ActivationType, value), PropertyName_ActivationType);
FirePropertyChanged(PropertyName_ActivationType);
}
}
}
public bool IsMigrant
{
get { return _IsMigrant; }
set
{
if (AreDifferent(_IsMigrant, value))
{
_IsMigrant = value;
StoreDirtyInformation(AreDifferent(DataContract.IsMigrant, value), PropertyName_IsMigrant);
FirePropertyChanged(PropertyName_IsMigrant);
}
}
}
public bool IsAttended
{
get { return _IsAttended; }
set
{
if (_IsAttended != value)
{
_IsAttended = value;
_IsAdvised = !value;
StoreDirtyInformation(AreDifferent(DataContract.IsAdvisedOrAttended, !value), PropertyName_IsAdvisedOrAttended);
FirePropertyChanged(PropertyName_IsAttended);
FirePropertyChanged(PropertyName_IsAdvised);
}
}
}
public override bool IsDirty
{
get
{
if (Utils.IsAnyNull(EmployeeRelations, TeamRelations, _EnvironmentPersons, _EnvironmentPersonsWithFamily ,_EnvironmentOrganisations, _AbsenceTimes, CostBearers, _PlacementList, _VarFields, _IndividualAssessmentSheetCategories))
{
return false;
}
return base.IsDirty || TeamRelations.IsDirty || EmployeeRelations.IsDirty || _EnvironmentPersons.IsDirty ||
_EnvironmentOrganisations.IsDirty || _AbsenceTimes.IsDirty || _VarFields.IsDirty ||
CostBearers.IsDirty || _IndividualAssessmentSheetCategories.IsDirty ||
_PlacementList.IsDirty || _MedVerordnungslisten.IsDirty || _EnvironmentPersonsWithFamily.IsDirty;
}
}
public bool IsFemale
{
get { return _IsFemale; }
set
{
if (_IsFemale != value)
{
_IsFemale = value;
_IsMale = !value;
StoreDirtyInformation((DataContract.Sex == Sex.Female) != value, "sex");
FirePropertyChanged(PropertyName_IsFemale);
FirePropertyChanged(PropertyName_IsMale);
}
}
}
public bool IsMale
{
get { return _IsMale; }
set
{
if (_IsMale != value)
{
_IsMale = value;
_IsFemale = !value;
StoreDirtyInformation((DataContract.Sex == Sex.Male) != value, "sex");
FirePropertyChanged(PropertyName_IsFemale);
FirePropertyChanged(PropertyName_IsMale);
}
}
}
[Validation(ValidationRule = ValidationRules.NotNullOrStringEmpty)]
public string LastName
{
get { return _LastName; }
set
{
if (AreDifferent(_LastName, value))
{
_LastName = value;
StoreDirtyInformation(AreDifferent(DataContract.LastName, value), PropertyName_LastName);
FirePropertyChanged(PropertyName_LastName);
}
}
}
public string Medication
{
get { return _Medication; }
set
{
if (AreDifferent(_Medication, value))
{
_Medication = value;
StoreDirtyInformation(AreDifferent(DataContract.Medication, value), PropertyName_Medication);
FirePropertyChanged(PropertyName_Medication);
}
}
}
public string Environment
{
get { return _Environment; }
set
{
if (AreDifferent(_Environment, value))
{
_Environment = value;
StoreDirtyInformation(AreDifferent(DataContract.Environment, value), PropertyName_Environment);
FirePropertyChanged(PropertyName_Environment);
}
}
}
public string MobilePhone
{
get { return _MobilePhone; }
set
{
if (AreDifferent(_MobilePhone, value))
{
_MobilePhone = value;
StoreDirtyInformation(
DataContract.ContactInformations.Where(con => con.ContactType == ContactType.business_MobilePhone && con.ContactValue == value).SingleOrDefault() == null,
PropertyName_MobilePhone);
FirePropertyChanged(PropertyName_MobilePhone);
}
}
}
public string Notice
{
get { return _Notice; }
set
{
Log("Set Notice");
if (AreDifferent(_Notice, value))
{
_Notice = value;
StoreDirtyInformation(AreDifferent(DataContract.Notice, value), PropertyName_Notice);
FirePropertyChanged(PropertyName_Notice);
if (_EnableLogging)
Log(String.Format("Set Notice - is dirty = {0}", IsDirty));
}
}
}
public CompactOrganisationDC Jugendamt
{
get { return _Jugendamt; }
set
{
if (!AreDifferent(_Jugendamt, value))
return;
_Jugendamt = value;
StoreDirtyInformation(AreDifferent(DataContract.Jugendamt, value), PropertyName_Jugendamt);
FirePropertyChanged(PropertyName_Jugendamt);
}
}
public string Phone
{
get { return _Phone; }
set
{
if (AreDifferent(_Phone, value))
{
_Phone = value;
StoreDirtyInformation(
DataContract.ContactInformations.Where(con => con.ContactType == ContactType.business_Phone && con.ContactValue == value).SingleOrDefault() == null, PropertyName_Phone);
FirePropertyChanged(PropertyName_Phone);
}
}
}
public PlacementListVM PlacementList
{
get { return _PlacementList; }
set
{
_PlacementList = value;
FirePropertyChanged(PropertyName_PlacementList);
}
}
public ObservableSortCollection<ValueListEntryDC> PlacementObjectives
{
get
{
if (_PlacementObjectives == null)
{
_PlacementObjectives = new ObservableSortCollection<ValueListEntryDC>();
}
return _PlacementObjectives;
}
}
public ObservableSortCollection<ValueListEntryDC> PossibleCustomerCareTypes
{
get { return _PossibleCustomerCareTypes; }
}
public ObservableSortCollection<ValueListEntryDC> PossibleDisabilities
{
get { return _PossibleDisabilities; }
}
public string PostalCode
{
get { return _PostalCode; }
set
{
if (AreDifferent(_PostalCode, value))
{
_PostalCode = value;
StoreDirtyInformation(AreDifferent(DataContract.PostalCode, value), PropertyName_PostalCode);
FirePropertyChanged(PropertyName_PostalCode);
}
}
}
public string Profession
{
get { return _Profession; }
set
{
if (AreDifferent(_Profession, value))
{
_Profession = value;
StoreDirtyInformation(AreDifferent(DataContract.Profession, value), PropertyName_Profession);
FirePropertyChanged(PropertyName_Profession);
}
}
}
public string ReferenceNumber
{
get { return _ReferenceNumber; }
set
{
if (AreDifferent(_ReferenceNumber, value))
{
_ReferenceNumber = value;
StoreDirtyInformation(AreDifferent(DataContract.ReferenceNumber, value), PropertyName_ReferenceNumber);
FirePropertyChanged(PropertyName_ReferenceNumber);
}
}
}
public string Street
{
get { return _Street; }
set
{
if (AreDifferent(_Street, value))
{
_Street = value;
StoreDirtyInformation(AreDifferent(DataContract.Street, value), PropertyName_Street);
FirePropertyChanged(PropertyName_Street);
}
}
}
public int? DistanceInMeter
{
get { return _DistanceInMeter; }
set
{
if (AreDifferent(_DistanceInMeter, value))
{
_DistanceInMeter = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.DistanceInMeter, value), PropertyName_DistanceInMeter);
FirePropertyChanged(PropertyName_DistanceInMeter);
}
}
}
public string AddressLine1
{
get { return this._AddressLine1; }
set
{
if (this.AreDifferent(this._AddressLine1, value))
{
this._AddressLine1 = value;
this.StoreDirtyInformation(this.AreDifferent(this.DataContract.AddressLine1, value), PropertyName_AddressLine1);
this.FirePropertyChanged(PropertyName_AddressLine1);
}
}
}
public string Kindesmutter
{
get { return _Kindesmutter; }
set
{
if (!AreDifferent(_Kindesmutter, value))
return;
_Kindesmutter = value;
StoreDirtyInformation(AreDifferent(DataContract.Kindesmutter, value), PropertyName_Kindesmutter);
FirePropertyChanged(PropertyName_Kindesmutter);
}
}
public string Kindesvater
{
get { return _Kindesvater; }
set
{
if (!AreDifferent(_Kindesvater, value))
return;
_Kindesvater = value;
StoreDirtyInformation(AreDifferent(DataContract.Kindesvater, value), PropertyName_Kindesvater);
FirePropertyChanged(PropertyName_Kindesvater);
}
}
public string Geschwister
{
get { return _Geschwister; }
set
{
if (!AreDifferent(_Kindesmutter, value))
return;
_Geschwister = value;
StoreDirtyInformation(AreDifferent(DataContract.Geschwister, value), PropertyName_Geschwister);
FirePropertyChanged(PropertyName_Geschwister);
}
}
public string Vormund
{
get { return _Vormund; }
set
{
if (!AreDifferent(_Vormund, value))
return;
_Vormund = value;
StoreDirtyInformation(AreDifferent(DataContract.Vormund, value), PropertyName_Vormund);
FirePropertyChanged(PropertyName_Vormund);
}
}
public DateTime? TerminationDate
{
get { return _TerminationDate; }
set
{
if (AreDifferent(_TerminationDate, value))
{
_TerminationDate = value;
StoreDirtyInformation(AreDifferent(DataContract.TerminationDate, value), PropertyName_TerminationDate);
FirePropertyChanged(PropertyName_TerminationDate);
}
}
}
public DateTime? AssistanceBegin
{
get { return _AssistanceBegin; }
set
{
if (AreDifferent(_AssistanceBegin, value))
{
_AssistanceBegin = value;
StoreDirtyInformation(AreDifferent(DataContract.AssistanceBegin, value), PropertyName_AssistanceBegin);
FirePropertyChanged(PropertyName_AssistanceBegin);
}
}
}
public ValueListEntryDC TerminationReason
{
get { return _TerminationReason; }
set
{
if (AreDifferent(_TerminationReason, value))
{
_TerminationReason = value;
StoreDirtyInformation(AreDifferent(DataContract.TerminationReason, value), PropertyName_TerminationReason);
FirePropertyChanged(PropertyName_TerminationReason);
}
}
}
public ObservableSortCollection<ValueListEntryDC> TerminationReasons
{
get { return _TerminationReasons ?? (_TerminationReasons = new ObservableSortCollection<ValueListEntryDC>()); }
}
public string Town
{
get { return _Town; }
set
{
if (AreDifferent(_Town, value))
{
_Town = value;
StoreDirtyInformation(AreDifferent(DataContract.Town, value), PropertyName_Town);
FirePropertyChanged(PropertyName_Town);
}
}
}
public VarFieldListVM VarFields
{
get { return _VarFields; }
set
{
if (AreDifferent(_VarFields, value))
{
_VarFields = value;
FirePropertyChanged(PropertyName_VarFields);
}
}
}
public string AusstVersAmt
{
get { return _AusstVersAmt; }
set
{
if (AreDifferent(_AusstVersAmt, value))
{
_AusstVersAmt = value;
StoreDirtyInformation(AreDifferent(DataContract.AusstVersAmt, value), PropertyName_AusstVersAmt);
FirePropertyChanged(PropertyName_AusstVersAmt);
}
}
}
public DateTime? AusweisGueltigVon
{
get { return _AusweisGueltigVon; }
set
{
if (AreDifferent(_AusweisGueltigVon, value))
{
_AusweisGueltigVon = value;
StoreDirtyInformation(AreDifferent(DataContract.AusweisGueltigVon, value), PropertyName_AusweisGueltigVon);
FirePropertyChanged(PropertyName_AusweisGueltigVon);
}
}
}
public DateTime? AusweisGueltigBis
{
get { return _AusweisGueltigBis; }
set
{
if (AreDifferent(_AusweisGueltigBis, value))
{
_AusweisGueltigBis = value;
StoreDirtyInformation(AreDifferent(DataContract.AusweisGueltigBis, value), PropertyName_AusweisGueltigBis);
FirePropertyChanged(PropertyName_AusweisGueltigBis);
}
}
}
public bool AusweisUnbefristetGueltig
{
get { return _AusweisUnbefristetGueltig; }
set
{
if (AreDifferent(_AusweisUnbefristetGueltig, value))
{
_AusweisUnbefristetGueltig = value;
if (value)
{
AusweisGueltigBis = null;
}
StoreDirtyInformation(AreDifferent(DataContract.AusweisUnbefristetGueltig, value), PropertyName_AusweisUnbefristetGueltig);
FirePropertyChanged(PropertyName_AusweisUnbefristetGueltig);
}
}
}
public DateTime? BeiblattGueltigBis
{
get { return _BeiblattGueltigBis; }
set
{
if (AreDifferent(_BeiblattGueltigBis, value))
{
_BeiblattGueltigBis = value;
StoreDirtyInformation(AreDifferent(DataContract.BeiblattGueltigBis, value), PropertyName_BeiblattGueltigBis);
FirePropertyChanged(PropertyName_BeiblattGueltigBis);
}
}
}
public string GradDerBehinderung
{
get { return _GradDerBehinderung; }
set
{
if (AreDifferent(_GradDerBehinderung, value))
{
_GradDerBehinderung = value;
StoreDirtyInformation(AreDifferent(DataContract.GradDerBehinderung, value), PropertyName_GradDerBehinderung);
FirePropertyChanged(PropertyName_GradDerBehinderung);
}
}
}
public Byte[] CustomerImage
{
get { return _CustomerImage; }
set
{
if (AreDifferent(_CustomerImage, value))
{
_CustomerImage = value;
StoreDirtyInformation(AreDifferent(DataContract.Images, value), PropertyName_CustomerImage);
FirePropertyChanged(PropertyName_CustomerImage);
}
}
}
public ValueListEntryDC Nationalitaet
{
get { return this._Nationalitaet; }
set
{
if (this.AreDifferent(this._Nationalitaet, value))
{
this._Nationalitaet = value;
this.StoreDirtyInformation(this.AreDifferent(DataContract.Nationalitaet, value), PropertyName_Nationalitaet);
this.FirePropertyChanged(PropertyName_Nationalitaet);
}
}
}
public ValueListEntryDC AufenthaltsStatus
{
get { return this._AufenthaltsStatus; }
set
{
if (this.AreDifferent(this._AufenthaltsStatus, value))
{
this._AufenthaltsStatus = value;
this.StoreDirtyInformation(this.AreDifferent(DataContract.AufenthaltsStatus, value), PropertyName_AufenthaltsStatus);
this.FirePropertyChanged(PropertyName_AufenthaltsStatus);
}
}
}
public ObservableSortCollection<ValueListEntryDC> Nationalitaeten
{
get
{
if (_Nationalitaeten == null)
{
this._Nationalitaeten = new ObservableSortCollection<ValueListEntryDC>();
}
return this._Nationalitaeten;
}
}
public ObservableSortCollection<ValueListEntryDC> RoleInFamilys
{
get
{
if (_RoleInFamilys == null)
{
this._RoleInFamilys = new ObservableSortCollection<ValueListEntryDC>();
}
return this._RoleInFamilys;
}
}
public ObservableSortCollection<ValueListEntryDC> AufenthaltsStatuse
{
get
{
if (_AufenthaltsStatuse == null)
{
this._AufenthaltsStatuse = new ObservableSortCollection<ValueListEntryDC>();
}
return this._AufenthaltsStatuse;
}
}
public ObservableCollection<Behinderungsart> BehinderungsartenListe
{
get { return _BehinderungsartenListe ?? (_BehinderungsartenListe = new ObservableCollection<Behinderungsart>()); }
set
{
if (AreDifferent(_BehinderungsartenListe, value))
{
_BehinderungsartenListe = value;
StoreDirtyInformation(AreDifferent(DataContract.BehinderungsartenListe, value), PropertyName_BehinderungsartenListe);
FirePropertyChanged(PropertyName_BehinderungsartenListe);
}
}
}
public ObservableCollection<Merkzeichen> MerkzeichenListe
{
get { return _MerkzeichenListe ?? (_MerkzeichenListe = new ObservableCollection<Merkzeichen>()); }
set
{
if (AreDifferent(_MerkzeichenListe, value))
{
_MerkzeichenListe = value;
StoreDirtyInformation(AreDifferent(DataContract.MerkzeichenListe, value), PropertyName_MerkzeichenListe);
FirePropertyChanged(PropertyName_MerkzeichenListe);
}
}
}
public void EnableLogging(bool enable, StringBuilder log)
{
_EnableLogging = enable;
_Log = log;
}
public bool VertretungGewuenscht
{
get { return _VertretungGewuenscht; }
set
{
if (AreDifferent(_VertretungGewuenscht, value))
{
_VertretungGewuenscht = value;
StoreDirtyInformation(AreDifferent(DataContract.VertretungGewuenscht, value), PropertyName_VertretungGewuenscht);
FirePropertyChanged(PropertyName_VertretungGewuenscht);
}
}
}
public int AbWelchemKrankheitsTag
{
get { return _AbWelchemKrankheitsTag; }
set
{
if (AreDifferent(_AbWelchemKrankheitsTag, value))
{
_AbWelchemKrankheitsTag = value;
StoreDirtyInformation(AreDifferent(DataContract.AbWelchemKrankheitsTag, value), PropertyName_AbWelchemKrankheitsTag);
FirePropertyChanged(PropertyName_AbWelchemKrankheitsTag);
}
}
}
public bool VertretungDringendErforderlich
{
get { return _VertretungDringendErforderlich ; }
set
{
if (AreDifferent(_VertretungDringendErforderlich, value))
{
_VertretungGewuenscht = value;
StoreDirtyInformation(AreDifferent(DataContract.VertretungDringendErforderlich, value), PropertyName_VertretungDringendErforderlich);
FirePropertyChanged(PropertyName_VertretungDringendErforderlich);
}
}
}
#region Medikamentenverordnungslisten
private MedikamentenverordnungslisteListVM _MedVerordnungslisten;
public MedikamentenverordnungslisteListVM MedVerordnungslisten
{
get { return _MedVerordnungslisten; }
set
{
if (AreDifferent(_MedVerordnungslisten, value))
{
_MedVerordnungslisten = value;
FirePropertyChanged(PropertyName_MedVerordnungslisten);
}
}
}
private BindingList<MedikamentenverordnungslisteDC> _Medikamentenverordnungslisten;
public BindingList<MedikamentenverordnungslisteDC> Medikamentenverordnungslisten
{
get { return _Medikamentenverordnungslisten ?? (_Medikamentenverordnungslisten = new BindingList<MedikamentenverordnungslisteDC>()); }
set
{
_Medikamentenverordnungslisten = value;
StoreDirtyInformation(AreDifferent(DataContract.Medikamentenverordnungslisten, value), PropertyName_Medikamentenverordnungslisten);
FirePropertyChanged(PropertyName_Medikamentenverordnungslisten);
}
}
public MedikamentenverordnungslisteVM AktuelleMedikamentenverordnungsliste
{
get { return MedVerordnungslisten.VMList.FirstOrDefault(vm => vm.Gueltig && false == vm.MedListType); }
}
public MedikamentenverordnungslisteVM Bedarfsmedikamentenverordnungsliste
{
get { return MedVerordnungslisten.VMList.FirstOrDefault(vm => vm.Gueltig && vm.MedListType); }
}
public List<MedikamentenverordnungslisteVM> UngueltigeVerordnungen
{
get { return MedVerordnungslisten.VMList.Where(vm => !vm.Gueltig).ToList(); }
}
public string CustomerAlias
{
get { return _CustomerAlias; }
set
{
if (AreDifferent(_CustomerAlias, value))
{
_CustomerAlias = value;
StoreDirtyInformation(AreDifferent(DataContract.CustomerAlias, value), PropertyName_CustomerAlias);
FirePropertyChanged(PropertyName_CustomerAlias);
}
}
}
public Pflegegrad? Pflegegrad {
get { return _Pflegegrad; }
set
{
if (AreDifferent(_Pflegegrad, value))
{
_Pflegegrad = value;
StoreDirtyInformation(AreDifferent(DataContract.Pflegegrad, value), PropertyName_Pflegegrad);
FirePropertyChanged(PropertyName_Pflegegrad);
}
}
}
#endregion
protected override void InitByDataContract(CustomerDC pDataContract)
{
if (!IsNew)
{
_DateOfBirth = pDataContract.DateOfBirth;
_FirstName = pDataContract.FirstName;
_FamilyStatus = pDataContract.FamilyStatus;
_LastName = pDataContract.LastName;
_PostalCode = pDataContract.PostalCode;
_Profession = pDataContract.Profession;
_Street = pDataContract.Street;
_AddressLine1 = pDataContract.AddressLine1;
_DistanceInMeter = pDataContract.DistanceInMeter;
_Town = pDataContract.Town;
_InvoiceAddressLine1 = pDataContract.InvoiceAddressLine1;
_InvoiceAddressLine2 = pDataContract.InvoiceAddressLine2;
_InvoiceAddressPostalCode = pDataContract.InvoiceAddressPostalCode;
_InvoiceAddressStreet = pDataContract.InvoiceAddressStreet;
_InvoiceAddressTown = pDataContract.InvoiceAddressTown;
_Medication = pDataContract.Medication;
_Environment = pDataContract.Environment;
_Diagnosis = pDataContract.Diagnosis;
_Notice = pDataContract.Notice;
_ICD10Diagnosis = pDataContract.ICD10Diagnosis;
_Childs = pDataContract.Childs;
_EquityContribution = pDataContract.EquityContribution;
_ReferenceNumber = pDataContract.ReferenceNumber;
_Kindesmutter = pDataContract.Kindesmutter;
_Kindesvater = pDataContract.Kindesvater;
_Geschwister = pDataContract.Geschwister;
_Vormund = pDataContract.Vormund;
_CustomerAlias = pDataContract.CustomerAlias;
_Pflegegrad = pDataContract.Pflegegrad;
_Nationalitaet = pDataContract.Nationalitaet;
_AufenthaltsStatus = pDataContract.AufenthaltsStatus;
_VertretungGewuenscht = pDataContract.VertretungGewuenscht;
_AbWelchemKrankheitsTag = pDataContract.AbWelchemKrankheitsTag;
_VertretungDringendErforderlich = pDataContract.VertretungDringendErforderlich;
if (pDataContract.Images != null && pDataContract.Images.Count > 0)
{
_CustomerImage = pDataContract.Images[0];
}
if (pDataContract.Jugendamt != null)
{
_Jugendamt = pDataContract.Jugendamt;
}
if (pDataContract.Ansprechpartner != null)
{
_Ansprechpartner = pDataContract.Ansprechpartner;
}
_IsArchived = pDataContract.ActivationType == ActivationTypeId.Archived;
_ActivationType = pDataContract.ActivationType;
_IsMigrant = pDataContract.IsMigrant;
_IsMale = pDataContract.Sex == Sex.Male;
_IsFemale = pDataContract.Sex == Sex.Female;
_IsAdvised = pDataContract.IsAdvisedOrAttended == null || pDataContract.IsAdvisedOrAttended.Value;
_IsAttended = !IsAdvised;
_DebitorNumber = pDataContract.DebitorNumber;
_CostCenter = pDataContract.CostCenter;
_AssistanceBegin = pDataContract.AssistanceBegin;
_TerminationDate = pDataContract.TerminationDate;
_TerminationReason = pDataContract.TerminationReason;
_AusstVersAmt = pDataContract.AusstVersAmt;
_AusweisGueltigVon = pDataContract.AusweisGueltigVon;
_AusweisGueltigBis = pDataContract.AusweisGueltigBis;
_BeiblattGueltigBis = pDataContract.BeiblattGueltigBis;
_GradDerBehinderung = pDataContract.GradDerBehinderung;
_MerkzeichenListe = new ObservableCollection<Merkzeichen>(pDataContract.MerkzeichenListe);
_BehinderungsartenListe = new ObservableCollection<Behinderungsart>(pDataContract.BehinderungsartenListe);
_AusweisUnbefristetGueltig = pDataContract.AusweisUnbefristetGueltig != null && pDataContract.AusweisUnbefristetGueltig.Value;
if (pDataContract.Disabilities != null)
{
_Disabilities = new ObservableSortCollection<ValueListEntryDC>(pDataContract.Disabilities, Comparer.ValueListEntryDCComparer);
}
if (pDataContract.CustomerCareTypes != null)
{
_CustomerCareTypes = new ObservableSortCollection<ValueListEntryDC>(pDataContract.CustomerCareTypes, Comparer.ValueListEntryDCComparer);
}
if (pDataContract.Medikamentenverordnungslisten != null)
{
Medikamentenverordnungslisten.AddRange(pDataContract.Medikamentenverordnungslisten);
}
foreach (var iContactDC in pDataContract.ContactInformations)
{
if (iContactDC.ContactType == ContactType.business_Mail)
{
_EMail = iContactDC.ContactValue;
}
if (iContactDC.ContactType == ContactType.business_Fax)
{
_Fax = iContactDC.ContactValue;
}
if (iContactDC.ContactType == ContactType.business_Phone)
{
_Phone = iContactDC.ContactValue;
}
if (iContactDC.ContactType == ContactType.business_MobilePhone)
{
_MobilePhone = iContactDC.ContactValue;
}
}
}
Disabilities.CollectionChanged += (s, e) => StoreDirtyInformation(!_Disabilities.ContainsSameItemsAs(pDataContract.Disabilities), PropertyName_Disabilities);
CustomerCareTypes.CollectionChanged += (s, e) => StoreDirtyInformation(!_CustomerCareTypes.ContainsSameItemsAs(pDataContract.CustomerCareTypes), PropertyName_CustomerCareTypes);
EmployeeRelations = VMFactory.CreateCustomerEmployeeRelationListVM(pDataContract.RelatedEmployees ?? (pDataContract.RelatedEmployees = new List<CustomerEmployeeRelationDC>()));
TeamRelations = new CustomerTeamRelationListVM(pDataContract.RelatedTeams ?? (pDataContract.RelatedTeams = new List<CustomerTeamRelationDC>()));
List<CustomerPersonRelationDC> dcListFamily = new List<CustomerPersonRelationDC>();
List<CustomerPersonRelationDC> dcListUmfeld = new List<CustomerPersonRelationDC>();
if (pDataContract.EnvironmentPersons != null)
{
foreach (var customerPersonRelationDc in pDataContract.EnvironmentPersons)
{
if (customerPersonRelationDc.IstFamilie)
{
dcListFamily.Add(customerPersonRelationDc);
}
else
{
dcListUmfeld.Add(customerPersonRelationDc);
}
}
}
EnvironmentPersons = VMFactory.CreateCustomerEnvironmentPersonRelListVM(dcListUmfeld, ValueListEntryType.EnvironmentPersonType);
EnvironmentPersonsWithFamily = VMFactory.CreateCustomerEnvironmentPersonRelListVM(dcListFamily, ValueListEntryType.RoleInFamily);
EnvironmentOrganisations = VMFactory.CreateCustomerEnvironmentOrganisationRelListVM(pDataContract.EnvironmentOrganisations ?? (pDataContract.EnvironmentOrganisations = new List<CustomerOrganisationRelationDC>()));
AbsenceTimes = VMFactory.CreateAbsenceTimeListVM(pDataContract.AbsenceTimes ?? (pDataContract.AbsenceTimes = new List<AbsenceTimeDC>()));
CostBearers = new CustomerCostBearerRelationListVM(pDataContract.CostBearers ?? (pDataContract.CostBearers = new List<CustomerCostBearerRelationDC>()));
_PlacementList = new PlacementListVM(pDataContract.PlacementList);
_VarFields = new VarFieldListVM(pDataContract.CustomerVarFields);
ICD10Codes = pDataContract.ICD10DiagnosisCodes == null ? new BindingList<String>() : new BindingList<String>(pDataContract.ICD10DiagnosisCodes);
ICD10Codes.ListChanged += (s, e) => StoreDirtyInformation(true, "ICD10Codes");
MedVerordnungslisten = VMFactory.CreateMedikementenverordnungslisteListVM(pDataContract.Medikamentenverordnungslisten);
}
protected override CustomerDC MapToDataContract(CustomerDC pDataContract, bool doCommit)
{
pDataContract.DateOfBirth = _DateOfBirth;
pDataContract.FirstName = _FirstName;
pDataContract.FamilyStatus = _FamilyStatus;
pDataContract.LastName = _LastName;
pDataContract.PostalCode = _PostalCode;
pDataContract.Profession = _Profession;
pDataContract.Street = _Street;
pDataContract.AddressLine1 = _AddressLine1;
pDataContract.Town = _Town;
pDataContract.DistanceInMeter = _DistanceInMeter;
pDataContract.InvoiceAddressLine1 = _InvoiceAddressLine1;
pDataContract.InvoiceAddressLine2 = _InvoiceAddressLine2;
pDataContract.InvoiceAddressStreet = _InvoiceAddressStreet;
pDataContract.InvoiceAddressTown = _InvoiceAddressTown;
pDataContract.InvoiceAddressPostalCode = _InvoiceAddressPostalCode;
pDataContract.Jugendamt = _Jugendamt;
pDataContract.Ansprechpartner = _Ansprechpartner;
pDataContract.Kindesmutter = _Kindesmutter;
pDataContract.Kindesvater = _Kindesvater;
pDataContract.Geschwister = _Geschwister;
pDataContract.Vormund = _Vormund;
pDataContract.Diagnosis = _Diagnosis;
pDataContract.Notice = _Notice;
pDataContract.ICD10Diagnosis = _ICD10Diagnosis;
pDataContract.Childs = _Childs;
pDataContract.EquityContribution = _EquityContribution;
pDataContract.ReferenceNumber = _ReferenceNumber;
pDataContract.Disabilities = _Disabilities.ToList();
pDataContract.CustomerCareTypes = _CustomerCareTypes.ToList();
pDataContract.ActivationType = _ActivationType;
pDataContract.IsMigrant = _IsMigrant;
pDataContract.AusstVersAmt = _AusstVersAmt;
pDataContract.AusweisGueltigVon = _AusweisGueltigVon;
pDataContract.AusweisGueltigBis = _AusweisGueltigBis;
pDataContract.AusweisUnbefristetGueltig = _AusweisUnbefristetGueltig;
pDataContract.BeiblattGueltigBis = _BeiblattGueltigBis;
pDataContract.GradDerBehinderung = _GradDerBehinderung;
pDataContract.Nationalitaet = _Nationalitaet;
pDataContract.AufenthaltsStatus = _AufenthaltsStatus;
pDataContract.VertretungGewuenscht = _VertretungGewuenscht;
pDataContract.AbWelchemKrankheitsTag = _AbWelchemKrankheitsTag;
pDataContract.VertretungDringendErforderlich = _VertretungDringendErforderlich;
if (_MerkzeichenListe != null)
{
pDataContract.MerkzeichenListe = _MerkzeichenListe.ToList();
}
if (_BehinderungsartenListe != null)
{
pDataContract.BehinderungsartenListe = _BehinderungsartenListe.ToList();
}
pDataContract.CustomerAlias = _CustomerAlias;
pDataContract.Pflegegrad = _Pflegegrad;
if (pDataContract.Images != null)
{
pDataContract.Images.Clear();
}
if (_CustomerImage != null)
{
if (pDataContract.Images == null)
{
pDataContract.Images = new List<byte[]>();
}
pDataContract.Images.Add(_CustomerImage);
}
CommitContact(_MobilePhone, ContactType.business_MobilePhone);
CommitContact(_Phone, ContactType.business_Phone);
CommitContact(_Fax, ContactType.business_Fax);
CommitContact(_EMail, ContactType.business_Mail);
if (_IsMale)
{
pDataContract.Sex = Sex.Male;
}
if (_IsFemale)
{
pDataContract.Sex = Sex.Female;
}
pDataContract.RelatedEmployees = _EmployeeRelations.CopyToDCList(doCommit);
pDataContract.RelatedTeams = _TeamRelations.CopyToDCList(doCommit);
pDataContract.EnvironmentPersons = new List<CustomerPersonRelationDC>();
foreach (var vm in EnvironmentPersonsWithFamily.VMList)
{
pDataContract.EnvironmentPersons.Add(vm.CommitToDataContract());
}
foreach (var vm in EnvironmentPersons.VMList)
{
pDataContract.EnvironmentPersons.Add(vm.CommitToDataContract());
}
//pDataContract.EnvironmentPersons = _EnvironmentPersons.CopyToDCList(doCommit);
pDataContract.EnvironmentOrganisations = _EnvironmentOrganisations.CopyToDCList(doCommit);
pDataContract.AbsenceTimes = _AbsenceTimes.CopyToDCList(doCommit);
pDataContract.CostBearers = _CostBearers.CopyToDCList(doCommit);
pDataContract.PlacementList = _PlacementList.CopyToDCList(doCommit);
if (_VarFields != null)
{
pDataContract.CustomerVarFields = _VarFields.CopyToDCList(doCommit);
}
pDataContract.IsAdvisedOrAttended = _IsAdvised;
pDataContract.AssistanceBegin = _AssistanceBegin;
pDataContract.TerminationDate = _TerminationDate;
pDataContract.TerminationReason = _TerminationReason;
pDataContract.DebitorNumber = _DebitorNumber;
pDataContract.CostCenter = _CostCenter;
pDataContract.ICD10DiagnosisCodes = ICD10Codes.ToList();
pDataContract.Medication = _Medication;
pDataContract.Environment = _Environment;
pDataContract.AssessmentSheetCategoryDCs = _AssessmentSheetCategories.Where(i => i.IsSelected).ToList();
pDataContract.Type = PersonType.Customer;
if(_Medikamentenverordnungslisten != null)
{
pDataContract.Medikamentenverordnungslisten = _Medikamentenverordnungslisten.ToList();
}
pDataContract.Medikamentenverordnungslisten = _MedVerordnungslisten.CopyToDCList(doCommit);
foreach (var vm in _IndividualAssessmentSheetCategories.VMList)
{
var dc = vm.CommitToDataContract();
dc.ScopeType = ScopeTypeId.Individual;
pDataContract.AssessmentSheetCategoryDCs.Add(dc);
}
return pDataContract;
}
private void CommitContact(String pValue, ContactType pContactType)
{
var lOldContactDCs = DataContract.ContactInformations != null ? DataContract.ContactInformations.ToList() : new List<ContactDC>();
var lContactDC = lOldContactDCs.SingleOrDefault(con => con.ContactType == pContactType);
if (String.IsNullOrEmpty(pValue) && lContactDC != null)
{
lOldContactDCs.Remove(lContactDC);
}
else if (!String.IsNullOrEmpty(pValue))
{
if (lContactDC == null)
{
lContactDC = new ContactDC
{
ContactType = pContactType
};
lOldContactDCs.Add(lContactDC);
}
lContactDC.ContactValue = pValue;
}
DataContract.ContactInformations = lOldContactDCs;
}
private void Log(String log)
{
if (_EnableLogging && _Log != null)
{
if (_Log.Length > 0)
{
_Log.Append("\n");
}
_Log.Append(log);
}
}
}
}