12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System;
- using System.Linq;
- using Comal.Classes;
- using InABox.Core;
- using InABox.Mobile;
- namespace PRS.Mobile
- {
- public class JobDocumentFolderModel : CoreRepository<JobDocumentFolderModel, JobDocumentFolderShell, JobDocumentSetFolder>
- {
- public JobDocumentFolderModel(IModelHost host, Func<Filter<JobDocumentSetFolder>> filter): base(host, filter)
- {
- }
- protected override void Initialize()
- {
- base.Initialize();
- DocumentFolders = new CoreTreeNodes<Guid>(Guid.Empty);
- }
- public CoreTreeNodes<Guid> DocumentFolders { get; private set; }
- protected override void AfterLoad(MultiQuery query)
- {
- base.AfterLoad(query);
-
- var table = query.Get<JobDocumentSetFolder>();
- foreach (var row in table.Rows.Where(r =>
- r.Get<JobDocumentSetFolder, Guid>(c => c.Parent.ID) == Guid.Empty))
- row.Set<JobDocumentSetFolder, Guid>(c => c.Parent.ID,CoreUtils.FullGuid);
- var root = table.NewRow();
- root.Set<JobDocumentSetFolder, Guid>(c => c.ID,CoreUtils.FullGuid);
- root.Set<JobDocumentSetFolder, Guid>(c => c.Parent.ID,Guid.Empty);
- root.Set<JobDocumentSetFolder, String>(c => c.Name,"All Folders");
- table.Rows.Add(root);
- DocumentFolders.Load<JobDocumentSetFolder>(
- table,
- x=>x.ID,
- x=>x.Parent.ID
- //, x=>x.Name
- );
-
- //var roots = DocumentFolders.GetChildren(Guid.Empty);
- //foreach (var root in roots)
- // root.Parent = CoreUtils.FullGuid;
- //DocumentFolders.Add(CoreUtils.FullGuid, Guid.Empty).Description = "All Folders";
- }
- }
- }
|