Exemplo n.º 1
0
        private async Task ConfirmIdeaAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var activity = await result;

            var answer = activity.GetTrimmedText();

            if (!answer.IgnoreCaseIn(ConfirmOptions))
            {
                await context.ComfirmAsync("Sorry, I don't understand. Would you like to submit this idea?");

                context.Wait(ConfirmIdeaAsync);
                return;
            }

            if (answer.IgnoreCaseEquals("No"))
            {
                await context.ComfirmAsync("Okay. Would you like an email summary of your idea? (Not functional during pilot)");

                context.Wait(ConfirmToSendIdeaByEmail);
            }
            else
            {
                await context.Forward(new SignInDialog(), SaveIdea, context.Activity, CancellationToken.None);
            }
        }
Exemplo n.º 2
0
        private async Task ConfirmToSendIdeaByEmail(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var activity = await result;

            var answer = activity.Text.Trim();

            if (!answer.IgnoreCaseIn(ConfirmOptions))
            {
                await context.ComfirmAsync("Sorry, I don't understand. Would you like an email summary of your idea? (Not functional during pilot)");

                context.Wait(ConfirmToSendIdeaByEmail);
                return;
            }

            if (answer.IgnoreCaseEquals("Yes"))
            {
                await context.SayAsync("Sorry. Sending idea through email is not implemented!");
            }
            else
            {
                await context.SayAsync("Create idea canceled.");
            }
            context.Done(null as Idea);
        }
Exemplo n.º 3
0
        private async Task SetStartDate(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var activity = await result;

            DateTime startDate;
            var      commitDateStr = activity.GetTrimmedText();

            if (commitDateStr.IgnoreCaseEquals("today"))
            {
                startDate = new DateTime(DateTime.Today.Ticks);
            }
            else if (commitDateStr.IgnoreCaseEquals("tomorrow"))
            {
                startDate = new DateTime(DateTime.Today.Ticks).AddDays(1);
            }
            else if (!DateTime.TryParse(commitDateStr, out startDate))
            {
                await context.SayAsync("Invalid date, please input again. (Date format: mm/dd/yyyy)");

                context.Wait(SetStartDate);
                return;
            }

            startDate      = startDate.Date.AddHours(12);
            idea.StartDate = new DateTimeOffset(startDate, TimeSpan.Zero);
            var summary = $"**Idea**: {idea.Title}<br />" +
                          $"**Next Steps**: {(nextSteps.Contains("\r\n") ? "<br />" : "")}{nextSteps.Replace("\r\n", "<br />")}<br />" +
                          $"**Aligned to Metric**: {metric.Name}<br />" +
                          $"**Owner**: {idea.Owners.Select(i => i.DisplayName).FirstOrDefault()}<br />" +
                          $"**Start Date**: {idea.StartDate?.DateTime.ToShortDateString()}";
            await context.SayAsync(summary);

            await context.ComfirmAsync("Would you like to submit this idea?");

            context.Wait(ConfirmIdeaAsync);
        }