Beispiel #1
0
        /// <summary>
        /// Retrieves user profile data from DynamoDB 'user-profile'
        /// </summary>
        public async Task GetUserProfileData()
        {
            DatabaseItem items = await GetEntryByKey(this.UserID);

            if (items.TryGetValue(SCHEDULE_KEY, out AttributeValue dbSchedule))
            {
                if (items.TryGetValue(TEACH_MODE_KEY, out AttributeValue tM))
                {
                    this.teachMode = (MODE)Enum.Parse(typeof(MODE), tM.S);
                }
                else
                {
                    this.teachMode = MODE.Assess;
                }

                this.Schedule = int.Parse(dbSchedule.N);
                await this.scopeAndSequenceDB.GetSessionDataWithNumber(this.Schedule);

                log.INFO("UserProfileDB", "GetUserSchedule", "User profile exist, start the user at: " + this.Schedule);
            }
            else
            {
                await CreateNewUser();

                log.INFO("UserProfileDB", "GetUserSchedule", "User profile does not exist, start the user at: " + this.Schedule);
            }
            this.lesson = LessonFactory.GetLesson(this.scopeAndSequenceDB.Lesson);
        }
Beispiel #2
0
 public ViewLevelController(ILesson lesson, IContent content, ISubject subject, IViewLevel viewLevel)
 {
     _lesson    = lesson;
     _content   = content;
     _subject   = subject;
     _viewLevel = viewLevel;
 }
Beispiel #3
0
        public async Task <SkillResponse> HandleIntent()
        {
            var intentRequest = (Alexa.NET.Request.Type.IntentRequest)skillRequest.Request;

            string lessonName = GetSlotValue(intentRequest);

            LOGGER.log.INFO("MakePurchase", "HandleIntent", "Lesson to purcase to: " + lessonName);
            ILesson lessonToPurchase = LessonFactory.GetLesson(lessonName);
            await base.products.GetAvailableProducts();

            if (base.products.IsUnpaid(lessonToPurchase.InSkillPurchaseName))
            {
                LOGGER.log.DEBUG("LaunchRequest", "HandleRequest", "Premium content requires purchase");

                this.sessionAttributes.ProductName = lessonToPurchase.InSkillPurchaseName;
                return(AlexaResponse.PurchaseContentUpsell(base.products.GetProductId(lessonToPurchase.InSkillPurchaseName),
                                                           CommonPhrases.Upsell(), lessonToPurchase.InSkillPurchaseName));
            }


            await base.userProfile.ChangeLesson(lessonToPurchase);

            this.sessionAttributes.SessionState = STATE.Introduction;
            // relaunch for new lesson
            return(await new LaunchRequest(base.skillRequest).HandleRequest());
        }
 public LessonService(ILesson lesson, ILessonRepository lessonRepository,
                      IStudentRepository studentRepository, ITrainerRepository trainerRepository)
 {
     _lesson            = lesson;
     _lessonRepository  = lessonRepository;
     _studentRepository = studentRepository;
     _trainerRepository = trainerRepository;
 }
Beispiel #5
0
 public LessonController(ILesson lesson, IContent content, ISubject subject, IViewLevel viewLevel, ICommandIndex commandIndex, IRedisClient distributedCache)
 {
     _lesson           = lesson;
     _content          = content;
     _subject          = subject;
     _viewLevel        = viewLevel;
     _commandIndex     = commandIndex;
     _distributedCache = distributedCache;
 }
Beispiel #6
0
        static void Main(string[] args)
        {
            var lessons = from assembly in AppDomain.CurrentDomain.GetAssemblies()
                          from type in assembly.GetTypes()
                          where type.Name.ToUpper().StartsWith("LESSON")
                          select type;

            if (lessons.Count() <= 0)
            {
                Console.WriteLine("Уроков не найдено, нажмите любую клавишу, что бы выйти");
                Console.ReadKey(true);
                return;
            }

            bool lessonIsSelected = false;
            Type lessonType;

            do
            {
                DisplayMenu(lessons);
                string number = Console.ReadLine();

                lessonType = !string.IsNullOrEmpty(number) ?
                             lessons.FirstOrDefault(x => x.Name.ToUpper() == $"LESSON{number}") :
                             lessons.OrderByDescending(x => x.Name).FirstOrDefault();

                lessonIsSelected = lessonType != null;

                if (!lessonIsSelected)
                {
                    Console.WriteLine($"Не стоит торопить события, урока \"{number}\" пока еще не существует ;)");
                    Console.WriteLine();
                }
            } while (!lessonIsSelected);

            ILesson lessonInstance = Activator.CreateInstance(lessonType) as ILesson;

            Console.WriteLine($"------- {lessonInstance} ----------");

            try
            {
                lessonInstance?.DoSomeWork();
            }
            catch (Exception ex)
            {
                Console.Clear();
                Console.WriteLine($"Во время выполнения урока \"{lessonInstance}\" возникла ошибка:");
                Console.WriteLine();
                Console.WriteLine(ex.InnerException.Message);
                Console.WriteLine();
                Console.WriteLine(ex.Message);
                Console.WriteLine();
                Console.WriteLine(ex.StackTrace);
            }

            Console.ReadLine();
        }
