diff --git a/Service/Dokumentverwaltung/CustomerPlaceholderManager.cs b/Service/Dokumentverwaltung/CustomerPlaceholderManager.cs index d63a582aa..62aff0545 100644 --- a/Service/Dokumentverwaltung/CustomerPlaceholderManager.cs +++ b/Service/Dokumentverwaltung/CustomerPlaceholderManager.cs @@ -55,7 +55,7 @@ namespace BeWo.Service.Dokumentverwaltung IconType = "Home" }; - adressdatenKlient.Children.Add(new PlatzhalterDC() { Bezeichnung = "Adresszusatz", Platzhalter = "KlAdresszusatz", IconType = "AB", FieldName = "Person.Address.Addressline1" }); + 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" }); @@ -130,7 +130,7 @@ namespace BeWo.Service.Dokumentverwaltung //if (AppSettings.Show....) //{ - var wpm = new WohnheinPlaceholderManager(); + var wpm = new WohnheimPlaceholderManager(); personendaten.Children.AddRange(wpm.GetPlatzhalter()); //} @@ -150,6 +150,9 @@ namespace BeWo.Service.Dokumentverwaltung liste.Add(personendaten); //liste.Add(adressdatenOrganisation); + + var epm = new EmployeePlaceholderManager(); + liste.AddRange(epm.GetPlatzhalter()); liste.Add(sonstiges); @@ -173,24 +176,28 @@ namespace BeWo.Service.Dokumentverwaltung 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.Platzhalter == "MaVorname" || - ph.Platzhalter == "MaNachname" || - ph.Platzhalter == "MaTelefon" || - ph.Platzhalter == "MaFax" || - ph.Platzhalter == "MaEmail" || - ph.Platzhalter == "MaHandy") + 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.Platzhalter == "KlBriefanrede") + if (ph.PlatzhalterID == "KlBriefanrede") { if (customer.Person.Sex == Sex.Male) return "Sehr geehrter Herr"; @@ -198,7 +205,7 @@ namespace BeWo.Service.Dokumentverwaltung return "Sehr geehrte Frau"; } - if (ph.Platzhalter == "KlAnrede") + if (ph.PlatzhalterID == "KlAnrede") { if (customer.Person.Sex == Sex.Male) return "Herr"; @@ -206,12 +213,12 @@ namespace BeWo.Service.Dokumentverwaltung return "Frau"; } - if (ph.Platzhalter == "KlGeburtsdatum") + if (ph.PlatzhalterID == "KlGeburtsdatum") { return String.Format("{0:dd.MM.yyyy}", customer.Person.DateOfBirth); } - if (ph.Platzhalter == "KlTelefon") + if (ph.PlatzhalterID == "KlTelefon") { foreach (Contact c in customer.Person.Contacts) { @@ -221,7 +228,7 @@ namespace BeWo.Service.Dokumentverwaltung } } } - if (ph.Platzhalter == "KlHandy") + if (ph.PlatzhalterID == "KlHandy") { foreach (Contact c in customer.Person.Contacts) { @@ -231,7 +238,7 @@ namespace BeWo.Service.Dokumentverwaltung } } } - if (ph.Platzhalter == "KlEmail") + if (ph.PlatzhalterID == "KlEmail") { foreach (Contact c in customer.Person.Contacts) { @@ -241,7 +248,7 @@ namespace BeWo.Service.Dokumentverwaltung } } } - if (ph.Platzhalter == "KlFax") + if (ph.PlatzhalterID == "KlFax") { foreach (Contact c in customer.Person.Contacts) { @@ -271,23 +278,24 @@ namespace BeWo.Service.Dokumentverwaltung //Betreuung - if (ph.Platzhalter == "KlAnsprechpartner") + if (ph.PlatzhalterID == "KlAnsprechpartner") { string anrede = (customer.Ansprechpartner.Sex == 0) ? "Herr " : "Frau "; return anrede + customer.Ansprechpartner.FirstNameLastName; } - if (ph.Platzhalter == "Kostenstelle") + if (ph.PlatzhalterID == "Kostenstelle") { return customer.CostCenter; } //Sonstiges - if (ph.Platzhalter == "Tagesdatum") + if (ph.PlatzhalterID == "Tagesdatum") { return String.Format("{0:dd.MM.yyyy}", DateTime.Now); } + return base.GetPlaceholderValue(ph, customer); } diff --git a/Service/Dokumentverwaltung/EmployeePlaceholderManager.cs b/Service/Dokumentverwaltung/EmployeePlaceholderManager.cs index 3650d05dd..b7a8015de 100644 --- a/Service/Dokumentverwaltung/EmployeePlaceholderManager.cs +++ b/Service/Dokumentverwaltung/EmployeePlaceholderManager.cs @@ -28,6 +28,7 @@ namespace BeWo.Service.Dokumentverwaltung Children = new List(), IconType = "UserGroupHome24bw" }; + employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Anrede", Platzhalter = "MaAnrede", FieldName = "Person.FirstName", IconType = "AB" }); employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Vorname", Platzhalter = "MaVorname", FieldName = "Person.FirstName", IconType = "AB" }); employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Nachname", Platzhalter = "MaNachname", FieldName = "Person.LastName", IconType = "AB" }); employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Telefon", Platzhalter = "MaTelefon", FieldName = "Person.Phone", IconType = "AB" }); @@ -44,7 +45,7 @@ namespace BeWo.Service.Dokumentverwaltung IconType = "Home" }; - adressdaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Adresszusatz", Platzhalter = "MaAdresszusatz", IconType = "AB", FieldName = "Person.Address.Addressline1" }); + adressdaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Adresszusatz", Platzhalter = "MaAdresszusatz", IconType = "AB", FieldName = "Person.Address.AddressLine1" }); adressdaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Straße", Platzhalter = "MaStrasse", IconType = "AB", FieldName = "Person.Address.Street" }); adressdaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "PLZ", Platzhalter = "MaPLZ", IconType = "AB", FieldName = "Person.Address.PostalCode" }); adressdaten.Children.Add(new PlatzhalterDC() { Bezeichnung = "Ort", Platzhalter = "MaOrt", IconType = "AB", FieldName = "Person.Address.Town" }); @@ -72,22 +73,30 @@ namespace BeWo.Service.Dokumentverwaltung return String.Empty; } - if (ph.Platzhalter == "MaVorname") + if (ph.PlatzhalterID == "MaAnrede") + { + if (employee.Person.Sex == Sex.Male) + return "Herr"; + else if (employee.Person.Sex == Sex.Female) + return "Frau"; + } + + if (ph.PlatzhalterID == "MaVorname") { return base.GetPlaceholderValue(ph, employee); //return customer.Person.FirstName; } - if (ph.Platzhalter == "MaNachname") + if (ph.PlatzhalterID == "MaNachname") { return employee.Person.LastName; } - if (ph.Platzhalter == "MaGeburtsdatum") + if (ph.PlatzhalterID == "MaGeburtsdatum") { return String.Format("{0:dd.MM.yyyy}", employee.Person.DateOfBirth); } - if (ph.Platzhalter == "MaTelefon") + if (ph.PlatzhalterID == "MaTelefon") { foreach (Contact c in employee.Person.Contacts) { @@ -97,7 +106,7 @@ namespace BeWo.Service.Dokumentverwaltung } } } - if (ph.Platzhalter == "MaHandy") + if (ph.PlatzhalterID == "MaHandy") { foreach (Contact c in employee.Person.Contacts) { @@ -107,7 +116,7 @@ namespace BeWo.Service.Dokumentverwaltung } } } - if (ph.Platzhalter == "MaEmail") + if (ph.PlatzhalterID == "MaEmail") { foreach (Contact c in employee.Person.Contacts) { @@ -117,7 +126,7 @@ namespace BeWo.Service.Dokumentverwaltung } } } - if (ph.Platzhalter == "MaFax") + if (ph.PlatzhalterID == "MaFax") { foreach (Contact c in employee.Person.Contacts) { @@ -128,7 +137,7 @@ namespace BeWo.Service.Dokumentverwaltung } } - return String.Empty; + return base.GetPlaceholderValue(ph, employee); } } diff --git a/Service/Dokumentverwaltung/PlaceholderManager.cs b/Service/Dokumentverwaltung/PlaceholderManager.cs index c50e99a7c..209ce6488 100644 --- a/Service/Dokumentverwaltung/PlaceholderManager.cs +++ b/Service/Dokumentverwaltung/PlaceholderManager.cs @@ -79,16 +79,11 @@ namespace BeWo.Service.Dokumentverwaltung { if (!String.IsNullOrEmpty(ph.Format)) { - return String.Format("{0:" + ph.Format + "}", returnObj); } return returnObj.ToString(); } } - else - { - int test = 0; - } return ""; } diff --git a/Service/Dokumentverwaltung/VgaPlaceholderManager.cs b/Service/Dokumentverwaltung/VgaPlaceholderManager.cs index 3d3762c41..46321b3ce 100644 --- a/Service/Dokumentverwaltung/VgaPlaceholderManager.cs +++ b/Service/Dokumentverwaltung/VgaPlaceholderManager.cs @@ -114,12 +114,14 @@ namespace BeWo.Service.Dokumentverwaltung return String.Empty; } - if (ph.FieldName.Contains("CustomerVermittlungArbeit")) + if (ph.FieldName.StartsWith("CustomerVermittlungArbeit.")) { + ph.FieldName = ph.FieldName.Replace("CustomerVermittlungArbeit.", ""); + var cva = GetCurrentCustomerVermittlungArbeit(customer); if (cva != null) { - return GetPlaceholderValueForCustomerVermittlungArbeit(ph, cva); + return base.GetPlaceholderValue(ph, cva); } } @@ -127,21 +129,6 @@ namespace BeWo.Service.Dokumentverwaltung return String.Empty; } - public String GetPlaceholderValueForCustomerVermittlungArbeit(PlatzhalterDC ph, CustomerVermittlungArbeit cva) - { - if (cva == null) - { - return String.Empty; - } - - var value = base.GetPlaceholderValue(ph.FieldName, cva); - - if (value != null) - { - return value.ToString(); - } - return String.Empty; - } private CustomerVermittlungArbeit GetCurrentCustomerVermittlungArbeit(Customer customer) { diff --git a/Service/Dokumentverwaltung/VorlagenManager.cs b/Service/Dokumentverwaltung/VorlagenManager.cs index f15fc63a4..d14289fa3 100644 --- a/Service/Dokumentverwaltung/VorlagenManager.cs +++ b/Service/Dokumentverwaltung/VorlagenManager.cs @@ -9,9 +9,6 @@ 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 { @@ -60,15 +57,17 @@ namespace BeWo.Service.Dokumentverwaltung return MapperFactory.DokumentvorlageDC_Dokumentvorlage.MapToNewDC(entity); } - public List GetPlatzhalterForTemplate(VorlagentabelleDC vt) + public virtual List GetPlatzhalterForTemplate(VorlagentabelleDC vt) { - PlaceholderManager pm = null; + return GetPlatzhalterForTid((TableID)vt.VorlagentabelleObjectTid); + } - var tid = (TableID)vt.VorlagentabelleObjectTid; + public virtual List GetPlatzhalterForTid(TableID tid) + { switch (tid) { case TableID.Customer: - pm = new CustomerPlaceholderManager(); + return GetPlatzhalterForCustomer(); break; case TableID.SupportConcept: return GetPlatzhalterForSupportConcept(); @@ -77,15 +76,16 @@ namespace BeWo.Service.Dokumentverwaltung default: break; } - if (pm != null) - { - return pm.GetPlatzhalter(); - } return null; } - - public List GetPlatzhalterForSupportConcept() + public virtual List GetPlatzhalterForCustomer() + { + var pm = new CustomerPlaceholderManager(); + return pm.GetPlatzhalter(); + } + + public virtual List GetPlatzhalterForSupportConcept() { List liste = new List(); @@ -155,7 +155,7 @@ namespace BeWo.Service.Dokumentverwaltung return liste; } - public List GetPlatzhalterForEmployee() + public virtual List GetPlatzhalterForEmployee() { List liste = new List(); @@ -323,11 +323,9 @@ namespace BeWo.Service.Dokumentverwaltung if (pm != null) { - + var phList = GetPlatzhalterForTid(tid); var obj = pm.GetEntityObject(objectOid); - var phList = pm.GetPlatzhalter(); - ReplacePlaceholdersInTemplate(pm, rtfServer, phList, obj); } } @@ -507,8 +505,7 @@ namespace BeWo.Service.Dokumentverwaltung { attributeString += (s != attributeList.Last()) ? s + ", " : s; } - MessageBox.Show("Seite für " + employee.Person.FirstNameLastName + " kann nicht erstellt werden, da folgende Attribute des Mitarbeiters nicht gesetzt sind:\n" + - attributeString + "\nSetzen Sie die Attribute und erstellen Sie die Druckvorscheu für den Mitarbeiter erneut.", "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Warning); + return ""; } } @@ -746,8 +743,6 @@ namespace BeWo.Service.Dokumentverwaltung { attributeString += (s != attributeList.Last()) ? s + ", " : s; } - MessageBox.Show("Seite für " + supportConcept.Customer.Person.FirstNameLastName + " kann nicht erstellt werden, da folgende Attribute des Hilfeplans nicht gesetzt sind:\n" + - attributeString + "\nSetzen Sie die Attribute und erstellen Sie die Druckvorschau für den Hilfeplan erneut.", "BeWoPlaner", MessageBoxButton.OK, MessageBoxImage.Warning); return ""; } } @@ -799,5 +794,29 @@ namespace BeWo.Service.Dokumentverwaltung return rtf; } + protected void ReplacePlatzhalter(List list, PlatzhalterDC newPh) + { + PlatzhalterDC oldPh = null; + int idx = 0; + foreach (var item in list) + { + if (item.PlatzhalterID == newPh.PlatzhalterID) + { + oldPh = item; + break; + } + if (item.Children != null) + { + ReplacePlatzhalter(item.Children, newPh); + } + idx++; + } + + if (oldPh != null) + { + list.RemoveAt(idx); + list.Insert(idx, newPh); + } + } } } diff --git a/Service/Dokumentverwaltung/WohnheimPlaceholderManager.cs b/Service/Dokumentverwaltung/WohnheimPlaceholderManager.cs index 9e65c1286..2275ee175 100644 --- a/Service/Dokumentverwaltung/WohnheimPlaceholderManager.cs +++ b/Service/Dokumentverwaltung/WohnheimPlaceholderManager.cs @@ -15,7 +15,7 @@ using System.Windows.Media.Imaging; namespace BeWo.Service.Dokumentverwaltung { - public class WohnheinPlaceholderManager : PlaceholderManager + public class WohnheimPlaceholderManager : PlaceholderManager { public override List GetPlatzhalter() @@ -31,178 +31,56 @@ namespace BeWo.Service.Dokumentverwaltung Children = new List(), 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" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Einzugsdatum", Platzhalter = "WVEinzugsdatum", FieldName = "WohneinheitBelegung.StartDate", Format = "dd.MM.yyyy", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Auszugsdatum", Platzhalter = "WVAuszugsdatum", FieldName = "WohneinheitBelegung.EndDate", Format = "dd.MM.yyyy", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Name des Wohnprojekts", Platzhalter = "WVWohnheimName", FieldName = "WohneinheitBelegung.Wohneinheit.Wohnheim.WohnheimName", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Straße", Platzhalter = "WVStrasse", FieldName = "WohneinheitBelegung.Wohneinheit.Wohnheim.Strasse", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "PLZ", Platzhalter = "WVPLZ", FieldName = "WohneinheitBelegung.Wohneinheit.Wohnheim.PLZ", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Ort", Platzhalter = "WVOrt", FieldName = "WohneinheitBelegung.Wohneinheit.Wohnheim.Ort", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Name der Wohnung", Platzhalter = "WVWohnungsname", FieldName = "WohneinheitBelegung.Wohneinheit.Wohnname", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Zimmername", Platzhalter = "WVZimmername", FieldName = "WohneinheitBelegung.Wohneinheit.Zimmername", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Stockwerk", Platzhalter = "WVStock", FieldName = "WohneinheitBelegung.Wohneinheit.Stock", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Miete", Platzhalter = "WVMiete", FieldName = "WohneinheitBelegung.Wohneinheit.Miete", Format="c", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Heizung", Platzhalter = "WVHeizung", FieldName = "WohneinheitBelegung.Wohneinheit.Heizung", Format = "c", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Strom", Platzhalter = "WVStrom", FieldName = "WohneinheitBelegung.Wohneinheit.Strom", Format = "c", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Betriebskosten", Platzhalter = "WVBetriebskosten", FieldName = "WohneinheitBelegung.Wohneinheit.Betriebskosten", Format = "c", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Sonstige Kosten", Platzhalter = "WVSonstigeKosten", FieldName = "WohneinheitBelegung.Wohneinheit.SonstigeKosten", Format = "c", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Kaution", Platzhalter = "WVKaution", FieldName = "WohneinheitBelegung.Wohneinheit.Kaution", Format = "c", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Zusatz", Platzhalter = "WVZusatz", FieldName = "WohneinheitBelegung.Wohneinheit.Zusatznotiz", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 1", Platzhalter = "WVDetails1", FieldName = "WohneinheitBelegung.Wohneinheit.Details1", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 2", Platzhalter = "WVDetails2", FieldName = "WohneinheitBelegung.Wohneinheit.Details2", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 3", Platzhalter = "WVDetails3", FieldName = "WohneinheitBelegung.Wohneinheit.Details3", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 4", Platzhalter = "WVDetails4", FieldName = "WohneinheitBelegung.Wohneinheit.Details4", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 5", Platzhalter = "WVDetails5", FieldName = "WohneinheitBelegung.Wohneinheit.Details5", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 6", Platzhalter = "WVDetails6", FieldName = "WohneinheitBelegung.Wohneinheit.Details6", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 7", Platzhalter = "WVDetails7", FieldName = "WohneinheitBelegung.Wohneinheit.Details7", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 8", Platzhalter = "WVDetails8", FieldName = "WohneinheitBelegung.Wohneinheit.Details8", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 9", Platzhalter = "WVDetails9", FieldName = "WohneinheitBelegung.Wohneinheit.Details9", IconType = "AB" }); + wohnung.Children.Add(new PlatzhalterDC() { Bezeichnung = "Details 10", Platzhalter = "WVDetails10", FieldName = "WohneinheitBelegung.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) - { + var customer = obj as Customer; if (customer == null) { return String.Empty; } - if (ph.FieldName.Contains("CustomerVermittlungArbeit")) + if (ph.FieldName.StartsWith("WohneinheitBelegung.")) { - 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; - } - } + ph.FieldName = ph.FieldName.Replace("WohneinheitBelegung.", ""); - //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); + var whb = GetCurrentWohneinheit(customer); + if (whb != null) + { + return base.GetPlaceholderValue(ph, whb); + } } return String.Empty; diff --git a/Shared/DataContracts/PlatzhalterDC.cs b/Shared/DataContracts/PlatzhalterDC.cs index 8b6b8c92c..69f8db7de 100644 --- a/Shared/DataContracts/PlatzhalterDC.cs +++ b/Shared/DataContracts/PlatzhalterDC.cs @@ -8,8 +8,22 @@ namespace BS.Shared.DataContracts { public class PlatzhalterDC { + private string _Platzhalter; + public string Bezeichnung { get; set; } - public string Platzhalter { get; set; } + public string Platzhalter + { + get { return _Platzhalter; } + set + { + _Platzhalter = value; + if (String.IsNullOrEmpty(PlatzhalterID)) + { + PlatzhalterID = value; + } + } + } + public string PlatzhalterID { get; set; } public string FieldName { get; set; } // Angebundenes DB-Feld im Hintergrund //public byte[] Icon { get; set; } // Bild, was in TreeView angezeigt wird public string IconType { get; set; } // Typ, der über das geladene Bild ausgesucht wird