public static void Produce(ContractQueueItem QueueItem) { //add to queue //Check if existing queue item exists. if (Queue.Where(item => item.ContractRefID == QueueItem.ContractRefID).Any()) return; //Todo: should really override old/existing queue item! Queue.Add(QueueItem); }
public static void InitQueue() { for (int i = 0; i < 5; i++) { ContractQueueItem item = new ContractQueueItem { ContractRefID = i, ErrorCount = 0, Inserted = DateTime.Today, LastErrorReason = "", processed = null, QueueID = i, QueueRefID = i, QueueRefType = "", QueueType = QueueType.Activate }; Queue.Add(item); } }
public void Index(Contract contract) { if (contract.ContractStatus == QueueType.Activate) { ContractQueueItem queueItem = new ContractQueueItem { ContractRefID = 1, ErrorCount = 0, Inserted = DateTime.Today, LastErrorReason = "", processed = null, QueueID = 1, QueueRefID = 1, QueueRefType = "", QueueType = QueueType.Activate }; ContractQueue.Produce(queueItem); } else if (contract.ContractStatus == QueueType.Deactivate) { ContractQueueItem queueItem = new ContractQueueItem { ContractRefID = 1, ErrorCount = 0, Inserted = DateTime.Today, LastErrorReason = "", processed = null, QueueID = 1, QueueRefID = 1, QueueRefType = "", QueueType = QueueType.Deactivate }; ContractQueue.Produce(queueItem); } }