예제 #1
0
파일: MainDialog.cs 프로젝트: mluvii/dots
        public async Task StartAsync(IDialogContext context)
        {
            var culture = Thread.CurrentThread.CurrentCulture;

            if (personId == null)
            {
                personId = Customer.DefaultPersonId;
            }
            if (crmEntity == null)
            {
                crmEntity = await crmService.GetCrmData(personId, culture);
            }
            if (crmEntity != null)
            {
                SetCallParams(context);
                var reply = context.MakeMessage();
                reply.AddThumbnailCard(
                    crmEntity.Product?.ProductName,
                    (crmEntity.Product?.ProductPrice ?? 0).ToString("C"),
                    string.Format(Resources.WelcomeMessage_prompt, crmEntity.Salutation ?? crmEntity.Customer.FullName, $"<b>{crmEntity.Product?.ProductName}</b>"),
                    new[]
                {
                    Resources.WelcomeMessage_operator,
                    Resources.MluviiDialog_virtual_assistant
                },
                    crmEntity.Product?.ProductPhotoUrl);
                await context.PostAsync(reply);

                context.Wait(MessageReceivedAsync);

                return;
            }

            await context.SayAsync(Resources.CrmQueryFailed);

            var endreply = context.MakeMessage();

            endreply.AddHeroCard(
                "",
                "",
                string.Format(Resources.goodbye, crmEntity.Customer.Email, crmEntity.Product.ProductName),
                new[]
            {
                Resources.HelpDialog_end,
            });
            await context.PostAsync(endreply);

            context.Wait(onFinished);
        }
예제 #2
0
파일: MainDialog.cs 프로젝트: mluvii/dots
        public async Task StartAsync(IDialogContext context)
        {
            if (personId == null)
            {
                personId = Customer.DefaultPersonId;
            }
            if (crmEntity == null)
            {
                crmEntity = await crmService.GetCrmData(personId, Thread.CurrentThread.CurrentCulture);
            }
            if (crmEntity != null)
            {
                SetCallParams(context);
                await PostWelcomeCard(context);

                context.Wait(MessageReceivedAsync);

                return;
            }

            await context.SayAsync(Resources.CrmQueryFailed);

            var endreply = context.MakeMessage();

            endreply.AddHeroCard(
                "",
                "",
                string.Format(Resources.goodbye),
                new[]
            {
                Resources.HelpDialog_end
            });
            await context.PostAsync(endreply);

            context.Wait(onFinished);
        }