示例#1
0
        public void LoadStages(string optionalStudent)
        {
            DBClassesDataContext dbc = new DBClassesDataContext();
            IEnumerable <STAGE>  lst = from s in dbc.STAGEs
                                       where s.CertificationID == CertificationID
                                       select s;

            mStages = new List <STAGE>();
            foreach (STAGE l in lst)
            {
                mStages.Add(l);
            }
            IsComplete = true;

            foreach (STAGE stg in mStages)
            {
                stg.LoadLessons(dbc);
                // if student is specified, load his completion status
                if (!String.IsNullOrEmpty(optionalStudent))
                {
                    IEnumerable <CompletionLog> log     = CompletionLog.LoadStudentLog(dbc, optionalStudent);
                    List <CompletionLog>        logcopy = new List <CompletionLog>();
                    foreach (CompletionLog l in log)
                    {
                        logcopy.Add(l);
                    }

                    IEnumerable <LessonTimeLog> timelog     = LessonTimeLog.LoadStudentLog(dbc, optionalStudent);
                    List <LessonTimeLog>        timelogcopy = new List <LessonTimeLog>();
                    foreach (LessonTimeLog l in timelog)
                    {
                        timelogcopy.Add(l);
                    }
                    stg.LoadStudentStatus(timelogcopy, logcopy, optionalStudent);
                }
                if (stg.IsAllStarted)
                {
                    IsStarted = true;
                }
                if (!stg.IsAllComplete)
                {
                    IsComplete = false;
                }
            }
        }
示例#2
0
        /**
         * load the completion status of all items for this student
         */
        public void LoadStudentStatus(IEnumerable <LessonTimeLog> timelog, IEnumerable <CompletionLog> log, string studentID)
        {
            // Load the cumulative times logged for this student for this lesson
            LessonTimeLog.PopulateTotalTimesForLesson(timelog, studentID, this);

            foreach (LESSONITEM less in LessonItems)
            {
                less.LoadStudentStatus(log, studentID);
            }

            IsComplete = true;
            foreach (LESSONITEM less in LessonItems)
            {
                if (less.IsGroup)
                {
                    continue;               // ignore groups
                }
                if (less.IsComplete)
                {
                    IsStarted = true;
                }
                else
                {
                    IsComplete = false;
                }
            }

            IsTimesStarted = false;
            // now check the time logs to update if the lesson is started or completed
            if (Loggedbriefing > 0 || Loggedclassvideo > 0 || Loggeddebrief > 0 || Loggeddualccday > 0 || Loggeddualccnight > 0 || Loggedduallocalday > 0 || Loggedduallocalnight > 0 || Loggedexams > 0 || Loggedsoloccday > 0 || Loggedsoloccnight > 0 || Loggedsololocalday > 0 || Loggedsololocalnight > 0)
            {
                IsTimesStarted = true;   // some time has been logged, so started
            }

            IsTimesComplete = true;
            if (Loggedbriefing < (decimal)briefing || Loggedclassvideo < (decimal)classvideo || Loggeddebrief < (decimal)debrief ||
                Loggeddualccday < (decimal)dualccday || Loggeddualccnight < (decimal)dualccnight || Loggedduallocalday < (decimal)duallocalday || Loggedduallocalnight < (decimal)duallocalnight ||
                Loggedexams < (decimal)exams || Loggedsoloccday < (decimal)soloccday || Loggedsoloccnight < (decimal)soloccnight || Loggedsololocalday < (decimal)sololocalday ||
                Loggedsololocalnight < (decimal)sololocalnight)
            {
                IsTimesComplete = false;                   // Times logged is less than times
            }
            IsAllComplete = IsComplete && IsTimesComplete; // incomplete by default
            IsAllStarted  = IsStarted || IsTimesStarted;   // unstarted by default
        }