コード例 #1
0
ファイル: LessonLog.cs プロジェクト: flyvfr/lessontrack
        public int AddLogItem(DBClassesDataContext dbc, CompletionLog compLog)
        {
            // is there a record of this user performing this lesson ?
            bool bFound = false;

            foreach (LessonLogItem lli in mLog)
            {
                if (lli.StudentID == compLog.Student && lli.LessonID == compLog.LESSONID)
                {
                    bFound = true;
                    break;
                }
            }
            if (!bFound)
            {
                LessonLogItem log = new LessonLogItem();
                log.DoneOn         = compLog.DateCompleted;
                log.InstructorID   = compLog.Instructor;
                log.InstructorName = AppUser.getUser(compLog.Instructor).GetFullName();
                log.StudentID      = compLog.Student;
                log.StudentName    = AppUser.getUser(compLog.Student).GetFullName();
                log.LessonID       = compLog.LESSONID;
                log.LessonName     = LESSON.GetLesson(dbc, compLog.LESSONID).Title;
                log.StageID        = compLog.STAGEID;
                log.StageName      = STAGE.GetStage(dbc, compLog.STAGEID).Name;

                // Update flight hours for this lesson for this student
                log.UpdateFlightHours(dbc);

                mLog.Add(log);
            }

            return(mLog.Count);
        }
コード例 #2
0
        public static LESSON GetLesson(DBClassesDataContext dbc, int lid)
        {
            LESSON li = (from l in dbc.LESSONs
                         where l.LESSONID == lid
                         select l).SingleOrDefault();

            return(li);
        }
コード例 #3
0
ファイル: LessonTimeLog.cs プロジェクト: flyvfr/lessontrack
 /**
  * this method loads all the times logged for this lesson for this student.
  */
 internal static void PopulateTotalTimesForLesson(IEnumerable <LessonTimeLog> timelog, string Student, LESSON lesson)
 {
     foreach (LessonTimeLog log in timelog)
     {
         if (lesson.LESSONID == log.LESSONID)
         {
             lesson.Loggedbriefing       += log.briefing;
             lesson.Loggedclassvideo     += log.classvideo;
             lesson.Loggeddebrief        += log.debrief;
             lesson.Loggeddualccday      += log.dualccday;
             lesson.Loggeddualccnight    += log.dualccnight;
             lesson.Loggedduallocalday   += log.duallocalday;
             lesson.Loggedduallocalnight += log.duallocalnight;
             lesson.Loggedexams          += log.exams;
             lesson.Loggedsoloccday      += log.soloccday;
             lesson.Loggedsoloccnight    += log.soloccnight;
             lesson.Loggedsololocalday   += log.sololocalday;
             lesson.Loggedsololocalnight += log.sololocalnight;
         }
     }
 }