Exemple #1
0
        public async Task SearchEmployees(IDialogContext context)
        {
            //perform search and give results
            DatabaseHelper dbHelper = new DatabaseHelper();

            if (skill != null && knowledgeLevel != null && location != null)
            {
                await context.PostAsync($"Okay, looking for people who know {skill} with knowledge level {knowledgeLevel} and located in {location}");

                List <User> results = dbHelper.GetUserBySkillProficiencyAndLocation(skill, knowledgeLevel, location);
                foreach (var user in results)
                {
                    var message = context.MakeMessage();

                    PersonDetailCard pCard = new PersonDetailCard();
                    var skills             = dbHelper.GetSkillsForUser(user.FirstName, user.LastName);
                    var attachment         = pCard.GetPeopleDetailsCard(user, skills);
                    message.Attachments = new List <Attachment>();
                    message.Attachments.Add(attachment);

                    await context.PostAsync(message);
                }

                if (results.Count == 0)
                {
                    await context.PostAsync("Sorry, I wasn't able to find what you were looking for.");
                }
            }

            context.Done <object>(new object());
        }
Exemple #2
0
        public async Task ShowDetails(IDialogContext context, LuisResult result)
        {
            var message = context.MakeMessage();

            PersonDetailCard pCard = new PersonDetailCard();
            var attachment         = pCard.GetThumbnailCard();

            message.Attachments = new List <Attachment>();
            message.Attachments.Add(attachment);

            await context.PostAsync(message);

            context.Wait(this.MessageReceived);
        }