コード例 #1
0
        private async Task <DialogTurnResult> StartAsync(DialogContext innerDc, UserQuery userQuery, object luisResult)
        {
            // Log None Logs
            LuisResult objLuisResult = (LuisResult)luisResult;
            //await objLoggingMiddleware.InsertNoneLuisLogs(innerDc.Context, objLuisResult, _config, userQuery.EnterpriseId);
            await _sqlLoggerRepository.InsertNoneLuisLogs(innerDc.Context, objLuisResult, userQuery.EnterpriseId);

            Activity replyToActivity = innerDc.Context.Activity.CreateReply();

            replyToActivity.Text        = Constants.NonehandleMessage;
            replyToActivity.Attachments = new List <Attachment>();
            ThumbnailCard tCard = new ThumbnailCard()
            {
                Buttons = new List <CardAction>()
                {
                    new CardAction()
                    {
                        Title = "View Schedule",
                        Type  = ActionTypes.ImBack,
                        Value = $"View Schedule"
                    },
                    new CardAction()
                    {
                        Title = "Raise Adhoc",
                        Type  = ActionTypes.ImBack,
                        Value = $"Raise Adhoc"
                    },
                    new CardAction()
                    {
                        Title = "Cancel Trip",
                        Type  = ActionTypes.ImBack,
                        Value = $"Cancel Trip"
                    },
                    new CardAction()
                    {
                        Title = "View Route",
                        Type  = ActionTypes.ImBack,
                        Value = $"View Route"
                    },
                    new CardAction()
                    {
                        Title = "View Adhoc Status",
                        Type  = ActionTypes.ImBack,
                        Value = $"View Adhoc Status"
                    },
                    new CardAction()
                    {
                        Title = "View OTP",
                        Type  = ActionTypes.ImBack,
                        Value = $"View OTP"
                    }
                }
            };

            string eid = userQuery.EnterpriseId;

            userQuery = new UserQuery();
            userQuery.EnterpriseId = eid; eid = null;
            await _accessors.UserQueryAccessor.SetAsync(innerDc.Context, userQuery);

            await _accessors.UserState.SaveChangesAsync(innerDc.Context);

            replyToActivity.Attachments.Add(tCard.ToAttachment());

            await innerDc.Context.SendActivityAsync(replyToActivity);

            return(await innerDc.EndDialogAsync());

            #region SuggestionAction
            //replyToActivity.SuggestedActions = new SuggestedActions()
            //{
            //    Actions =new List<CardAction>
            //    {
            //        new CardAction()
            //        {
            //            Title = "View Schedule",
            //            Type = ActionTypes.ImBack,
            //            Value = $"View Schedule"
            //        },
            //        new CardAction()
            //        {
            //            Title = "Raise Adhoc",
            //            Type = ActionTypes.ImBack,
            //            Value = $"Raise Adhoc"
            //        },
            //        new CardAction()
            //        {
            //            Title = "Cancel Trip",
            //            Type = ActionTypes.ImBack,
            //            Value = $"Cancel Trip"
            //        },
            //        new CardAction()
            //        {
            //            Title = "View Route",
            //            Type = ActionTypes.ImBack,
            //            Value = $"View Route"
            //        },
            //        new CardAction()
            //        {
            //            Title = "View Adhoc Status",
            //            Type = ActionTypes.ImBack,
            //            Value = $"View Adhoc Status"
            //        },
            //        new CardAction()
            //        {
            //            Title = "View OTP",
            //            Type = ActionTypes.ImBack,
            //            Value = $"View OTP"
            //        }
            //    }
            //};

            #endregion
        }