| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using InABox.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Comal.Classes
- {
- [Caption("Allocation")]
- public class PurchaseOrderItemAllocation : Entity, IRemotable, IPersistent, ILicense<ProjectManagementLicense>
- , IOneToMany<JobRequisitionItem>, IOneToMany<Job>, IOneToMany<PurchaseOrderItem>
- {
- [EntityRelationship(DeleteAction.Cascade)]
- public PurchaseOrderItemLink Item { get; set; }
-
- /// <summary>
- /// This may not be blank.
- /// </summary>
- [EntityRelationship(DeleteAction.Cascade)]
- [EditorSequence(1)]
- public JobLink Job { get; set; }
-
- private class JobRequisitionItemLookup : LookupDefinitionGenerator<JobRequisitionItem, PurchaseOrderItemAllocation>
- {
- public override Columns<PurchaseOrderItemAllocation> DefineFilterColumns()
- {
- return base.DefineFilterColumns().Add(x => x.Job.ID);
- }
- public override Filter<JobRequisitionItem>? DefineFilter(PurchaseOrderItemAllocation[] items)
- {
- return new Filter<JobRequisitionItem>(x => x.Job.ID).InList(items.ToArray(x => x.Job.ID));
- }
- }
- /// <summary>
- /// This may be an empty link. The interface is as such: if there is no JRI, then we are creating a reserve and allocation just against the job. If there is a JRI,
- /// then received stock is reserved and allocated for the JRI.
- /// </summary>
- [EntityRelationship(DeleteAction.Cascade)]
- [LookupDefinition(typeof(JobRequisitionItemLookup))]
- [EditorSequence(2)]
- public JobRequisitionItemLink JobRequisitionItem { get; set; }
-
- [EditorSequence(3)]
- public double Quantity { get; set; }
- [NullEditor]
- public bool Nominated { get; set; }
- protected override void DoPropertyChanged(string name, object? before, object? after)
- {
- base.DoPropertyChanged(name, before, after);
- if(name == $"{nameof(Job)}.{nameof(Job.ID)}")
- {
- JobRequisitionItem.ID = Guid.Empty;
- JobRequisitionItem.Clear();
- }
- }
- }
-
-
- public class PurchaseOrderItemAllocationJobLink : EntityLink<PurchaseOrderItemAllocation>
- {
- [NullEditor]
- public override Guid ID { get; set; }
-
- public LightJobLink Job { get; set; }
-
- public LightPurchaseOrderItemLink Item { get; set; }
-
- }
- }
|