88 lines
3.4 KiB
C#
88 lines
3.4 KiB
C#
using System.Collections.Generic;
|
|
|
|
using BeWo.Data.Entities;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.DataContracts.Compact;
|
|
|
|
namespace BeWo.Service.DCEntityMapper
|
|
{
|
|
public class NewSchedulerAppointmentDC_NewSchedulerAppointment : AbstractIDCEntityMapper<NewSchedulerAppointment, NewSchedulerAppointmentDC>
|
|
{
|
|
public override NewSchedulerAppointmentDC MergeWithDC(NewSchedulerAppointment pEntity, NewSchedulerAppointmentDC pDataContract)
|
|
{
|
|
pDataContract.NewSchedulerAppointmentOid = pEntity.Oid;
|
|
pDataContract.NewSchedulerAppointmentVersion = pEntity.Version;
|
|
|
|
pDataContract.AllDay = pEntity.AllDay;
|
|
pDataContract.EndDate = pEntity.EndDate;
|
|
pDataContract.StartDate = pEntity.StartDate;
|
|
pDataContract.Status = pEntity.Status;
|
|
pDataContract.Subject = pEntity.Subject;
|
|
pDataContract.Type = pEntity.Type;
|
|
pDataContract.Location = pEntity.Location;
|
|
pDataContract.Description = pEntity.Notice;
|
|
pDataContract.RecurrenceInfo = pEntity.RecurrenceInfo;
|
|
pDataContract.ReminderInfo = pEntity.ReminderInfo;
|
|
|
|
pDataContract.IsPrivate = pEntity.IsPrivate;
|
|
pDataContract.CustomerList = MapperFactory.CompactCustomerDC_Customer.MapToNewDCs(pEntity.CustomerList);
|
|
pDataContract.ResourceList = MapperFactory.ResourceDC_Resource.MapToNewDCs(pEntity.ResourceList);
|
|
|
|
pDataContract.EmployeeList = new Dictionary<CompactEmployeeDC, ParticipationAnswer>();
|
|
foreach (var kvpair in pEntity.EmployeeList)
|
|
{
|
|
var e = kvpair.Key;
|
|
pDataContract.EmployeeList.Add(MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(e), kvpair.Value);
|
|
}
|
|
|
|
if (pEntity.Originator != null)
|
|
pDataContract.Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(pEntity.Originator);
|
|
|
|
return pDataContract;
|
|
}
|
|
|
|
public override NewSchedulerAppointment MergeWithEntity(NewSchedulerAppointmentDC pDataContract, NewSchedulerAppointment pEntity)
|
|
{
|
|
pEntity.Oid = pDataContract.NewSchedulerAppointmentOid;
|
|
pEntity.Version = pDataContract.NewSchedulerAppointmentVersion;
|
|
|
|
pEntity.AllDay = pDataContract.AllDay;
|
|
pEntity.EndDate = pDataContract.EndDate;
|
|
pEntity.StartDate = pDataContract.StartDate;
|
|
pEntity.Status = pDataContract.Status;
|
|
pEntity.Subject = pDataContract.Subject;
|
|
pEntity.Type = pDataContract.Type;
|
|
pEntity.Location = pDataContract.Location;
|
|
pEntity.Notice = pDataContract.Description;
|
|
pEntity.RecurrenceInfo = pDataContract.RecurrenceInfo;
|
|
pEntity.ReminderInfo = pDataContract.ReminderInfo;
|
|
|
|
if (pDataContract.Originator != null)
|
|
pEntity.Originator = MapperFactory.CompactEmployeeDC_Employee.MapToNewEntity(pDataContract.Originator);
|
|
|
|
pEntity.IsPrivate = pDataContract.IsPrivate;
|
|
pEntity.CustomerList = MapperFactory.CompactCustomerDC_Customer.MapToNewEntities(pDataContract.CustomerList);
|
|
pEntity.ResourceList = MapperFactory.ResourceDC_Resource.MapToNewEntities(pDataContract.ResourceList);
|
|
|
|
pEntity.EmployeeList = new Dictionary<Employee, ParticipationAnswer>();
|
|
foreach (var kv in pDataContract.EmployeeList)
|
|
{
|
|
var e = kv.Key;
|
|
pEntity.EmployeeList.Add(MapperFactory.CompactEmployeeDC_Employee.MapToNewEntity(e), kv.Value);
|
|
}
|
|
|
|
return pEntity;
|
|
}
|
|
|
|
protected override bool AreDCAndEntityEqual(NewSchedulerAppointmentDC pDC, NewSchedulerAppointment pEntity)
|
|
{
|
|
if (pDC.NewSchedulerAppointmentOid == null)
|
|
return false;
|
|
|
|
return pDC.NewSchedulerAppointmentOid == pEntity.Oid;
|
|
}
|
|
}
|
|
}
|