218 lines
9.9 KiB
C#
218 lines
9.9 KiB
C#
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
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 WohnheinPlaceholderManager : PlaceholderManager
|
|
{
|
|
|
|
public override List<PlatzhalterDC> GetPlatzhalter()
|
|
{
|
|
List<PlatzhalterDC> liste = new List<PlatzhalterDC>();
|
|
|
|
|
|
|
|
|
|
PlatzhalterDC wohnung = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Wohnung",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "OfficeBulidingBlackDisabled"
|
|
};
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Einzugsdatum", Platzhalter = "WVEinzugsdatum", FieldName = "Person.WohneinheitBelegung.StartDate", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Auszugsdatum", Platzhalter = "WVAuszugsdatum", FieldName = "Person.WohneinheitBelegung.EndDate", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Einheit", Platzhalter = "WVEinheit", FieldName = "Person.Wohneinheit.Zimmername", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Straße", Platzhalter = "WVStrasse", FieldName = "Person.Wohneinheit.Address.Street", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "PLZ", Platzhalter = "WVPLZ", FieldName = "Person.Wohneinheit.Address.PostalCode", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Ort", Platzhalter = "WVOrt", FieldName = "Person.Wohneinheit.Address.Town", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Stockwerk", Platzhalter = "WVStock", FieldName = "Person.Wohneinheit.Stock", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Miete", Platzhalter = "WVMiete", FieldName = "Person.Wohneinheit.Miete", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Heizung", Platzhalter = "WVHeizung", FieldName = "Person.Wohneinheit.Heizung", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Strom", Platzhalter = "WVStrom", FieldName = "Person.Wohneinheit.Strom", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Betriebskosten", Platzhalter = "WVBetriebskosten", FieldName = "Person.Wohneinheit.Betriebskosten", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Sonstige Kosten", Platzhalter = "WVSonstigeKosten", FieldName = "Person.Wohneinheit.SonstigeKosten", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Kaution", Platzhalter = "WVKaution", FieldName = "Person.Wohneinheit.Kaution", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Zusatz", Platzhalter = "WVZusatz", FieldName = "Person.Wohneinheit.Zusatznotiz", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 1", Platzhalter = "WVDetails1", FieldName = "Person.Wohneinheit.Details1", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 2", Platzhalter = "WVDetails2", FieldName = "Person.Wohneinheit.Details2", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 3", Platzhalter = "WVDetails3", FieldName = "Person.Wohneinheit.Details3", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 4", Platzhalter = "WVDetails4", FieldName = "Person.Wohneinheit.Details4", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 5", Platzhalter = "WVDetails5", FieldName = "Person.Wohneinheit.Details5", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 6", Platzhalter = "WVDetails6", FieldName = "Person.Wohneinheit.Details6", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 7", Platzhalter = "WVDetails7", FieldName = "Person.Wohneinheit.Details7", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 8", Platzhalter = "WVDetails8", FieldName = "Person.Wohneinheit.Details8", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 9", Platzhalter = "WVDetails9", FieldName = "Person.Wohneinheit.Details9", IconType = "AB" });
|
|
wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 10", Platzhalter = "WVDetails10", FieldName = "Person.Wohneinheit.Details10", IconType = "AB" });
|
|
|
|
liste.Add(wohnung);
|
|
|
|
return liste;
|
|
}
|
|
|
|
|
|
public override String GetPlaceholderValue(PlatzhalterDC ph, Object obj)
|
|
{
|
|
return GetPlaceholderValueForCustomer(ph, obj as Customer);
|
|
}
|
|
|
|
public String GetPlaceholderValueForCustomer(PlatzhalterDC ph, Customer customer)
|
|
{
|
|
if (customer == null)
|
|
{
|
|
return String.Empty;
|
|
}
|
|
|
|
if (ph.FieldName.Contains("CustomerVermittlungArbeit"))
|
|
{
|
|
var cva = GetCurrentWohneinheit(customer);
|
|
if (cva != null)
|
|
{
|
|
return GetPlaceholderValue(ph, cva);
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "MaVorname" ||
|
|
ph.Platzhalter == "MaNachname" ||
|
|
ph.Platzhalter == "MaTelefon" ||
|
|
ph.Platzhalter == "MaFax" ||
|
|
ph.Platzhalter == "MaEmail" ||
|
|
ph.Platzhalter == "MaHandy")
|
|
{
|
|
var em = new EmployeePlaceholderManager();
|
|
return em.GetPlaceholderValueForEmployee(ph, Data.Security.UserRightHelper.GetLoggedInUser().Employee);
|
|
}
|
|
|
|
if (ph.Platzhalter == "KlBriefanrede")
|
|
{
|
|
if (customer.Person.Sex == Sex.Male)
|
|
return "Sehr geehrter Herr";
|
|
else if (customer.Person.Sex == Sex.Female)
|
|
return "Sehr geehrte Frau";
|
|
}
|
|
|
|
if (ph.Platzhalter == "KlAnrede")
|
|
{
|
|
if (customer.Person.Sex == Sex.Male)
|
|
return "Herr";
|
|
else if (customer.Person.Sex == Sex.Female)
|
|
return "Frau";
|
|
}
|
|
|
|
if (ph.Platzhalter == "KlVorname")
|
|
{
|
|
return base.GetPlaceholderValue(ph, customer);
|
|
//return customer.Person.FirstName;
|
|
}
|
|
if (ph.Platzhalter == "KlNachname")
|
|
{
|
|
return customer.Person.LastName;
|
|
}
|
|
|
|
if (ph.Platzhalter == "KlGeburtsdatum")
|
|
{
|
|
return String.Format("{0:dd.MM.yyyy}", customer.Person.DateOfBirth);
|
|
}
|
|
|
|
if (ph.Platzhalter == "KlTelefon")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Phone)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "KlHandy")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_MobilePhone)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "KlEmail")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Mail)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "KlFax")
|
|
{
|
|
foreach (Contact c in customer.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Fax)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "KlBeruf")
|
|
{
|
|
return customer.Person.Profession;
|
|
}
|
|
|
|
//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.Platzhalter == "KlAnsprechpartner")
|
|
{
|
|
|
|
string anrede = (customer.Ansprechpartner.Sex == 0) ? "Herr " : "Frau ";
|
|
return anrede + customer.Ansprechpartner.FirstNameLastName;
|
|
}
|
|
if (ph.Platzhalter == "Kostenstelle")
|
|
{
|
|
return customer.CostCenter;
|
|
}
|
|
|
|
//Sonstiges
|
|
if (ph.Platzhalter == "Tagesdatum")
|
|
{
|
|
return String.Format("{0:dd.MM.yyyy}", DateTime.Now);
|
|
}
|
|
|
|
return String.Empty;
|
|
}
|
|
|
|
private WohneinheitBelegung GetCurrentWohneinheit(Customer customer)
|
|
{
|
|
return DAOFactory.SearchDAO.FindWohneinheitBelegungForCustomer(customer.Oid.Value, DateTime.Now).FirstOrDefault();
|
|
|
|
}
|
|
}
|
|
}
|