using System;
using System.Collections;
using System.ComponentModel;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using System.Collections.Generic;

namespace BeWo.ZukunftWohnenReports
{
    public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
    {
        public Stundenzettel()
        {
            InitializeComponent();
        }

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
            if (pRO.Services != null)
            {
                //List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();

                foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
                {
					if (!s.IsBillable)
						s.FLSQualifiedString = "M";
	                else if (s.IsGroup)
		                s.FLSQualifiedString = "G";
	                else
		                s.FLSQualifiedString = "D";
                }

                //pRO.Services = servicesBillable;
            }

			StringBuilder sb = new StringBuilder();
	        var emps = DAOFactory.GenericDAO.GetAllActive<Employee>();
	        foreach (var employee in emps)
	        {
				if (sb.Length > 0)
			        sb.Append(Environment.NewLine);
		        sb.Append(employee.Person.Abbreviation);
				sb.Append("=");
				sb.Append(employee.Person.FirstName);
				sb.Append(" ");
				sb.Append(employee.Person.LastName);
	        }
	        lblMAInfo.Text = sb.ToString();
            this.bindingSource1.DataSource = pRO;
        }
    }
}
