|
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Windows.Controls;
|
|
|
using Comal.Classes;
|
|
|
+using InABox.Clients;
|
|
|
using InABox.Core;
|
|
|
using InABox.DynamicGrid;
|
|
|
|
|
@@ -28,15 +29,22 @@ public partial class JobBillOfMaterialsPanel : UserControl, IBasePanel, IJobCont
|
|
|
|
|
|
public DataModel DataModel(Selection selection)
|
|
|
{
|
|
|
+ BaseDataModel<JobBillOfMaterials> model = null;
|
|
|
if (selection == Selection.Selected)
|
|
|
{
|
|
|
var bomid = BillsOfMaterials.SelectedRows.Any()
|
|
|
? BillsOfMaterials.SelectedRows.First().Get<JobBillOfMaterials, Guid>(x => x.ID)
|
|
|
: CoreUtils.FullGuid;
|
|
|
- return new BaseDataModel<JobBillOfMaterials>(new Filter<JobBillOfMaterials>(x => x.ID).IsEqualTo(bomid));
|
|
|
+ model = new BaseDataModel<JobBillOfMaterials>(new Filter<JobBillOfMaterials>(x => x.ID).IsEqualTo(bomid));
|
|
|
}
|
|
|
-
|
|
|
- return new BaseDataModel<JobBillOfMaterials>(new Filter<JobBillOfMaterials>(x => x.Job.ID).IsEqualTo(ParentID));
|
|
|
+ else
|
|
|
+ model = new BaseDataModel<JobBillOfMaterials>(new Filter<JobBillOfMaterials>(x => x.Job.ID).IsEqualTo(ParentID));
|
|
|
+
|
|
|
+ var jobfilter = ((ParentID == Guid.Empty) || (ParentID == CoreUtils.FullGuid))
|
|
|
+ ? new Filter<Job>().None()
|
|
|
+ : new Filter<Job>(x => x.ID).IsEqualTo(ParentID);
|
|
|
+ model.AddTable<Job>(jobfilter, null, true, "Job", true);
|
|
|
+ return model;
|
|
|
}
|
|
|
|
|
|
public void CreateToolbarButtons(IPanelHost host)
|
|
@@ -60,8 +68,13 @@ public partial class JobBillOfMaterialsPanel : UserControl, IBasePanel, IJobCont
|
|
|
|
|
|
public Dictionary<string, object[]> Selected()
|
|
|
{
|
|
|
+
|
|
|
+ var jobfilter = ((ParentID == Guid.Empty) || (ParentID == CoreUtils.FullGuid))
|
|
|
+ ? new Filter<Job>().None()
|
|
|
+ : new Filter<Job>(x => x.ID).IsEqualTo(ParentID);
|
|
|
return new Dictionary<string, object[]>
|
|
|
{
|
|
|
+ { typeof(Job).EntityName(), new Client<Job>().Query(jobfilter).Rows.ToArray() },
|
|
|
{ typeof(JobBillOfMaterials).EntityName(), BillsOfMaterials.SelectedRows },
|
|
|
{ typeof(JobBillOfMaterialsItem).EntityName(), BillOfMaterialsItems.SelectedRows }
|
|
|
};
|