Beispiel #1
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);
        }
Beispiel #2
0
        public ObservableCollection <ReceivedBatch> GetReceivedBatchesByBatchNumber(string batchNumber)
        {
            ITransaction finder = new FindBatchesInReceivingLedgerByBatchNumberTransaction(batchNumber, sqliteStore);

            return(ExecuteTransactionAndBuildReceivedBatchObservableCollection(finder));
        }