Files
BeWoPlaner/Report/DefaultReports/SBDEmployeeReport.cs
2023-10-26 00:06:56 +02:00

58 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using DevExpress.XtraReports.UI;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.DataContracts;
namespace BeWo.Report.DefaultReports
{
public partial class SBDEmployeeReport : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<SBDEmployeeRO>
{
public SBDEmployeeReport()
{
InitializeComponent();
}
public void SetReportDataSource(SBDEmployeeRO pRO)
{
CreateArbeitszeitenTable(pRO.Employee.Arbeitszeiten);
this.bindingSource1.DataSource = pRO;
}
private void CreateArbeitszeitenTable(List<ArbeitszeitDC> zeiten)
{
if (zeiten != null)
{
foreach (var az in zeiten)
{
if ((!az.GueltigVon.HasValue || az.GueltigVon <= DateTime.Now) &&
(!az.GueltigBis.HasValue || az.GueltigBis >= DateTime.Now) && az.Eintraege != null)
{
foreach (var e in az.Eintraege)
{
AddArbeitszeit(e);
}
}
}
}
}
private void AddArbeitszeit(ArbeitszeitEintragDC ae)
{
XRTableRow newRow = tableBetreuungszeiten.InsertRowBelow(tableBetreuungszeiten.Rows[tableBetreuungszeiten.Rows.Count - 1]);
newRow.Font = new System.Drawing.Font("Arial", 10F);
newRow.Cells[0].Text = String.Format("{0}", ae.Tag);
newRow.Cells[1].Text = String.Format("{0} - {1}", ae.UhrzeitVon, ae.UhrzeitBis);
newRow.Cells[2].Text = ae.Notice;
}
}
}