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); }
public static STAGE GetStage(DBClassesDataContext dbc, int sid) { STAGE li = (from l in dbc.STAGEs where l.STAGEID == sid select l).SingleOrDefault(); return(li); }
private string getTimeLogLines() { String s = "<table class='table table-condensed'>" + "<thead class='header'>" + "<tr class='active'>" + "<th style = 'width:40%' >Time</ th >" + "<th style='width:20%'>Required</th>" + "<th style = 'width:20%' >Completed</th>" + "<th style = 'width:20%' >Remaining</th>" + "</tr></thead><tbody>"; // now log each time if (briefing > 0.0M) { s += MakeTimeLogLine("Briefing", briefing, Loggedbriefing, (briefing - Loggedbriefing)); } if (classvideo > 0.0M) { s += STAGE.MakeTimeLogLine("Class / Video", classvideo, Loggedclassvideo, (classvideo - Loggedclassvideo)); } if (exams > 0.0M) { s += MakeTimeLogLine("Exams", exams, Loggedexams, (exams - Loggedexams)); } if (debrief > 0.0M) { s += MakeTimeLogLine("Debrief", debrief, Loggeddebrief, (debrief - Loggeddebrief)); } if (duallocalday > 0.0M) { s += MakeTimeLogLine("Dual Day", duallocalday, Loggedduallocalday, (duallocalday - Loggedduallocalday)); } if (duallocalnight > 0.0M) { s += MakeTimeLogLine("Dual Night", duallocalnight, Loggedduallocalnight, (duallocalnight - Loggedduallocalnight)); } if (dualccday > 0.0M) { s += MakeTimeLogLine("Dual Day CC", dualccday, Loggeddualccday, (dualccday - Loggeddualccday)); } if (dualccnight > 0.0M) { s += MakeTimeLogLine("Dual Night CC", dualccnight, Loggeddualccnight, (dualccnight - Loggeddualccnight)); } if (sololocalday > 0.0M) { s += MakeTimeLogLine("Solo Local", sololocalday, Loggedsololocalday, (sololocalday - Loggedsololocalday)); } if (soloccday > 0.0M) { s += MakeTimeLogLine("Solo CC", soloccday, Loggedsoloccday, (soloccday - Loggedsoloccday)); } s += "</tbody></table>"; return(s); }
/** * this method loads all the times logged for this STAGE for this student. */ internal static void PopulateTotalTimesForStage(IEnumerable <LessonTimeLog> timelog, string studentID, STAGE stg) { foreach (LessonTimeLog log in timelog) { if (stg.STAGEID == log.STAGEID) { stg.Loggedbriefing += log.briefing; stg.Loggedclassvideo += log.classvideo; stg.Loggeddebrief += log.debrief; stg.Loggeddualccday += log.dualccday; stg.Loggeddualccnight += log.dualccnight; stg.Loggedduallocalday += log.duallocalday; stg.Loggedduallocalnight += log.duallocalnight; stg.Loggedexams += log.exams; stg.Loggedsoloccday += log.soloccday; stg.Loggedsoloccnight += log.soloccnight; stg.Loggedsololocalday += log.sololocalday; stg.Loggedsololocalnight += log.sololocalnight; } } }