Example #1
0
        public override void Execute()
        {
            DateTime latest = GetLatestImplementationDate();
            string   query  = "SELECT * FROM ImplementedBatches WHERE datetime(ImplementationDate) >= ? AND datetime(ImplementationDate) <= ? ORDER BY ImplementationDate DESC";

            List <object> parameters = new List <object>()
            {
                latest.AddDays(-30).FormatForDatabase(),
                latest.FormatForDatabase()
            };

            store.ExecuteReader(typeof(LoggedBatch), query, parameters);
            Results = store.Results;
        }
Example #2
0
        public override void Execute()
        {
            string query = "SELECT * FROM ReceivedBatches";

            store.ExecuteReader(typeof(ReceivedBatch), query);
            Results = store.Results;
        }
        void DeductBatchQuantityFromInventory()
        {
            string        query      = "SELECT * FROM ReceivedBatches WHERE SystemId = ?";
            List <object> parameters = new List <object> {
                targetId
            };

            store.ExecuteReader(typeof(ReceivedBatch), query, parameters);

            if (store.Results.Count > 0)
            {
                Entity <ReceivedBatch> targetInventoryEntity = store.Results[0] as Entity <ReceivedBatch>;
                ITransaction           finder = new ListCurrentInventoryTransaction(store);
                finder.Execute();

                foreach (IEntity entity in finder.Results)
                {
                    Entity <InventoryBatch> inventoryEntity = entity as Entity <InventoryBatch>;

                    if (inventoryEntity.NativeModel.BatchNumber == targetInventoryEntity.NativeModel.BatchNumber)
                    {
                        inventoryEntity.NativeModel.DeductQuantity(targetInventoryEntity.NativeModel.Quantity);
                        ITransaction updater = new EditBatchInCurrentInventoryTransaction(inventoryEntity, store);
                        updater.Execute();
                        break;
                    }
                }
            }
        }
Example #4
0
        public override void Execute()
        {
            string query = "SELECT * FROM BatchOperators";

            store.ExecuteReader(typeof(BatchOperator), query);
            Results = store.Results;
        }
        public override void Execute()
        {
            string        query      = "SELECT * FROM ReceivedBatches WHERE PONumber = ?";
            List <object> parameters = new List <object> {
                targetPo
            };

            store.ExecuteReader(typeof(ReceivedBatch), query, parameters);
            Results = store.Results;
        }
Example #6
0
        public override void Execute()
        {
            string        query      = "SELECT * FROM ReceivedBatches WHERE BatchNumber = ? ORDER BY ReceivingDate DESC";
            List <object> parameters = new List <object> {
                batchNumber
            };

            store.ExecuteReader(typeof(ReceivedBatch), query, parameters);
            Results = store.Results;
        }
        public override void Execute()
        {
            string        query      = "SELECT * FROM ReceivedBatches WHERE ReceivingOperatorId = ?";
            List <object> parameters = new List <object>()
            {
                id
            };

            store.ExecuteReader(typeof(ReceivedBatch), query, parameters);
            Results = store.Results;

            if (Results.Count > 0)
            {
                return;
            }

            query = "SELECT * FROM ImplementedBatches WHERE ImplementingOperatorId = ?";
            store.ExecuteReader(typeof(LoggedBatch), query, parameters);
            Results = store.Results;
        }
Example #8
0
        bool BatchExistsInInventory()
        {
            string        query      = "SELECT * FROM InventoryBatches WHERE BatchNumber = ?";
            List <object> parameters = new List <object> {
                entity.NativeModel.BatchNumber
            };

            store.ExecuteReader(typeof(InventoryBatch), query, parameters);

            return(store.Results.Count > 0);
        }
Example #9
0
        public override void Execute()
        {
            string        query      = "SELECT * FROM ImplementedBatches WHERE BatchNumber = ?";
            List <object> parameters = new List <object>()
            {
                batchNumber
            };

            store.ExecuteReader(typeof(LoggedBatch), query, parameters);
            Results = store.Results;
        }
        public override void Execute()
        {
            string query = "SELECT * FROM BatchOperators WHERE SystemId = ?";

            List <object> parameters = new List <object>
            {
                targetId
            };

            store.ExecuteReader(typeof(BatchOperator), query, parameters);
            Results = store.Results;
        }
        public override void Execute()
        {
            string query = "SELECT * FROM ReceivedBatches WHERE datetime(ReceivingDate) >= datetime(?) AND datetime(ReceivingDate) <= datetime(?) ORDER BY ReceivingDate DESC";

            List <object> parameters = new List <object>
            {
                start.FormatForDatabase(),
                          end.FormatForDatabase()
            };

            store.ExecuteReader(typeof(ReceivedBatch), query, parameters);
            Results = store.Results;
        }
Example #12
0
        int GetReceivingOperatorId()
        {
            string query = "SELECT * FROM BatchOperators WHERE FirstName = ? AND LastName = ?";

            List <object> parameters = new List <object>()
            {
                entity.NativeModel.ReceivingOperator.FirstName,
                entity.NativeModel.ReceivingOperator.LastName
            };

            store.ExecuteReader(typeof(BatchOperator), query, parameters);
            Entity <BatchOperator> operatorEntity = store.Results[0] as Entity <BatchOperator>;

            return(operatorEntity.SystemId);
        }
        public override void Execute()
        {
            DateTime start = new DateTime(date.Year, date.Month, date.Day);
            DateTime end   = start.AddDays(1).AddSeconds(-1);
            string   query = "SELECT * FROM ReceivedBatches WHERE datetime(ReceivingDate) >= datetime(?) AND datetime(ReceivingDate) < datetime(?) ORDER BY ReceivingDate DESC";

            List <object> parameters = new List <object>()
            {
                start.FormatForDatabase(),
                          end.FormatForDatabase()
            };

            store.ExecuteReader(typeof(ReceivedBatch), query, parameters);
            Results = store.Results;
        }
Example #14
0
        public override void Execute()
        {
            List <string> colors = new List <string> {
                "White", "Black", "Yellow", "Red", "Blue Red", "Deep Green", "Deep Blue", "Bright Red", "Bright Yellow"
            };
            string query = "SELECT * FROM ImplementedBatches WHERE ColorName = ? AND datetime(ImplementationDate) <= datetime(?) ORDER BY ImplementationDate DESC LIMIT 3";

            foreach (string color in colors)
            {
                List <object> parameters = new List <object>()
                {
                    color, calibratedDate.FormatForDatabase()
                };
                store.ExecuteReader(typeof(LoggedBatch), query, parameters);
                FilterUniqueBatches(store.Results);
            }
        }
Example #15
0
        bool BatchExistsInInventoryAndIsDepleted()
        {
            string        query      = "SELECT * FROM InventoryBatches WHERE SystemId = ?";
            List <object> parameters = new List <object> {
                entity.SystemId
            };

            store.ExecuteReader(typeof(InventoryBatch), query, parameters);

            if (store.Results.Count > 0)
            {
                Entity <InventoryBatch> inventoryEntity = store.Results[0] as Entity <InventoryBatch>;
                return(inventoryEntity.NativeModel.Quantity > 0);
            }

            return(false);
        }