using System;
using System.Collections.Generic;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using BS.Shared.DataContracts;
using BeWo.Report;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;

namespace BeWo.CaritasFrankfurtReports
{
    public partial class Klientenstammblatt : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<CustomerDataRO>
    {
        public Klientenstammblatt()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(CustomerDataRO pRO)
        {
            List<CustomerEmployeeRelationDC> list = new List<CustomerEmployeeRelationDC>();
            if (pRO.RelatedEmployees != null)
            {
                foreach (var customerEmployeeRelationDc in pRO.RelatedEmployees)
                {
                    if (customerEmployeeRelationDc.RelationRole != null && 
                        customerEmployeeRelationDc.RelationRole.TypeDescription.ToLower().IndexOf("vertreter") < 0 && 
                        customerEmployeeRelationDc.RelationRole.TypeDescription.ToLower().IndexOf("vertretung") < 0)
                   list.Add(customerEmployeeRelationDc);

                }
                pRO.RelatedEmployees = list;
            }
            if (pRO.VarField9 != null)
            {
                String vf = pRO.VarField9.ToString();
                if (vf.ToLower() == "true")
                    pRO.VarField5 = "unbegrenzt";
            }
            this.bindingSource1.DataSource = pRO;
        }
    }
}
