public async Task PageView(IDialogContext context, LuisResult result) { var resultdate = TryFindDate(result); var pv = await LogService.GetPageViewCountAsync(resultdate.Date); CurrentDate = resultdate.Date; string message = $"Total Page View of {resultdate.Title} is {DialogHelper.ConvertHumanReadable(pv)}"; var msg = context.MakeMessage(); msg.Text = message; msg.Attachments = new List <Attachment>(); msg.Attachments.Add(new Attachment() { ContentUrl = "http://talktologweb.azurewebsites.net/images/mvcproducts/Page%20View/" + pv.ToString() + "/default.png", //ContentUrl = "http://localhost:3979/images/mvcproducts/Page%20View/" + pv.ToString() + "/default.png", ContentType = "image/png", Name = "Bender_Rodriguez.png" }); await context.PostAsync(msg); context.Wait(MessageReceived); }
public virtual async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> argument) { var message = await argument; if (message.Text.ToLower().StartsWith("what is going on yesterday")) { var uv = await LogService.GetUniqueVisitorCountAsync(new DateTime(2016, 7, 25)); var pv = await LogService.GetPageViewCountAsync(new DateTime(2016, 7, 25)); var signal = await LogService.GetErrorSignal(new DateTime(2016, 7, 25)); await context.PostAsync($"Here is summary of your request./unique visitor: {DialogHelper.ConvertHumanReadable(uv)}/ Total Page View: {DialogHelper.ConvertHumanReadable(pv)}/ Error Status Sign: {DialogHelper.CovertSignalToImoticon(signal)}"); context.Wait(MessageReceivedAsync); } else { await context.PostAsync("I can't understand. Sorry"); context.Wait(MessageReceivedAsync); } }