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

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

        public void SetReportDataSource(ServicesOverviewRO pRO)
        {
            if (pRO.Services != null)
            {
                foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
                {
	                s.ServiceCategoryAbbr = "";

	                String firstLine = "";
					if (!String.IsNullOrEmpty(s.Notice))
					{
						if (s.Notice.IndexOf(Environment.NewLine) >= 0)
							firstLine = s.Notice.Substring(0, s.Notice.IndexOf(Environment.NewLine));
						else
							firstLine = s.Notice;
					}
					s.Notice = firstLine;

	                if (s.StartDate.Second > 0)
	                {
		                s.StartDateString = "";
		                s.TimeRangeString = "";
	                }
	                else
	                {
						s.StartDateString = String.Format("{0:HH:mm}", s.StartDate);
		                s.TimeRangeString = String.Format("{0:HH:mm}", s.EndDate);
	                }
				}

            }

            this.bindingSource1.DataSource = pRO;
        }
    }
}