Beispiel #7
0
        public async Task <SkillResponse> HandleIntent()
        {
            var intentRequest = (Alexa.NET.Request.Type.IntentRequest)skillRequest.Request;

            string lessonType = GetSlotValue(intentRequest);

            LOGGER.log.INFO("MoveToNewLesson", "HandleIntent", "Deck to move to: " + lessonType);
            ILesson lesson = LessonFactory.GetLesson(lessonType);
            await base.userProfile.ChangeLesson(lesson);

            this.sessionAttributes.SessionState = STATE.Introduction;
            // relaunch for new lesson
            return(await new LaunchRequest(base.skillRequest).HandleRequest());
        }
Beispiel #8
0
        public async Task <SkillResponse> HandleIntent()
        {
            LOGGER.log.INFO("WordsToRead", "HandleIntent", "Current Schedule: " + this.sessionAttributes.Schedule);

            ILesson lesson = LessonFactory.GetLesson(this.sessionAttributes.LessonType);

            this.sessionAttributes.SessionState = STATE.Assess;

            var request = (Alexa.NET.Request.Type.IntentRequest)skillRequest.Request;

            string currentWord = this.sessionAttributes.CurrentWord;

            LOGGER.log.INFO("WordsToRead", "HandleIntent", "Current Word: " + currentWord);

            bool wordWasSaid = ReaderSaidTheWord(request);

            LOGGER.log.DEBUG("WordsToRead", "HandleIntent", "Reader said the word? " + wordWasSaid);

            if (wordWasSaid)
            {
                lesson.QuickReply = CommonPhrases.ShortAffirmation;
                GradeBook.Passed(sessionAttributes);
                bool sessionFinished = !sessionAttributes.WordsToRead.Any();

                if (sessionFinished)
                {
                    LOGGER.log.DEBUG("WordsToRead", "HandleIntent", "Session Finished");
                    await this.userProfile.IncrementUserProfileSchedule();

                    return(ResponseBuilder.Tell(CommonPhrases.LongAffirmation + CommonPhrases.SessionFinished));
                }
            }
            else
            {
                lesson.QuickReply = CommonPhrases.ConstructiveCriticism;
                GradeBook.Missed(sessionAttributes);
            }

            WordAttributes wordAttributes = await WordAttributes.GetWordAttributes(this.sessionAttributes.CurrentWord, LOGGER.log);


            return(lesson.Dialogue(sessionAttributes.LessonMode, wordAttributes));
        }
 public void LoadLesson(ILesson lesson)
 {
     _lesson = lesson;
     LoadNextStep();
 }
Beispiel #10
0
 public async Task ChangeLesson(ILesson lesson)
 {
     // change user profile schedule to user requested index
     this.Schedule = lesson.FreeStartIndex;
     await UpdateSchedule();
 }
Beispiel #11
0
 public LessonController(ILesson lessRepo)
 {
     _lessRepo = lessRepo;
 }
 public Lesson(ILesson lessonRepository)
 {
     _lessonRepository = lessonRepository;
 }
Beispiel #13
0
 public CommandController(ICommandIndex command, ILesson lesson)
 {
     _command = command;
     _lesson  = lesson;
 }
Beispiel #14
0
 public LessonController(ILesson lesson, ISubject subject, IContent content)
 {
     _lesson  = lesson;
     _subject = subject;
     _content = content;
 }
 public void RegisterLesson(ILesson lesson)
 {
     _lessons.Add(lesson.Key, lesson);
 }
 public LessonController(ILesson lesson, ILoggerService logger, IClass @class)
 {
     _lesson = lesson;
     _logger = logger;
     _class  = @class;
 }