コード例 #1
0
        // POST: api/IncBatchData
        public async Task Post([FromBody] BatchData value)
        {
            List <BatchManager.BatchResult> results = null;

            if (value.isAvail)
            {
                results = await BatchManager.Instance.UpdateInc(value.Id, value.isAvail, value.LastComplete);

                if (!results.Contains(BatchManager.BatchResult.Updated))
                {
                    var  inc     = new IncBatchData();
                    bool success = await BatchManager.Instance.AddToQueue(inc.Convert(value));

                    if (success)
                    {
                        BatchManager.Instance.LoadQueue();
                        await logger.Log(value, "{0} Was not Updated. Adding to queue.");
                    }
                }
            }
            else
            {
                //Log results
                await logger.Log(value, null);
            }

            if (results != null)
            {
                foreach (var r in results)
                {
                    await resultsLogger.Log(typeof(IncBatchDataController), value, null, r);
                }
            }
            else
            {
                resultsLogger.Log(typeof(IncBatchDataController), value, null, BatchManager.BatchResult.NullResult);
            }
        }
コード例 #2
0
ファイル: BatchManager.cs プロジェクト: arketec/LossRunsNav
 public async Task <bool> AddToQueue(IncBatchData incBatch)
 {
     logger.Log(string.Format("IncBatch {0} Added to IncQueue", incBatch.Key));
     return(incQueue.TryAdd(incBatch));
 }