1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System;
- using System.Linq;
- using Comal.Classes;
- using InABox.Core;
- namespace Comal.Stores
- {
- internal class RequisitionItemStore : BaseStore<RequisitionItem>
- {
- private void UpdateTrackingKanban(RequisitionItem entity)
- {
- var requi = new Requisition
- { ID = entity.RequisitionLink.ID, Filled = entity.RequisitionLink.Filled, Archived = entity.RequisitionLink.Archived };
- UpdateTrackingKanban<RequisitionKanban, Requisition, RequisitionLink>(requi, r =>
- {
- if (!r.Archived.Equals(DateTime.MinValue))
- return KanbanCategory.Complete;
- if (!r.Filled.Equals(DateTime.MinValue))
- return KanbanCategory.Waiting;
- if (Provider.Query(
- new Filter<RequisitionItem>(x => x.RequisitionLink.ID).IsEqualTo(r.ID)
- .And(x=>x.Picked).IsNotEqualTo(DateTime.MinValue),
- new Columns<RequisitionItem>(x => x.ID)
- ).Rows.Any()
- )
- return KanbanCategory.InProgress;
- return KanbanCategory.Open;
- });
- }
- protected override void AfterSave(RequisitionItem entity)
- {
- base.AfterSave(entity);
- UpdateTrackingKanban(entity);
- }
- protected override void AfterDelete(RequisitionItem entity)
- {
- base.AfterDelete(entity);
- UpdateTrackingKanban(entity);
- }
- }
- }
|