122 lines
4.2 KiB
C#
122 lines
4.2 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 EmployeePlaceholderManager : PlaceholderManager
|
|
{
|
|
|
|
public override List<PlatzhalterDC> GetPlatzhalter()
|
|
{
|
|
List<PlatzhalterDC> liste = new List<PlatzhalterDC>();
|
|
|
|
PlatzhalterDC employeedaten = new PlatzhalterDC()
|
|
{
|
|
Bezeichnung = "Mitarbeiter/in",
|
|
Children = new List<PlatzhalterDC>(),
|
|
IconType = "UserGroupHome24bw"
|
|
};
|
|
employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Vorname", Platzhalter = "MaVorname", FieldName = "Employee.Person.FirstName", IconType = "AB" });
|
|
employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Nachname", Platzhalter = "MaNachname", FieldName = "Employee.Person.LastName", IconType = "AB" });
|
|
employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Telefon", Platzhalter = "MaTelefon", FieldName = "Employee.Person.Phone", IconType = "AB" });
|
|
employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Fax", Platzhalter = "MaFax", FieldName = "Employee.Person.Fax", IconType = "AB" });
|
|
employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "E-Mail", Platzhalter = "MaEmail", FieldName = "Employee.Person.Mail", IconType = "AB" });
|
|
employeedaten.Children.Add(new PlatzhalterDC { Bezeichnung = "Handy", Platzhalter = "MaHandy", FieldName = "Employee.Person.Mobile", IconType = "AB" });
|
|
|
|
|
|
liste.Add(employeedaten);
|
|
|
|
return liste;
|
|
}
|
|
|
|
public virtual Object GetEntityObject(long oid)
|
|
{
|
|
return DAOFactory.GenericDAO.GetByID<Employee>(oid);
|
|
}
|
|
|
|
public override String GetPlaceholderValue(PlatzhalterDC ph, Object obj)
|
|
{
|
|
return GetPlaceholderValueForEmployee(ph, obj as Employee);
|
|
}
|
|
|
|
public String GetPlaceholderValueForEmployee(PlatzhalterDC ph, Employee employee)
|
|
{
|
|
if (employee == null)
|
|
{
|
|
return String.Empty;
|
|
}
|
|
|
|
if (ph.Platzhalter == "MaVorname")
|
|
{
|
|
return base.GetPlaceholderValue(ph, employee);
|
|
//return customer.Person.FirstName;
|
|
}
|
|
if (ph.Platzhalter == "MaNachname")
|
|
{
|
|
return employee.Person.LastName;
|
|
}
|
|
|
|
if (ph.Platzhalter == "MaGeburtsdatum")
|
|
{
|
|
return String.Format("{0:dd.MM.yyyy}", employee.Person.DateOfBirth);
|
|
}
|
|
|
|
if (ph.Platzhalter == "MaTelefon")
|
|
{
|
|
foreach (Contact c in employee.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Phone)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "MaHandy")
|
|
{
|
|
foreach (Contact c in employee.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_MobilePhone)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "MaEmail")
|
|
{
|
|
foreach (Contact c in employee.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Mail)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
if (ph.Platzhalter == "MaFax")
|
|
{
|
|
foreach (Contact c in employee.Person.Contacts)
|
|
{
|
|
if (c.Type == ContactType.business_Fax)
|
|
{
|
|
return c.Value;
|
|
}
|
|
}
|
|
}
|
|
|
|
return String.Empty;
|
|
}
|
|
|
|
}
|
|
}
|