63 lines
2.0 KiB
C#
63 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using BeWo.Report;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace ReportingService.Plugins
|
|
{
|
|
public class TimeSheetReportService : AbstractIDSpecificDefaultClass<TimeSheetReportService>
|
|
{
|
|
|
|
public virtual string SendTimeSheetMail(TimeSheetStatusItemDC item, bool saveMailToDatabase)
|
|
{
|
|
try
|
|
{
|
|
var tss = PluginLoader.FindClass<TimeSheetService>();
|
|
|
|
var reportCreator = CreateReportCreator();
|
|
|
|
if (item.Customer != null && item.Customer.Count > 0 && item.Monat.HasValue && item.Employee != null)
|
|
{
|
|
//foreach (var cc in item.Customer)
|
|
//{
|
|
var report = reportCreator.CreateServiceOverviewSingleCustomerReport(0, item.Monat.Value.Month,
|
|
item.Monat.Value.Year, 0, item.Employee.EmployeeOid, null, 1,
|
|
DateTime.DaysInMonth(item.Monat.Value.Year, item.Monat.Value.Month));
|
|
|
|
var additionalReports = CreateAdditionalReports(item.Customer, reportCreator, item);
|
|
|
|
var result = tss.SendTimeSheetMail(item, saveMailToDatabase, report, additionalReports);
|
|
|
|
if (!String.IsNullOrWhiteSpace(result))
|
|
{
|
|
return result;
|
|
}
|
|
//}
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
return e.Message;
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
public virtual Dictionary<string, XtraReport> CreateAdditionalReports(IList<CompactCustomerDC> cc, DefaultReportCreator reportCreator, TimeSheetStatusItemDC item)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
private static DefaultReportCreator CreateReportCreator()
|
|
{
|
|
var reportCreator = PluginLoader.FindClass<DefaultReportCreator>();
|
|
|
|
return reportCreator;
|
|
}
|
|
}
|
|
} |