| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Comal.Classes;
- using InABox.Core;
- using InABox.Mobile;
- using System.Diagnostics.CodeAnalysis;
- namespace PRS.Mobile
- {
- public class DigitalFormModel : CoreRepository<DigitalFormModel,DigitalFormShell,EmployeeDigitalForm>
- {
- public DigitalFormModel(IModelHost host, Func<Filter<EmployeeDigitalForm>>? filter = null, Func<string>? cachefilename = null) : base(host, filter, cachefilename)
- {
- }
- protected override void Initialize()
- {
- base.Initialize();
- Layouts = new CoreObservableCollection<DigitalFormLayoutShell>();
- //_documents = new CoreObservableCollection<IDocumentShell>();
- }
- public CoreObservableCollection<DigitalFormLayoutShell> Layouts { get; private set; }
-
- //private CoreObservableCollection<IDocumentShell> _documents;
-
- //public IEnumerable<IDocumentShell> Documents => _documents;
- // public override Columns<(.+)> Columns => DigitalFormShell.Columns.Columns;
- protected override void BeforeLoad(MultiQuery query)
- {
- base.BeforeLoad(query);
- query.Add(
- new Filter<DigitalFormLayout>(x => x.Form.ID).InQuery(EffectiveFilter(), x => x.Form.ID)
- .And(x => x.Type).IsEqualTo(DFLayoutType.Mobile)
- .And(x => x.Active).IsEqualTo(true),
- GetColumns<DigitalFormLayoutShell,DigitalFormLayout>()
- );
- //query.Add(
- // new Filter<DigitalFormDocument>(x => x.EntityLink.ID).InQuery(EffectiveFilter(), x => x.Form.ID),
- // GetColumns<DigitalFormDocumentShell,DigitalFormDocument>()
- //);
- }
- protected override void AfterLoad(MultiQuery query)
- {
- base.AfterLoad(query);
-
- Layouts.ReplaceRange(
- query.Get<DigitalFormLayout>()
- .Rows
- .Select(x => new DigitalFormLayoutShell() { Row = x, Parent = this })
- .ToArray()
- );
-
- //_documents.ReplaceRange(
- // query.Get<DigitalFormDocument>()
- // .Rows
- // .Select(x => new DigitalFormDocumentShell() { Row = x, Parent = this })
- // .ToArray()
- //);
-
- }
- }
- }
|