Exemple #1
0
        /// <summary>
        /// Method used to caculate the progress for a user in theoretical and practical
        /// </summary>
        public void CalculateProgress()
        {
            GetLessonList();
            TheoreticalProgress = 0;
            PracticalProgress   = 0;

            foreach (Lesson l in LessonsList)
            {
                LessonTemplate template = Session.LessonTemplates.Find(x => l.TemplateID == x.Id);

                if (template == null)
                {
                    continue;
                }

                if (l.Completed && l.Progress == template.Time && template.Type == "Theoretical")
                {
                    TheoreticalProgress++;
                }
                else if (l.Completed && l.Progress == template.Time && template.Type == "Practical")
                {
                    PracticalProgress++;
                }
            }
        }
        /// <summary>
        /// Method used to get the next lesson for the logged in user
        /// </summary>
        /// <returns></returns>
        private static Lesson GetNextLesson()
        {
            if (CurrentLesson.LessonTemplate != null)
            {
                int            progress       = CurrentLesson.Progress;
                int            templateID     = CurrentLesson.TemplateID;
                LessonTemplate lessonTemplate = CurrentLesson.LessonTemplate;

                if (CurrentLesson.Progress == CurrentLesson.LessonTemplate.Time)
                {
                    templateID    += 1;
                    progress       = 1;
                    lessonTemplate = LessonTemplates.Find(x => x.Id == templateID);
                }
                else
                {
                    progress += 1;
                }

                Lesson newLesson = new Lesson(CurrentLesson.UserID, 0, templateID, progress, lessonTemplate, CurrentLesson.StartDate, CurrentLesson.EndDate, false);

                return(newLesson);
            }
            return(new Lesson(CurrentLesson.UserID, 0, 2, 1, new LessonTemplate(), CurrentLesson.StartDate, CurrentLesson.EndDate, false));
        }
Exemple #3
0
 public Lesson(int id, int userid, int appointmentid, int lessonid, int lessonpart, LessonTemplate lessonTemplate, DateTime startdate,
               DateTime enddate, bool completed)
 {
     this.Id             = id;
     this.UserID         = userid;
     this.AppointmentID  = appointmentid;
     this.TemplateID     = lessonid;
     this.Progress       = lessonpart;
     this.LessonTemplate = lessonTemplate;
     this.StartDate      = startdate;
     this.EndDate        = enddate;
     this.Completed      = completed;
 }
Exemple #4
0
 public Lesson(string instructorFirstname, string instructorLastname, int appointmentID, int templateId, int progress, DateTime startDate, DateTime endDate, bool completed, LessonTemplate lessonTemplate, string instructorSignaturePath, int studentId)
 {
     InstructorFirstname     = instructorFirstname;
     InstructorLastname      = instructorLastname;
     AppointmentID           = appointmentID;
     TemplateID              = templateId;
     Progress                = progress;
     StartDate               = startDate;
     EndDate                 = endDate;
     Completed               = completed;
     this.LessonTemplate     = lessonTemplate;
     InstructorSignaturePath = instructorSignaturePath;
     this.UserID             = studentId;
 }