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); }
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); }