예제 #1
0
        public virtual async Task MessageRecievedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var message = await result;

            try
            {
                PeopeAppService searchService = new PeopeAppService();
                List <People>   searchResult  = await searchService.SearchByNamePeople(message.Text);

                if (searchResult.Count > 0)
                {
                    CardUtil.ShowPeopleHeroCard(message, searchResult);
                    Thread.Sleep(4000);
                    await SelectedConfirm(context);
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "¡LO SIENTO...! No encontré la información. Por favor,  intente nuevamente"));
                    await StartAsync(context);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
                await context.PostAsync("¡LO SIENTO...! Por el momento no esta disponible este servicio. Por favor, intente más tarde.");

                context.Done <object>(null);
            }
        }
예제 #2
0
        public virtual async Task MessageRecievedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var message = await result;

            try
            {
                PeopeAppService searchService = new PeopeAppService();
                List <People>   searchResult  = await searchService.SearchByNamePeople(message.Text);

                if (searchResult.Count > 0)
                {
                    CardUtil.ShowPeopleHeroCard(message, searchResult);
                    await SelectedConfirm(context);
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "No hemos encontrado información. Por favor intente de nuevo"));
                    await StartAsync(context);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
            }
            // context.Done<object>(null);
        }