| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- using System;
- using System.Collections.ObjectModel;
- using System.Windows.Media;
- using Comal.Classes;
- using InABox.Core;
- using InABox.WPF;
- namespace PRSDesktop
- {
- public class AssignmentModel : Model<AssignmentModel,Assignment>
- {
-
- public Guid EmployeeID { get; }
- public int Number { get; set; }
- public String? Subject { get; set; }
- public String? Notes { get; set; }
- public DateTime Completed { get; set; }
- public DateTime Date { get; }
- public TimeSpan BookedStart { get; set; }
- public TimeSpan BookedFinish { get; set; }
- public TimeSpan BookedDuration { get; }
- public TimeSpan ActualStart { get; set; }
- public TimeSpan ActualDuration { get; set; }
- public TimeSpan ActualFinish { get; set; }
-
- public static TimeSpan EffectiveTime(TimeSpan actual, TimeSpan booked) => actual.Ticks != 0L ? actual : booked;
- public TimeSpan EffectiveStart()
- {
- return EffectiveTime(ActualStart, BookedStart);
- }
- public TimeSpan EffectiveFinish()
- {
- // If we have an actual finish, always use that
- // otherwise use EffectiveStart() + booked.duration
- return EffectiveTime(
- ActualFinish,
- EffectiveTime(ActualStart, BookedStart)
- .Add(BookedDuration)
- );
- }
-
- public Guid JobID { get; }
- public string? JobNumber { get; }
- public string? JobName { get; }
-
- public Guid ActivityID { get; set; }
- public string? ActivityCode { get; }
- public string? ActivityDescription { get; }
- public string? Color { get; }
-
- public Guid ItpID { get; set; }
- public string? ItpCode { get; set; }
- public string? ItpDescription { get; set; }
- public Guid DeliveryID { get; set; }
- public string? DeliveryNotes { get; set; }
- public Guid TaskID { get; set; }
- public int TaskNumber { get; set; }
- public Guid MeetingID { get; set; }
- public int MeetingNumber { get; set; }
- public AssignmentModel(CoreRow row) : base(row)
- {
- EmployeeID = Get(x=>x.EmployeeLink.ID);
- Number = Get(x => x.Number);
- Subject = Get(x => x.Title);
- Notes = Get(x => x.Description);
- Completed = Get(x => x.Completed);
- Date = Get(x=>x.Date);
- BookedDuration = Get(x => x.Booked.Duration);
- BookedStart = Get(x => x.Booked.Start);
- BookedFinish = Get(x => x.Booked.Finish);
- ActualStart = Get(x => x.Actual.Start);
- ActualDuration = Get(x => x.Actual.Duration);
- ActualFinish = Get(x => x.Actual.Finish);
-
- JobID = Get(x => x.JobLink.ID);
- JobNumber = Get(x => x.JobLink.JobNumber);
- JobName = Get(x => x.JobLink.Name);
-
- ActivityID = Get(x => x.ActivityLink.ID);
- ActivityCode = Get(x => x.ActivityLink.Code);
- ActivityDescription = Get(x => x.ActivityLink.Description);
- Color = Get(x => x.ActivityLink.Color);
-
- ItpID = Get(x => x.ITP.ID);
- ItpCode = Get(x => x.ITP.Code);
- ItpDescription = Get(x => x.ITP.Description);
- DeliveryID = Get(x => x.Delivery.ID);
- DeliveryNotes = Get(x => x.Delivery.Notes);
-
- TaskID = Get(x => x.Task.ID);
- TaskNumber = Get(x => x.Task.Number);
- MeetingID = Get(x => x.Meeting.Link.ID);
- MeetingNumber = Get(x => x.Meeting.Link.Number);
- }
-
- public override Columns<Assignment> GetColumns()
- {
- return new Columns<Assignment>(x => x.ID)
- .Add(x => x.EmployeeLink.ID)
- .Add(x => x.Number)
- .Add(x => x.Title)
- .Add(x => x.Description)
- .Add(x => x.Completed)
- .Add(x => x.Date)
- .Add(x => x.Booked.Start)
- .Add(x => x.Booked.Duration)
- .Add(x => x.Booked.Finish)
- .Add(x => x.Actual.Start)
- .Add(x => x.Actual.Duration)
- .Add(x => x.Actual.Finish)
- .Add(x => x.JobLink.ID)
- .Add(x => x.JobLink.JobNumber)
- .Add(x => x.JobLink.Name)
- .Add(x => x.ActivityLink.ID)
- .Add(x => x.ActivityLink.Code)
- .Add(x => x.ActivityLink.Description)
- .Add(x => x.ActivityLink.Color)
- .Add(x => x.ITP.ID)
- .Add(x => x.ITP.Code)
- .Add(x => x.ITP.Description)
- .Add(x => x.Delivery.ID)
- .Add(x => x.Delivery.Notes)
- .Add(x => x.Task.ID)
- .Add(x => x.Task.Number)
- .Add(x => x.Meeting.Link.ID)
- .Add(x => x.Meeting.Link.Number);
- }
- }
- }
|