123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using System;
- using System.Collections;
- using System.Drawing;
- using InABox.Core;
- using Xamarin.Essentials;
- namespace comal.timesheets
- {
- public interface IAssignmentLookupDataModel
- {
- IEnumerable Items { get; }
- }
-
- public abstract class AssignmentLookupDataModel<TEntity, TShell> : ListDataModel<TEntity, TShell>, IAssignmentLookupDataModel
- where TEntity : Entity, IRemotable, IPersistent, new()
- where TShell : AssignmentLookupItem, new()
- {
- IEnumerable IAssignmentLookupDataModel.Items => Items;
- public void Clear()
- {
- foreach (var item in Items)
- item.Selected = false;
- }
- public void Select(Guid id)
- {
- foreach (var item in Items)
- item.Selected = item.Id == id;
- }
-
- }
-
- public abstract class AssignmentLookupItem : CoreDataModelItem
- {
- public abstract Guid Id { get; }
- public abstract String Number { get; }
- public abstract String Name { get; }
- public abstract String Description { get; }
-
- public bool Selected { get; set; }
- public Color Colour => Selected ? Color.LightPink : Color.White;
- }
- }
|