12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- using System.Collections.ObjectModel;
- using Comal.Classes;
- using InABox.Core;
- using Xamarin.Forms;
- namespace comal.timesheets
- {
- public class AssignmentListDataModelItem : CoreDataModelItem
- {
-
- public Guid Id => Row.Get<Assignment, Guid>(c => c.ID);
- public int Number => Row.Get<Assignment, int>(c => c.Number);
-
- public Guid EmployeeId => Row.Get<Assignment, Guid>(c => c.EmployeeLink.ID);
-
- public Guid JobID => Row.Get<Assignment, Guid>(c => c.JobLink.ID);
- public string JobNumber => Row.Get<Assignment, String>(c => c.JobLink.JobNumber);
- public String Subject => string.Format("{0}{1} {2}",
- Row.Get<Assignment, int>(c => c.Number),
- Row.Get<Assignment,Guid>(c=>c.JobLink.ID) != Guid.Empty
- ? $"({Row.Get<Assignment, String>(c => c.JobLink.JobNumber)})"
- : "",
- Row.Get<Assignment, String>(c => c.Title));
-
- public string Notes => Row.Get<Assignment, String>(c => c.Description);
-
- public DateTime StartTime =>
- Row.Get<Assignment, DateTime>(c => c.Date).Add(Row.Get<Assignment, TimeSpan>(c => c.Start));
- public DateTime EndTime =>
- Row.Get<Assignment, DateTime>(c => c.Date).Add(Row.Get<Assignment, TimeSpan>(c => c.Finish));
- public bool Completed => !Row.Get<Assignment, DateTime>(c => c.Completed).IsEmpty();
- public Color Color
- {
- get
- {
- var color = Row.Get<Assignment, String>(c => c.ActivityLink.Color);
- return !String.IsNullOrWhiteSpace(color)
- ? Color.FromHex(color)
- : Color.Silver;
- }
- set { Row.Set<Assignment, String>(c => c.ActivityLink.Color, value.ToHex()); }
- }
- public Color TextColor => Color.Black;
- public ObservableCollection<object> ResourceIds => new ObservableCollection<object>() { Row.Get<Assignment, Guid>(c => c.EmployeeLink.ID) };
- }
- }
|