示例#1
0
        public ObservableCollection <LoggedBatch> GetImplementedBatchesByBatchNumber(string batchNumber)
        {
            ITransaction finder = new FindBatchesInImplementationLedgerByBatchNumberTransaction(batchNumber, sqliteStore);

            finder.Execute();
            ObservableCollection <LoggedBatch> found = new ObservableCollection <LoggedBatch>();

            foreach (IEntity result in finder.Results)
            {
                Entity <LoggedBatch> entity = result as Entity <LoggedBatch>;
                found.Add(entity.NativeModel);
            }

            return(found);
        }
示例#2
0
        void UpdateImplementedBatches(Entity <ReceivedBatch> original, Entity <ReceivedBatch> updated)
        {
            ITransaction finder = new FindBatchesInImplementationLedgerByBatchNumberTransaction(original.NativeModel.BatchNumber, sqliteStore);

            finder.Execute();

            foreach (IEntity result in finder.Results)
            {
                Entity <LoggedBatch> entity = result as Entity <LoggedBatch>;
                entity.NativeModel.BatchNumber = updated.NativeModel.BatchNumber;
                entity.NativeModel.ColorName   = updated.NativeModel.ColorName;
                ITransaction updater = new UpdateBatchInImplementationLedgerAtIdTransaction(entity, sqliteStore);
                updater.Execute();
            }
        }
示例#3
0
        int GetAdjustedInventoryQuantity(string batchNumber, int currentQuantity, int newQuantity)
        {
            ITransaction finder = new FindBatchesInImplementationLedgerByBatchNumberTransaction(batchNumber, sqliteStore);

            finder.Execute();
            ITransaction received = new FindBatchesInReceivingLedgerByBatchNumberTransaction(batchNumber, sqliteStore);

            received.Execute();

            int implementedQuantity = finder.Results.Count;
            int receivedQuantity    = 0;

            for (int i = 0; i < received.Results.Count; i++)
            {
                Entity <ReceivedBatch> entity = received.Results[i] as Entity <ReceivedBatch>;
                receivedQuantity += entity.NativeModel.Quantity;
            }

            int updatedQuantity = currentQuantity >= newQuantity
                ? receivedQuantity - (currentQuantity - newQuantity)
                : receivedQuantity + (newQuantity - currentQuantity);

            return(updatedQuantity - implementedQuantity);
        }