using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BeWo.Service.DCEntityMapper;
using BS.Shared;
using DevExpress.XtraReports.UI;

namespace BeWo.Club74
{
    public class Club74ReportCreator : DefaultReportCreator
    {
        public override XtraReport CreateCustomerInvoiceReport(long invoiceOid)
        {
            var invoice = MapperFactory.InvoiceBaseDC_InvoiceBase.MapToNewDC(DAOFactory.GenericDAO.LoadByID<InvoiceBase>(invoiceOid));

            var ro = InvoiceCustomerRO.Create(invoice);

            if (invoice.Type == InvoiceType.General)
            {
                var report = new BeWo.Club74.GeneralReport();

                report.SetReportDataSource(ro);

                return report as XtraReport;
            }
            var report2 = new BeWo.Club74.InvoiceCustomerReport();

            report2.SetReportDataSource(ro);

            return report2 as XtraReport;
        }
    }
}
