304 lines
14 KiB
C#
304 lines
14 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraRichEdit;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace BeWo.Service.Dokumentverwaltung
|
|
{
|
|
public class CustomerPlaceholderManager : PlaceholderManager
|
|
{
|
|
|
|
public override List<PlatzhalterDC> GetPlatzhalter()
|
|
{
|
|
List<PlatzhalterDC> liste = new List<PlatzhalterDC>();
|
|
|
|
|
|
PlatzhalterDC personendaten = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Klient/in",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "BoyAndGirl"
|
|
};
|
|
|
|
personendaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Anrede", Platzhalter = "KlAnrede", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Briefanrede", Platzhalter = "KlBriefanrede", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Vorname", Platzhalter = "KlVorname", FieldName = "Person.FirstName", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Nachname", Platzhalter = "KlNachname", FieldName = "Person.LastName", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Alias", Platzhalter = "KlAlias", FieldName = "CustomerAlias", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Geburtsdatum", Platzhalter = "KlGeburtsdatum", FieldName = "Person.DateOfBirth", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Geburtsort", Platzhalter = "KlGeburtsort", FieldName = "Person.PlaceOfBirth", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Staatsangehörigkeit", Platzhalter = "KlStaatsangehoerigkeit", FieldName = "Person.Nationalitaet.Value", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Telefon", Platzhalter = "KlTelefon", FieldName = "Person.Contacts", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Handy", Platzhalter = "KlHandy", FieldName = "Person.Contacts", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "E-Mail", Platzhalter = "KlEmail", FieldName = "Person.Contacts", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Fax", Platzhalter = "KlFax", FieldName = "Person.Contacts", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Beruf", Platzhalter = "KlBeruf", FieldName = "Person.Profession", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "BG Nummer", Platzhalter = "KlBGNummer", FieldName = "BGNummer", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Debitorennumer", Platzhalter = "KlDebitorennumer", FieldName = "DebitorNumber", IconType = "AB" });
|
|
personendaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Kostenstelle", Platzhalter = "KlKostenstelle", FieldName = "CostCenter", IconType = "AB" });
|
|
|
|
|
|
|
|
PlatzhalterDC adressdatenKlient = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Adressdaten",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "Home"
|
|
};
|
|
|
|
adressdatenKlient.Children.Add(new PlatzhalterDC() { Bezeichnung = "Adresszusatz", Platzhalter = "KlAdresszusatz", IconType = "AB", FieldName = "Person.Address.AddressLine1" });
|
|
adressdatenKlient.Children.Add(new PlatzhalterDC() { Bezeichnung = "Straße", Platzhalter = "KlStrasse", IconType = "AB", FieldName = "Person.Address.Street" });
|
|
adressdatenKlient.Children.Add(new PlatzhalterDC() { Bezeichnung = "PLZ", Platzhalter = "KlPLZ", IconType = "AB", FieldName = "Person.Address.PostalCode" });
|
|
adressdatenKlient.Children.Add(new PlatzhalterDC() { Bezeichnung = "Ort", Platzhalter = "KlOrt", IconType = "AB", FieldName = "Person.Address.Town" });
|
|
|
|
personendaten.Children.Add(adressdatenKlient);
|
|
|
|
//if (AppSettings.Show....)
|
|
//{
|
|
var pm = new VgaPlaceholderManager();
|
|
personendaten.Children.AddRange(pm.GetPlatzhalter());
|
|
//}
|
|
|
|
|
|
|
|
|
|
PlatzhalterDC betreuung = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Betreuung",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "Paste"
|
|
};
|
|
|
|
PlatzhalterDC betreuungsbeginn = new PlatzhalterDC() { Bezeichnung = "Betreuungsbeginn", Platzhalter = "KlBetreuungsbeginn", FieldName = "AssistanceBegin", Format = "dd.MM.yyyy", IconType = "AB" };
|
|
betreuung.Children.Add(betreuungsbeginn);
|
|
PlatzhalterDC betreuungsende = new PlatzhalterDC() { Bezeichnung = "Betreuungsende", Platzhalter = "KlBetreuungsende", FieldName = "TerminationDate", Format = "dd.MM.yyyy", IconType = "AB" };
|
|
betreuung.Children.Add(betreuungsende);
|
|
PlatzhalterDC grundBetreuungsende = new PlatzhalterDC() { Bezeichnung = "Grund Betreuungsbeendung", Platzhalter = "KlGrundBetreuungsbeendung", FieldName = "TerminationReason.Value", IconType = "AB" };
|
|
betreuung.Children.Add(grundBetreuungsende);
|
|
|
|
personendaten.Children.Add(betreuung);
|
|
|
|
PlatzhalterDC behindertenausweis = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Schwerbehindertenausweis",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "ContactCardWebDisabled"
|
|
};
|
|
|
|
PlatzhalterDC amt = new PlatzhalterDC() { Bezeichnung = "Ausstellendes Amt", Platzhalter = "AusweisAmt", FieldName = "AusstVersAmt", IconType = "AB" };
|
|
behindertenausweis.Children.Add(amt);
|
|
PlatzhalterDC gueltigVon = new PlatzhalterDC() { Bezeichnung = "Gültig von", Platzhalter = "AusweisGueltigVon", FieldName = "AusweisGueltigVon", Format = "dd.MM.yyyy", IconType = "AB" };
|
|
behindertenausweis.Children.Add(gueltigVon);
|
|
PlatzhalterDC gueltigbis = new PlatzhalterDC() { Bezeichnung = "Gültig bis", Platzhalter = "AusweisGueltigBis", FieldName = "AusweisGueltigBis", Format = "dd.MM.yyyy", IconType = "AB" };
|
|
behindertenausweis.Children.Add(gueltigbis);
|
|
PlatzhalterDC ausweisAktenzeichen = new PlatzhalterDC() { Bezeichnung = "Aktenzeichen", Platzhalter = "AusweisAktenzeichen", FieldName = "AusweisAktenzeichen", IconType = "AB" };
|
|
behindertenausweis.Children.Add(ausweisAktenzeichen);
|
|
PlatzhalterDC beiblatt = new PlatzhalterDC() { Bezeichnung = "Beiblattgültigkeit", Platzhalter = "AusweisBeiblatt", FieldName = "BeiblattGueltigBis", Format = "dd.MM.yyyy", IconType = "AB" };
|
|
behindertenausweis.Children.Add(beiblatt);
|
|
PlatzhalterDC gradDerBehinderung = new PlatzhalterDC() { Bezeichnung = "Grad der Behinderung", Platzhalter = "AusweisGradDerBehinderung", FieldName = "GradDerBehinderung", IconType = "AB" };
|
|
behindertenausweis.Children.Add(gradDerBehinderung);
|
|
|
|
betreuung.Children.Add(behindertenausweis);
|
|
|
|
|
|
PlatzhalterDC pflegegrad = new PlatzhalterDC() { Bezeichnung = "Pflegegrad", Platzhalter = "KlPflegegrad", FieldName = "Pflegegrad", IconType = "AB" };
|
|
betreuung.Children.Add(pflegegrad);
|
|
|
|
PlatzhalterDC versicherung = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Versicherungsdaten",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "OfficeBulidingBlackDisabled"
|
|
};
|
|
|
|
|
|
versicherung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Krankenkasse", Platzhalter = "KlKrankenkasse", FieldName = "HealthInsurance", IconType = "AB" });
|
|
versicherung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Versichertennummer", Platzhalter = "KlVersNummer", FieldName = "InsuranceNumber", IconType = "AB" });
|
|
versicherung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Versicherungsstatus", Platzhalter = "KlVersicherungsstatus", FieldName = "VersichertenStatus", IconType = "AB" });
|
|
|
|
personendaten.Children.Add(versicherung);
|
|
|
|
|
|
//if (AppSettings.Show....)
|
|
//{
|
|
var wpm = new WohnheimPlaceholderManager();
|
|
personendaten.Children.AddRange(wpm.GetPlatzhalter());
|
|
//}
|
|
|
|
|
|
PlatzhalterDC sonstiges = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Sonstiges",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "Add24"
|
|
};
|
|
#region Children Sonstiges
|
|
PlatzhalterDC datum = new PlatzhalterDC() { Bezeichnung = "Tagesdatum", Platzhalter = "Tagesdatum", IconType = "AB" };
|
|
sonstiges.Children.Add(datum);
|
|
#endregion
|
|
|
|
|
|
|
|
liste.Add(personendaten);
|
|
//liste.Add(adressdatenOrganisation);
|
|
|
|
var epm = new EmployeePlaceholderManager();
|
|
liste.AddRange(epm.GetPlatzhalter());
|
|
|
|
liste.Add(sonstiges);
|
|
|
|
return liste;
|
|
}
|
|
|
|
public override Object GetEntityObject(long oid)
|
|
{
|
|
return DAOFactory.GenericDAO.GetByID<Customer>(oid);
|
|
}
|
|
|
|
public override String GetPlaceholderValue(PlatzhalterDC ph, Object obj)
|
|
{
|
|
return GetPlaceholderValueForCustomer(ph, obj as Customer) ?? String.Empty;
|
|
}
|
|
|
|
public String GetPlaceholderValueForCustomer(PlatzhalterDC ph, Customer customer)
|
|
{
|
|
if (customer == null)
|
|
{
|
|
return String.Empty;
|
|
}
|
|
|
|
if (ph.PlatzhalterID.Contains("MaAdresszusatz"))
|
|
{
|
|
int test = 0;
|
|
}
|
|
|
|
if (ph.FieldName != null && ph.FieldName.Contains("CustomerVermittlungArbeit"))
|
|
{
|
|
var pm = new VgaPlaceholderManager();
|
|
return pm.GetPlaceholderValue(ph, customer);
|
|
}
|
|
if (ph.FieldName != null && ph.FieldName.Contains("Wohneinheit"))
|
|
{
|
|
var pm = new WohnheimPlaceholderManager();
|
|
return pm.GetPlaceholderValue(ph, customer);
|
|
}
|
|
if (ph.PlatzhalterID.StartsWith("Ma"))
|
|
{
|
|
var em = new EmployeePlaceholderManager();
|
|
return em.GetPlaceholderValueForEmployee(ph, Data.Security.UserRightHelper.GetLoggedInUser().Employee);
|
|
}
|
|
|
|
if (ph.PlatzhalterID == "KlBriefanrede")
|
|
{
|
|
if (customer.Person.Sex == Sex.Male)
|
|
return "Sehr geehrter Herr";
|
|
else if (customer.Person.Sex == Sex.Female)
|
|
return "Sehr geehrte Frau";
|
|
}
|
|
|
|
if (ph.PlatzhalterID == "KlAnrede")
|
|
{
|
|
if (customer.Person.Sex == Sex.Male)
|
|
return "Herr";
|
|
else if (customer.Person.Sex == Sex.Female)
|
|
return "Frau";
|
|
}
|
|
|
|
if (ph.PlatzhalterID == "KlGeburtsdatum")
|
|
{
|
|
return String.Format("{0:dd.MM.yyyy}", customer.Person.DateOfBirth);
|
|
}
|
|
|
|
if (ph.PlatzhalterID == "KlTelefon")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Phone)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.PlatzhalterID == "KlHandy")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_MobilePhone)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.PlatzhalterID == "KlEmail")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Mail)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.PlatzhalterID == "KlFax")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Fax)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
|
|
//Adressdaten
|
|
//if (customer.Person.Address != null)
|
|
//{
|
|
// if (ph.Platzhalter == "KlStrasse")
|
|
// {
|
|
// return customer.Person.Address.Street;
|
|
// }
|
|
// if (ph.Platzhalter == "KlPLZ")
|
|
// {
|
|
// return customer.Person.Address.PostalCode;
|
|
// }
|
|
// if (ph.Platzhalter == "KlOrt")
|
|
// {
|
|
// return customer.Person.Address.Town;
|
|
// }
|
|
//}
|
|
|
|
|
|
//Betreuung
|
|
if (ph.PlatzhalterID == "KlAnsprechpartner")
|
|
{
|
|
|
|
string anrede = (customer.Ansprechpartner.Sex == 0) ? "Herr " : "Frau ";
|
|
return anrede + customer.Ansprechpartner.FirstNameLastName;
|
|
}
|
|
if (ph.PlatzhalterID == "Kostenstelle")
|
|
{
|
|
return customer.CostCenter;
|
|
}
|
|
|
|
//Sonstiges
|
|
if (ph.PlatzhalterID == "Tagesdatum")
|
|
{
|
|
return String.Format("{0:dd.MM.yyyy}", DateTime.Now);
|
|
}
|
|
|
|
|
|
return base.GetPlaceholderValue(ph, customer);
|
|
}
|
|
|
|
}
|
|
}
|