예제 #1
0
파일: Menu.cs 프로젝트: ocdsoft/Azure4Alexa
        private static AlexaUtils.SimpleIntentResponse ParseResults(MenuItem menuItem, DateTime dateFilter)
        {
            StringBuilder spokenText          = new StringBuilder();
            string        dateFilterFormatted = dateFilter.ToString(AlexaConstants.DefaultDateFormat);


            if (menuItem == null)
            {
                if (dateFilter.DayOfWeek == DayOfWeek.Saturday || dateFilter.DayOfWeek == DayOfWeek.Sunday)
                {
                    spokenText.Append(AlexaUtils.AddSentenceTags($"There's nothing on the menu for  {AlexaUtils.AddSayAsTags(dateFilterFormatted, InterpretAs.Date, "mdy")} it's the weekend"));
                }
                else
                {
                    spokenText.Append(AlexaUtils.AddSentenceTags($"There's nothing on the menu for  {AlexaUtils.AddSayAsTags(dateFilterFormatted, InterpretAs.Date, "mdy")}"));
                }
            }
            else
            {
                spokenText.Append(AlexaUtils.AddSentenceTags($"On the menu for  {AlexaUtils.AddSayAsTags(dateFilterFormatted, InterpretAs.Date, "mdy")}"));
                spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(menuItem.MealName));
                spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(menuItem.MealDesc));
            }

            return(new AlexaUtils.SimpleIntentResponse()
            {
                ssmlString = AlexaUtils.AddSpeakTags(spokenText.ToString())
            });
        }
예제 #2
0
        private static AlexaUtils.SimpleIntentResponse ParseResults(List <MissingAssignment> missingAssignments, Student student, Me me)
        {
            StringBuilder spokenText = new StringBuilder();
            int           count      = (missingAssignments == null) ? 0 : missingAssignments.Count;

            if (count > 0)
            {
                string plural = (count > 1) ? "s" : "";
                spokenText.Append(AlexaUtils.AddSentenceTags($"{student.FirstName} has {count} missing assignment{plural}"));
            }
            else
            {
                spokenText.Append(AlexaUtils.AddSentenceTags($"{student.FirstName} has no missing assignments"));
                spokenText.Append(AlexaUtils.AddSentenceTags(AlexaUtils.AddSayAsTags($"Great job, {student.FirstName}", InterpretAs.Interjection)));
            }

            if (missingAssignments != null)
            {
                foreach (var ma in missingAssignments)
                {
                    spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(ma.ClassName));
                    spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(ma.Title));
                    spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(ma.Description));
                    spokenText.Append(AlexaUtils.AddSentenceTags("<emphasis level='strong'>Due date</emphasis> " + AlexaUtils.AddSayAsTags(ma.DueDateFormatted, InterpretAs.Date, "mdy")));
                }
            }


            return(new AlexaUtils.SimpleIntentResponse()
            {
                ssmlString = AlexaUtils.AddSpeakTags(spokenText.ToString()),
                largeImage = string.Format(Url.StudentPhoto, me.SchoolID, student.Picture),
                smallImage = Url.Logo
            });
        }
예제 #3
0
        private static AlexaUtils.SimpleIntentResponse ParseResults(List <HomeworkAssignment> homeworkAssignments, Student student, Me me, DateTime dateFilter)
        {
            StringBuilder spokenText = new StringBuilder();
            int           count      = (homeworkAssignments == null) ? 0 : homeworkAssignments.Count;

            if (count > 0)
            {
                string plural = (count > 1) ? "s" : "";
                spokenText.Append(AlexaUtils.AddSentenceTags($"Yes, {student.FirstName} has {count} homework assignment{plural}"));
            }
            else
            {
                spokenText.Append(AlexaUtils.AddSentenceTags($"{student.FirstName} has no homework due on {AlexaUtils.AddSayAsTags(dateFilter.ToString(AlexaConstants.DefaultDateFormat), InterpretAs.Date, "mdy")}"));
                spokenText.Append(AlexaUtils.AddSentenceTags(AlexaUtils.AddSayAsTags($"<phoneme alphabet='x-sampa' ph='jIpi'>Yipee</phoneme>", InterpretAs.Interjection)));
            }

            if (homeworkAssignments != null)
            {
                foreach (var ma in homeworkAssignments)
                {
                    spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(ma.ClassName));
                    spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(ma.Title));
                    spokenText.Append(AlexaUtils.AddSentenceTagsAndClean(ma.Description));
                    spokenText.Append(AlexaUtils.AddSentenceTags("<emphasis level='strong'>Due date</emphasis> " + AlexaUtils.AddSayAsTags(ma.DueDateFormatted, InterpretAs.Date, "mdy")));
                }
            }


            return(new AlexaUtils.SimpleIntentResponse()
            {
                ssmlString = AlexaUtils.AddSpeakTags(spokenText.ToString()),
                largeImage = string.Format(Url.StudentPhoto, me.SchoolID, student.Picture),
                smallImage = Url.Logo
            });
        }
예제 #4
0
        private static AlexaUtils.SimpleIntentResponse ParseResults(Account account, string accountNameFilter)
        {
            StringBuilder spokenText = new StringBuilder();



            if (account == null)
            {
                spokenText.Append(AlexaUtils.AddSentenceTags($"I could not find an account named {accountNameFilter}"));
                spokenText.Append(AlexaUtils.AddSentenceTags($"I can lookup for the balance for accounts named cafeteria or childcare"));
            }
            else
            {
                spokenText.Append(AlexaUtils.AddSentenceTags($"The balance on your {account.Name} account is {AlexaUtils.AddSayAsTags("$" + account.Amount, InterpretAs.Unit)}"));
            }

            return(new AlexaUtils.SimpleIntentResponse()
            {
                ssmlString = AlexaUtils.AddSpeakTags(spokenText.ToString())
            });
        }