| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 | using Comal.Classes;using Comal.Stores;using InABox.Core;using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace PRSStores{    public class JobRequisitionStore : BaseStore<JobRequisition>    {        protected override void AfterSave(JobRequisition entity)        {            base.AfterSave(entity);            //this was originally written for Job Requisition tracked kanbans - no longer needed?            //If reinstating this code, refer to:            // - JobRequisitionStore            // - JobBillOfMaterialsItemGrid (where JobRequisitions are created) - Create Requi Method            // - PurchaseOrderItemStore (needed to trigger aftersave of JobRequisition to update tracked kanban when items are received)            //UpdateTrackingKanban<JobRequisitionKanban, JobRequisition, JobRequisitionLink>(entity, m =>            //{            //    CoreTable table = Provider.Query<JobRequisitionItem>(            //        new Filter<JobRequisitionItem>(x => x.Requisition.ID).IsEqualTo(entity.ID),            //        new Columns<JobRequisitionItem>(            //            x => x.PurchaseOrderItem.ID, //0            //            x => x.PurchaseOrderItem.ReceivedDate, //1            //            x => x.Status //2            //            )            //        );            //    if (table.Rows.Any())            //    {            //        bool keepKanbanOpen = false;            //        foreach (CoreRow row in table.Rows)            //        {            //            JobRequisitionItem item = row.ToObject<JobRequisitionItem>();            //            if (item.PurchaseOrderItem.ReceivedDate == DateTime.MinValue)            //            {            //                if (item.PurchaseOrderItem.ID == Guid.Empty)            //                {            //                    if (item.Status != JobRequisitionItemStatus.NotChecked) //no purchase order but at least one item has been checked            //                    {            //                        return KanbanCategory.InProgress;            //                    }            //                    else            //                        keepKanbanOpen = true;            //                }            //                else            //                    return KanbanCategory.Waiting; //at least one purchase order item not received, but also at least one purchase order has been raised            //            }            //        }            //        if (keepKanbanOpen)            //            return KanbanCategory.Open; //no purchase orders raised and no items have been checked to arrive here            //        else            //            return KanbanCategory.Complete; //all jobrequiitem.purchaseorderitems have to be received AND keepKanbanOpen must have remained false to arrive here            //    }            //    return KanbanCategory.Open;            //});        }    }}
 |