87 lines
3.0 KiB
C#
87 lines
3.0 KiB
C#
using BeWo.Data;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared.DataContracts;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BeWo.Service.PivotTabelle
|
|
{
|
|
internal class FlexibleReportManager
|
|
{
|
|
public static FlexibleReportResultDC GetFlexibleReportResult(FlexibleReportFilterDC filter)
|
|
{
|
|
var s = PluginLoader.FindClass<FlexibleReportService>();
|
|
|
|
return s.GetAllFlexibleReportEntrys(filter);
|
|
}
|
|
|
|
public static IList<FlexibleReportLayoutDC> GetFlexibleReportLayouts()
|
|
{
|
|
var result = new List<FlexibleReportLayoutDC>();
|
|
|
|
var alle = DAOFactory.GenericDAO.GetAllActive<FlexibleReportLayout>();
|
|
foreach (var item in alle)
|
|
{
|
|
if (item.CreatorOid == LoggedInUserOperationContextExt.Current.User.Oid.Value || item.VisibleForAllEmployee)
|
|
result.Add(MapperFactory.FlexibleReportLayoutDC_FlexibleReportLayout.MapToNewDC(item));
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public static void InsertNewFlexibleReportLayout(FlexibleReportLayoutDC flexibleReportLayoutDC)
|
|
{
|
|
var flexibleReportLayout = MapperFactory.FlexibleReportLayoutDC_FlexibleReportLayout.MapToNewEntity(flexibleReportLayoutDC);
|
|
flexibleReportLayout.CreatorOid = LoggedInUserOperationContextExt.Current.User.Oid.Value;
|
|
DAOFactory.GenericDAO.Insert(flexibleReportLayout);
|
|
}
|
|
|
|
public static void UpdateFlexibleReportLayouts(IList<FlexibleReportLayoutDC> flexibleReportLayouts)
|
|
{
|
|
//Enity
|
|
var flexOriList = new List<FlexibleReportLayout>();
|
|
var alle = DAOFactory.GenericDAO.GetAllActive<FlexibleReportLayout>();
|
|
foreach (var item in alle)
|
|
{
|
|
if (item.CreatorOid == LoggedInUserOperationContextExt.Current.User.Oid.Value || item.VisibleForAllEmployee)
|
|
flexOriList.Add(item);
|
|
}
|
|
//DC
|
|
var flexNewList = flexibleReportLayouts;
|
|
|
|
var toUpdate = new List<FlexibleReportLayout>();
|
|
var toDelete = new List<FlexibleReportLayout>();
|
|
|
|
foreach (var flexOri in flexOriList)
|
|
{
|
|
bool gefunden = false;
|
|
|
|
foreach (var flexNew in flexNewList)
|
|
{
|
|
if (flexOri.Oid == flexNew.FlexibleReportOid)
|
|
{
|
|
gefunden = true;
|
|
|
|
if (flexOri.LayoutName != flexNew.LayoutName)
|
|
{
|
|
flexOri.LayoutName = flexNew.LayoutName;
|
|
DAOFactory.GenericDAO.Update(flexOri);
|
|
}
|
|
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!gefunden)
|
|
DAOFactory.GenericDAO.Deactivate(flexOri);
|
|
}
|
|
}
|
|
}
|
|
}
|