Files
BeWoPlaner/Report/DefaultReports/EmployeeDataReport.cs

74 lines
2.5 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using BeWo.Report;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using System.Text;
using BS.Shared.DataContracts;
using System.Collections.Generic;
namespace BeWo.Report.DefaultReports
{
public partial class Personalstammblatt : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<EmployeeDataRO>
{
public Personalstammblatt()
{
InitializeComponent();
}
public void SetReportDataSource(EmployeeDataRO pRO)
{
String qualifications = null;
if (pRO.Employee.Qualifications != null)
{
foreach (var qua in pRO.Employee.Qualifications)
{
if (qualifications != null)
qualifications += ", ";
qualifications += qua.TypeDescription;
}
}
String focus = null;
if (pRO.Employee.Focuses != null)
{
foreach (var foc in pRO.Employee.Focuses)
{
if (focus != null)
focus += ", ";
focus += foc.TypeDescription;
}
}
lblFachkraft.Text = "nein";
if (pRO.Employee.IsQualified == true)
lblFachkraft.Text = "ja";
lblQualifikationen.Text = qualifications;
lblArbeitsschwerpunkte.Text = focus;
CreateClientsTable(pRO.Employee.RelatedCustomers);
this.bindingSource1.DataSource = pRO;
}
private void CreateClientsTable(List<CustomerEmployeeRelationDC> customers)
{
if (customers != null)
{
XRTableRow newRow = null;
foreach (var c in customers)
{
if (newRow == null)
newRow = tableClients.Rows[0];
else
newRow = tableClients.InsertRowBelow(tableClients.Rows[tableClients.Rows.Count - 1]);
newRow.Font = new System.Drawing.Font("Arial", 9F);
newRow.Cells[0].Text = String.Format("{0} {1}", c.Customer.FirstName, c.Customer.LastName);
newRow.Cells[1].Text = String.Format("{0}", c.RelationRole.TypeDescription);
newRow.Cells[2].Text = c.Notice;
}
}
}
}
}