53 lines
2.2 KiB
C#
53 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.Service.Plugins
|
|
{
|
|
public class ResourceService : AbstractIDSpecificDefaultClass<ResourceService>
|
|
{
|
|
|
|
public virtual string ValidateSchedulerAppointment(DateTime start, DateTime end, IEnumerable<long> employees, IEnumerable<long> customers, List<long> resources, long originator, long? appointmentOid, Guid? recurrenceId, int occurrenceIndex = 0, bool shouldSkipResourceAvailability = false)
|
|
{
|
|
return DAOFactory.SearchDAO.ValidateSchedulerAppointment(start, end, employees, customers, resources, originator, appointmentOid, recurrenceId, occurrenceIndex);
|
|
}
|
|
|
|
public virtual List<ResourceDC> CheckResourceAvailability(DateTime start, DateTime end, List<long> resourceOids, long? selectedAppointmentOid)
|
|
{
|
|
var list = new List<ResourceDC>();
|
|
var resources = DAOFactory.SearchDAO.CheckAvailabilityOfResources(resourceOids, start, end, selectedAppointmentOid);
|
|
|
|
foreach(var resource in resources)
|
|
{
|
|
list.AddIfNotIn(MapperFactory.ResourceDC_Resource.MapToNewDC(resource));
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
public virtual Dictionary<ResourceDC, List<CompactEmployeeDC>> CheckResourceAvailabilityWithBookingEmployees(DateTime start, DateTime end, List<long> resourceOids, long? selectedAppointmentOid)
|
|
{
|
|
var result = new Dictionary<ResourceDC, List<CompactEmployeeDC>>();
|
|
|
|
var dictionary = DAOFactory.SearchDAO.CheckAvailabilityOfResources(resourceOids, start, end, selectedAppointmentOid);
|
|
|
|
dictionary.DoForEach(kvp =>
|
|
{
|
|
//var resourceDC = MapperFactory.ResourceDC_Resource.MapToNewDC(kvp.Key);
|
|
//var compactEmployeeDCs = MapperFactory.CompactEmployeeDC_Employee.MapToNewDCs(kvp.Value);
|
|
|
|
//result.Add(resourceDC, compactEmployeeDCs);
|
|
});
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|