Ejemplo n.º 1
0
 private bool IsServiceAvailableForUser(string userId, QueuedItem item, ITurnContext turnContext)
 {
     if (item.IsCurrentOwner(userId))
     {
         OperationFinished?.Invoke(turnContext, $"El recurso ya está reservado por ti.");
         return(false);
     }
     if (item.IsUserWaiting(userId))
     {
         OperationFinished?.Invoke(turnContext, $"Ya estás en la lista.");
         return(false);
     }
     return(true);
 }
Ejemplo n.º 2
0
        private void SetServiceFree(ActionOnItem actionOnItem, ITurnContext turnContext)
        {
            if (!IsValidServiceId(actionOnItem.itemName))
            {
                OperationFinished?.Invoke(turnContext, ConversationWords.GetRandomValueFromList(ConversationWords.emptyServicePhrases));
                return;
            }
            QueuedItem item = GetQueuedService(actionOnItem.itemName);

            if (item == null)
            {
                OperationFinished?.Invoke(turnContext, ConversationWords.GetRandomValueFromList(ConversationWords.emptyServicePhrases));
                return;
            }
            if (item.IsCurrentOwner(turnContext.Activity.From.Name))
            {
                RemoveOwnerFromService(item, turnContext);
                return;
            }
            OperationFinished?.Invoke(turnContext, ConversationWords.GetRandomValueFromList(ConversationWords.authorizationErrors));
        }