|
@@ -36,7 +36,7 @@ namespace PRSDesktop
|
|
|
|
|
|
private JobDocumentSetSettings _settings = new();
|
|
|
|
|
|
- public Job Master { get; set; }
|
|
|
+ public Job? Master { get; set; }
|
|
|
|
|
|
public JobDocumentSetPanel()
|
|
|
{
|
|
@@ -54,7 +54,7 @@ namespace PRSDesktop
|
|
|
|
|
|
public event DataModelUpdateEvent? OnUpdateDataModel;
|
|
|
|
|
|
- private bool GetAreas(CoreTable areas, ComboBox target) //, RowDefinition row)
|
|
|
+ private static bool GetAreas(CoreTable areas, ComboBox target) //, RowDefinition row)
|
|
|
{
|
|
|
using (new EventSuppressor(Suppress.This))
|
|
|
{
|
|
@@ -76,13 +76,13 @@ namespace PRSDesktop
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private bool GetTags(CoreTable tags, JobDocumentSetTagType type, ComboBox target) //, RowDefinition row)
|
|
|
+ private static bool GetTags(CoreTable tags, JobDocumentSetTagType type, ComboBox target) //, RowDefinition row)
|
|
|
{
|
|
|
using (new EventSuppressor(Suppress.This))
|
|
|
{
|
|
|
- Dictionary<Guid, String> result = new Dictionary<Guid, String>()
|
|
|
+ var result = new Dictionary<Guid, String>()
|
|
|
{
|
|
|
- { Guid.Empty, "" } //$"All {type.ToString().Pluralize()}" }
|
|
|
+ { Guid.Empty, "" }
|
|
|
};
|
|
|
foreach (var tag in tags.Rows.Where(x => x.Get<JobDocumentSetTag, JobDocumentSetTagType>(x => x.Type).Equals(type)))
|
|
|
result[tag.Get<JobDocumentSetTag, Guid>(c => c.ID)] = tag.Get<JobDocumentSetTag, String>(c => c.Description);
|
|
@@ -123,20 +123,27 @@ namespace PRSDesktop
|
|
|
|
|
|
private void LoadDocumentTags()
|
|
|
{
|
|
|
- MultiQuery query = new MultiQuery();
|
|
|
- query.Add<JobDocumentSetTag>(
|
|
|
- new Filter<JobDocumentSetTag>(x => x.Job.ID).IsEqualTo(Master?.ID ?? Guid.Empty),
|
|
|
- null,
|
|
|
- new SortOrder<JobDocumentSetTag>(x => x.Description)
|
|
|
- );
|
|
|
- query.Add<JobITP>(
|
|
|
- new Filter<JobITP>(x => x.Job.ID).IsEqualTo(Master?.ID ?? Guid.Empty),
|
|
|
- new Columns<JobITP>(x => x.ID).Add(x => x.Code).Add(x => x.Description),
|
|
|
- new SortOrder<JobITP>(x => x.Code)
|
|
|
- );
|
|
|
- query.Query();
|
|
|
-
|
|
|
- var tags = query.Get<JobDocumentSetTag>();
|
|
|
+ // Global tags
|
|
|
+ var tagFilter = new Filter<JobDocumentSetTag>(x => x.Job.ID).IsEqualTo(Guid.Empty);
|
|
|
+ if(Master is not null && Master.ID != Guid.Empty)
|
|
|
+ {
|
|
|
+ tagFilter = tagFilter.Or(x => x.Job.ID).IsEqualTo(Master.ID);
|
|
|
+ }
|
|
|
+
|
|
|
+ var results = Client.QueryMultiple(
|
|
|
+ new KeyedQueryDef<JobDocumentSetTag>(
|
|
|
+ tagFilter,
|
|
|
+ new Columns<JobDocumentSetTag>(x => x.ID)
|
|
|
+ .Add(x => x.Type)
|
|
|
+ .Add(x => x.Description),
|
|
|
+ new SortOrder<JobDocumentSetTag>(x => x.Description)
|
|
|
+ ),
|
|
|
+ new KeyedQueryDef<JobITP>(
|
|
|
+ new Filter<JobITP>(x => x.Job.ID).IsEqualTo(Master?.ID ?? Guid.Empty),
|
|
|
+ new Columns<JobITP>(x => x.ID).Add(x => x.Code).Add(x => x.Description),
|
|
|
+ new SortOrder<JobITP>(x => x.Code)));
|
|
|
+
|
|
|
+ var tags = results.Get<JobDocumentSetTag>();
|
|
|
/* Documents.DisciplineVisible = */
|
|
|
GetTags(tags, JobDocumentSetTagType.Discipline, Discipline); //, DisciplineRow);
|
|
|
/* Documents.TypeVisible = */
|
|
@@ -144,7 +151,7 @@ namespace PRSDesktop
|
|
|
/* Documents.CategoryVisible = */
|
|
|
GetTags(tags, JobDocumentSetTagType.Category, Category); //, CategoryRow);
|
|
|
/* Documents.AreaVisible = */
|
|
|
- GetAreas(query.Get<JobITP>(), Area); //, AreaRow);
|
|
|
+ GetAreas(results.Get<JobITP>(), Area); //, AreaRow);
|
|
|
}
|
|
|
|
|
|
public bool IsReady { get; set; }
|
|
@@ -271,7 +278,7 @@ namespace PRSDesktop
|
|
|
};
|
|
|
editor.Refresh(true, true);
|
|
|
var window = new DynamicContentDialog(editor, false);
|
|
|
- window.Title = $"{tagtype.ToString()} Document Tags";
|
|
|
+ window.Title = $"{tagtype} Document Tags";
|
|
|
window.ShowDialog();
|
|
|
LoadDocumentTags();
|
|
|
}
|