Exemplo n.º 1
0
        //--------------------------------------------------------------------------------------Queue----------------------------------------------------------------------------------

        public void AstroQueueUpdate(String jSon)
        {
            jSon = StringCompression.DecompressString(jSon);
            JObject obj = JObject.Parse(jSon);

            STATIONNAME stationName = TTCSHelper.StationStrConveter(obj["StationName"].ToString());
            String      Id          = obj["Id"].ToString();
            String      Event       = obj["Event"].ToString();
            DateTime    TimeStamp   = DateTime.Parse(obj["TimeStamp"].ToString());

            Console.WriteLine("[AstroQueueUpdate] " + obj["StationName"] + " : " + obj["Event"] + " --> " + Id);

            AstroQueueImpl astroQueue = DBQueueEngine.FindById(stationName, Id);

            if (Event == "RECEIVED")
            {
                QueueStatus queueStatus = new QueueStatus(QUEUE_STATUS.WAITINGSTATION, SENDING_STATUS.COMPLETED, TimeStamp);

                astroQueue.QueueStatus.Add(queueStatus);
                astroQueue.Save();
            }

            Task task = Task.Run(async() =>
            {
                await Task.Delay(100);

                StationHandler StationCommunication = AstroData.GetStationObject(stationName);
                StationCommunication.AckTarget(astroQueue, QUEUE_STATUS.WAITINGSTATION, SENDING_STATUS.COMPLETED);
            });
        }