private async Task ProcessNextEnrolmentOption(IDialogContext context, IAwaitable <string> result) { var reply = context.MakeMessage(); reply.Attachments = new List <Attachment>(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; var courseCategories = CourseCategory.CreateList(); var howToButtons = new CardAction() { Type = "openUrl", Title = "View Process", Value = "https://www.cityvarsityonline.com/how-it-works/" }; var coursesButtons = new CardAction() { Type = "openUrl", Title = "Select Course", Value = "https://www.cityvarsityonline.com/courses/" }; var howTothumbnail = new ThumbnailCard() { Title = "Enrolment Process", Subtitle = "This option will give you step by step guidance on how to apply and register to study with us.", Buttons = new List <CardAction>() }; howTothumbnail.Buttons.Add(howToButtons); howTothumbnail.Images.Add(new CardImage("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wC" + "EAAkGBxITEBAPEhAVDxEQFRUVFRAVEBUSFRUVFhUXFxcXFRUYHSggGBolGxcWITEhJSkrLi4uFx8zODMtNygtLisBCgoKDg0OGxAQGy0lHSUvLS8tLi0tKy0vLSswKy0tLS0tLS0tLS0tLS0wLS0tLTUtLS0tKystLS0tLS0tLS0tLf/AABEIAKAA1AMBIgACEQEDEQH/xAAcAAABBAMBAAAAAAAAAAAAAAAAAQQFBgIDBwj/xAA/EAABAwIDAwkFBgUEAwAAAAABAAIDBBEFEiEGMUETIjJRYXGBkaEHQlKxwRQjQ2Jy4SRTY5LRM4Ky8DSDo//EABsBAQACAwEBAAAAAAAAAAAAAAACBAEDBQYH/8QAKBEAAgIBAwMEAgMBAAAAAAAAAAECAxEEEiEFEzEiQVFhcbEUQpEy/9oADAMBAAIRAxEAPwDuKEIQAhCEAIQhACEIQAhCEAIQhACEIQAhCEAISXRdAKhJdBKAVCbz1kbOm8M7yAm9NjUDzZsgJ7Ta/ddYyiark1lJ4JBCRpulWSAIQhAIhKhACEIQAhCEAIQhACEIQAhCwmkDQXOIa0AkkmwAG8kncEBkhUmv2zklJZQsaWXsa2W4iv8A0WDWY91h2rS3Z+pn508089+D5fs0fhDHrb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eBXr5VX2h7HR4lSmI2bNHd0Mtui6249bTuIWQRXsm27biFOIpSG1kDQHj+Y0acoPqOBV/C8k7O0lbTYllhaYqmkc4vzGwa1t8wffeCPO69U4LXieCKcDLyjA4t6iRqPAoB8kSpEAqEIQAhIhACEIQCoQkQAkISoQGGVZNSoWAYPalaxZIWTOQQhCGAQhKgBJZKkQAkSoQCJUIQEdXYLFIS4sAL7Bxyg5rbs196d0lM2NjY2iwaLBbkqARCEIBUiEIAQhCA//Z")); var coursesThumbnail = new ThumbnailCard() { Title = "Choose Course to enrol", Subtitle = "This option will take you to the various courses on offer where you can pick one and register.", Buttons = new List <CardAction>() }; coursesThumbnail.Buttons.Add(coursesButtons); coursesThumbnail.Images.Add(new CardImage("https://www.cityvarsityonline.com/wp-content/uploads/2016/10/SEO_WR-1.jpg")); reply.Attachments.Add(coursesThumbnail.ToAttachment()); reply.Attachments.Add(howTothumbnail.ToAttachment()); await context.PostAsync(reply); context.Wait(MessageReceived); }
private async Task ProcessSearchOption(IDialogContext context, IAwaitable <object> result) { var repo = new EducorDbRepo(null); var chosenOption = await result; var tenantId = 1; var courseSearchService = new CourseSearchService(); var reply = context.MakeMessage(); var pictureUrl = ""; switch (chosenOption.ToString()) { case "Search by Course Category": reply.Attachments = new List <Attachment>(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; var courses = new List <Data.Models.Course>(); var courseCategories = CourseCategory.CreateList(); var categoryButtons = new CardAction() { Type = "openUrl", Title = "View Details", Value = "https://www.cityvarsityonline.com/courses/" }; foreach (var courseCategory in courseCategories) { var thumbnail = new ThumbnailCard() { Title = courseCategory.Title, Subtitle = courseCategory.SubTitle, Buttons = new List <CardAction>() }; thumbnail.Buttons.Add(categoryButtons); thumbnail.Images.Add(new CardImage(courseCategory.PictureUrl)); reply.Attachments.Add(thumbnail.ToAttachment()); } await context.PostAsync("Please Select the course category:"); await context.PostAsync("Each link will take you to the website courses"); await context.PostAsync(reply); break; case "Search by Course Start Date": var form = new FormDialog <StartDateForm>( new StartDateForm(), StartDateForm.BuildForm ); context.Call <StartDateForm>(form, DateFormComplete); break; case "Search by Course Name": await context.PostAsync("Please name the course you are looking for:"); var courseName = await result; courses = repo.CourseQueries.GetAllForTenant(tenantId) .Where(x => x.IsVisible && x.Name.Contains(courseName.ToString())).ToList(); reply = context.MakeMessage(); reply.Attachments = new List <Attachment>(); reply.AttachmentLayout = AttachmentLayoutTypes.Carousel; var namesButtons = new CardAction() { Type = "openUrl", Title = "View Details", Value = "https://www.cityvarsityonline.com/course-schedule" }; pictureUrl = "https://www.cityvarsityonline.com/wp-content/uploads/2016/12/Creative-Writing.png"; foreach (var course in courses) { var thumbnail = new ThumbnailCard() { Title = course.Name, Subtitle = $"Start Date: {course.Semester.Substring(0, 8)}\n" + $"End Date: {course.Semester.Substring(12, 20)}", Buttons = new List <CardAction>() }; thumbnail.Buttons.Add(namesButtons); thumbnail.Images.Add(new CardImage(pictureUrl)); reply.Attachments.Add(thumbnail.ToAttachment()); } await context.PostAsync("Here are courses with similar or related names:"); await context.PostAsync(reply); break; default: // ReSharper disable once RedundantCaseLabel case "Show All Courses on Offer": //PromptDialog.Confirm(context, ViewListOfAllCourses, "Please confirm that want to view all courses?", // "Please click an option below or type 'yes' or 'no'", 2, PromptStyle.Auto, new string[] { "YES", "NO" }); tenantId = 1; repo = new EducorDbRepo(null); courses = repo.CourseQueries.GetAllForTenant(tenantId).Where(x => x.IsVisible).ToList(); var response = context.MakeMessage(); response.Attachments = new List <Attachment>(); response.AttachmentLayout = AttachmentLayoutTypes.Carousel; var datesButtons = new CardAction() { Type = "openUrl", Title = "View Details", Value = "https://www.cityvarsityonline.com/course-schedule" }; pictureUrl = "https://www.cityvarsityonline.com/wp-content/uploads/2016/12/Creative-Writing.png"; foreach (var course in courses) { var thumbnail = new ThumbnailCard() { Title = course.Name, Subtitle = $"Price: R{ course.OriginalCost}\n" + $"College: City Varsity Online\n" + $"Start Date: {course.Semester}\n \n", Buttons = new List <CardAction>() }; thumbnail.Buttons.Add(datesButtons); thumbnail.Images.Add(new CardImage(pictureUrl)); response.Attachments.Add(thumbnail.ToAttachment()); } await context.PostAsync("Please select course from our list below:"); await context.PostAsync(response); context.Wait(MessageReceived); break; } }