12345678910111213141516171819202122232425262728293031323334 |
- using System;
- using Comal.Classes;
- namespace Comal.Stores
- {
- internal class TimesheetStore : BaseStore<TimeSheet>
- {
- 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<Job>(entity, entity.JobLink, Sum<Job>(t => t.ApprovedDuration, j => j.LabourHours));
- //UpdateAggregate<Invoice>(entity, entity.InvoiceLink, Sum<Invoice>(t => t.ApprovedDuration, i => i.LabourHours));
- }
- protected override void BeforeDelete(TimeSheet entity)
- {
- base.BeforeDelete(entity);
- //entity.JobLink.ID = Guid.Empty;
- //UpdateAggregate<Job>(entity, entity.JobLink, Sum<Job>(t => t.ApprovedDuration, j => j.LabourHours));
- //entity.InvoiceLink.ID = Guid.Empty;
- //UpdateAggregate<Invoice>(entity, entity.InvoiceLink, Sum<Invoice>(t => t.ApprovedDuration, i => i.LabourHours));
- }
- }
- }
|