/// /// CREATE INSTRUCTOR OFFICE MEETINGS /// public static void AdobeConnectInstructorOfficeCreation(string file, BackgroundWorker b) { List <Instructor> instructors = new List <Instructor>(); int total = 0; if (file != "") { List <Instructor> currentInstructors = Excel.GetInstructorListFromExcelSpreadsheet(file); if (currentInstructors != null) { for (int i = 0; i < currentInstructors.Count; i++) { Instructor inst = currentInstructors[i]; if (!inst.IsCreated()) { total++; inst.SetBackgroundWorker(b); instructors.Add(inst); } } } } else { LogInformation.AddLineToLogInformation("Error", "No file was chosen."); return; } LogInformation.AddLineToLogInformation("Success", "Excel file was successfully parsed."); total = instructors.Count; b.ReportProgress(total); AsyncTracker.SetEvents(total); foreach (Instructor instructor in instructors) { ThreadPool.QueueUserWorkItem(o => instructor.CreateAccount()); } AsyncTracker.ProceedWhenAllEventsAreComplete(); Thread.Sleep(1000); }
/// /// CREATE COURSE GROUP MEETINGS /// public static void AdobeConnectCourseGroupCreation(List <Course> courses, string file, BackgroundWorker b) { bool success = false; int total = 0; List <Course> finalCourseList = new List <Course>(); if (file != "") { List <Course> currentCourses = Excel.GetCourseListFromExcelSpreadsheet(file); if (currentCourses != null) { success = true; foreach (Course c in currentCourses) { success = true; if (courses.Contains(c)) { foreach (Section s in c.GetSections()) { success = true; if (s.GetNumberOfMeetings() == 0) { int idx = courses.IndexOf(c); if (idx > -1) { int meetings = courses[idx].GetNumberOfMeetings(); if (meetings != 0) { int spot = c.GetSections().IndexOf(s); c.GetSections()[spot].SetNumberOfMeetings(meetings); c.SetBackgroundWorker(b); c.CourseFolderCreation(); total += meetings; } else { LogInformation.AddLineToLogInformation("Error", c.GetName() + " does not have a value for the number of meetings to create."); success = false; } } else { LogInformation.AddLineToLogInformation("Error", c.GetName() + " does not exist in the lookup table and there is not a value for the number of meetings to create."); success = false; } } else { c.SetBackgroundWorker(b); c.CourseFolderCreation(); total += s.GetNumberOfMeetings(); } } if (success) { finalCourseList.Add(c); } } } } } else { LogInformation.AddLineToLogInformation("Error", "No file was chosen."); return; } if (success) { LogInformation.AddLineToLogInformation("Success", "Excel file was successfully parsed."); } b.ReportProgress(total); AsyncTracker.SetEvents(total); foreach (Course c in finalCourseList) { ThreadPool.QueueUserWorkItem(o => c.SetFolderCreation()); } AsyncTracker.ProceedWhenAllEventsAreComplete(); Thread.Sleep(1000); }