Files
BeWoPlaner/ReportImp/LebenshilfeDorsten/SupportConceptReport.cs
2022-02-23 17:47:22 +01:00

77 lines
2.6 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using BS.Shared.Extensions;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BS.Shared;
namespace LebenshilfeDorsten
{
public partial class Hilfeplanuebersicht : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<SupportConceptListRO>
{
public Hilfeplanuebersicht()
{
InitializeComponent();
}
public void SetReportDataSource(SupportConceptListRO pRO)
{
if (pRO.AppointedDate.HasValue && pRO.AppointedDate.Value.Date < DateTime.Now.Date)
{
xrLabel1.Text = String.Format("Hilfeplanübersicht Stand {0:dd.MM.yyyy}", pRO.AppointedDate);
}
if (pRO.SupportConceptDetailList != null)
{
foreach (var sc in pRO.SupportConceptDetailList)
{
sc.Custom1 = GetHauptbetreuer(sc);
}
}
this.bindingSource1.DataSource = pRO;
}
private string GetHauptbetreuer(SupportConceptListRO.SupportConceptDetail sc)
{
String name = "";
if (sc.CostBearer2SupportConceptOid > 0)
{
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(sc.CostBearer2SupportConceptOid);
var customer = c2s.SupportConcept.Customer;
foreach (var item in customer.Employee2CustomerList)
{
foreach (var valueEntry in item.ValueList)
{
if (valueEntry.Entry.Type == ValueListEntryType.StaffRoleType)
{
if (valueEntry.Entry.Value == "Hauptbetreuung")
{
string employeeAbbr = item.Employee.Person.Abbreviation;
if (string.IsNullOrEmpty(employeeAbbr))
{
employeeAbbr = item.Employee.Person.FirstName.Substring(0, 1) + ". " +
item.Employee.Person.LastName.Substring(0, 1);
}
if (name.Length > 0)
{
name += ", ";
}
name += employeeAbbr;
}
}
}
}
}
return name;
}
}
}