示例#1
0
 public StillInterestedDialog(StillInterestedEntity message)
 {
     question              = message.Question;
     messageType           = message.MessageType;
     conversationReference = message.ConversationReference;
     answer = message.Answer;
 }
示例#2
0
 private async Task StoreOnStillInterestedTable(IDialogContext context, IQnaResponse qnaAnswer)
 {
     var entity = new StillInterestedEntity(context.Activity.ChannelId, context.Activity.From.Id, MessageHelper.NormalizeString(qnaAnswer.Question))
     {
         ConversationId        = context.Activity.Conversation.Id,
         Timestamp             = DateTime.UtcNow,
         Answer                = qnaAnswer.Answer,
         ReceivedAnswer        = true,
         ConversationReference = JsonConvert.SerializeObject(context.Activity.AsMessageActivity().ToConversationReference())
     };
     var tableContent = await tableStorageProvider.SendToTableAsync("stillInterested", entity);
 }
示例#3
0
        private async Task AfterAreYouStillInterested(IDialogContext context, IAwaitable <bool> result)
        {
            var confirm = await result;
            var entity  = new StillInterestedEntity(context.Activity.ChannelId, context.Activity.From.Id, MessageHelper.NormalizeString(question))
            {
                ConversationId        = context.Activity.Conversation.Id,
                Timestamp             = DateTime.UtcNow,
                ConversationReference = conversationReference,
                Answer = answer,
            };

            if (confirm)
            {
                await context.PostAsync(messageProvider.GetMessage("ResendingQuestion"));

                var messageToSend = new MessageEntity()
                {
                    Question              = question,
                    MessageType           = messageType,
                    OriginalAnswer        = answer,
                    QuestionCorrelationId = Guid.NewGuid()
                };
                await queueProvider.InsertInQueueAsync("usertoexpert", messageToSend);

                entity.ReceivedAnswer = false;
            }
            else
            {
                entity.ReceivedAnswer = true;
                await context.PostAsync(messageProvider.GetMessage("ForgettingQuestion"));
            }
            await tableStorageProvider.SendToTableAsync("stillInterested", entity);

            await context.PostAsync(messageProvider.GetMessage("WhatMoreCanIDo"));

            context.Done(0);
        }