using System; using Comal.Classes; namespace Comal.Stores { internal class TimesheetStore : BaseStore { protected override void BeforeSave(TimeSheet entity) { if (!entity.EmployeeLink.IsValid() && entity.EmployeeID != Guid.Empty) entity.EmployeeLink.ID = entity.EmployeeID; else if (entity.EmployeeLink.IsValid() && entity.EmployeeID == Guid.Empty) entity.EmployeeID = entity.EmployeeLink.ID; base.BeforeSave(entity); //UpdateAggregate(entity, entity.JobLink, Sum(t => t.ApprovedDuration, j => j.LabourHours)); //UpdateAggregate(entity, entity.InvoiceLink, Sum(t => t.ApprovedDuration, i => i.LabourHours)); } protected override void BeforeDelete(TimeSheet entity) { base.BeforeDelete(entity); //entity.JobLink.ID = Guid.Empty; //UpdateAggregate(entity, entity.JobLink, Sum(t => t.ApprovedDuration, j => j.LabourHours)); //entity.InvoiceLink.ID = Guid.Empty; //UpdateAggregate(entity, entity.InvoiceLink, Sum(t => t.ApprovedDuration, i => i.LabourHours)); } } }