/// /// CREATE AN ACCOUNT FOR THIS INSTRUCTOR /// public void CreateAccount() { string url = @"principal-update&first-name=" + _first_name + "&last-name=" + _last_name + "&login="******"&password=byuitemp123&type=user&send-email=true&has-children=0&email=" + _email; string pid = ""; string url2 = @"group-membership-update&group-id=" + Program._xDoc.SelectSingleNode("//*[@id='_6']").InnerText + "&is-member=true&principal-id="; XmlDocument xmlDoc = API.GetXMLRequest(url); string attrVal = xmlDoc.SelectSingleNode("/results/status/@code").Value; if (attrVal != "ok") { LogInformation.AddLineToLogInformation("Error", "Error returned from Adobe Connect when creating an instructor account for " + _last_name + ", " + _first_name); AsyncTracker.EventDone(); return; } pid = xmlDoc.SelectSingleNode("/results/principal/@principal-id").Value; xmlDoc = API.GetXMLRequest(url2 + pid); CreateOffice(); }
/// /// PLACE PERMISSIONS ON THE MEETING AND THE INSTRUCTOR /// public void SetPermissions() { string url = @"permissions-update&principal-id=" + Program._xDoc.SelectSingleNode("//*[@id='_4']").InnerText + "&acl-id=" + _sco_id + "&permission-id=host"; string url2 = @"permissions-update&acl-id=" + _sco_id + "&principal-id=public-access&permission-id=view-hidden"; XmlDocument xmlDoc = API.GetXMLRequest(url); string attrVal = xmlDoc.SelectSingleNode("/results/status/@code").Value; if (attrVal != "ok") { LogInformation.AddLineToLogInformation("Error", "Error returned from Adobe Connect when setting the first permission (meeting host) for the instructor: " + _last_name + ", " + _first_name); AsyncTracker.EventDone(); return; } xmlDoc = API.GetXMLRequest(url2); attrVal = xmlDoc.SelectSingleNode("/results/status/@code").Value; AsyncTracker.EventDone(); if (attrVal != "ok") { LogInformation.AddLineToLogInformation("Error", "Error returned from Adobe Connect when setting the second permission (public access) for the instructor: " + _last_name + ", " + _first_name); return; } _bgw.ReportProgress(1); AsyncTracker.EventDone(); }
///////////////////////////// // SECTION LEVEL FUNCTIONS // ///////////////////////////// /// /// SECTION MEETING CREATION /// public void CreateSetMeetings(string course) { string set; if (_section_indicator.Length < 2) { set = "G00" + _section_indicator; } else if (_section_indicator.Length < 3) { set = "G0" + _section_indicator; } else { set = "G" + _section_indicator; } string name = course.Replace("_", "") + "_" + set + "_"; for (int i = 1; i <= _number_of_meetings; i++) { string tag; if (i < 10) { tag = name + "00" + i; } else if (i < 100) { tag = name + "0" + i; } else { tag = name + i; } string path = @"sco-update&type=meeting&name=" + tag.ToUpper() + "&folder-id=" + _folder_id + "&date-begin=" + DateTime.UtcNow.ToString("s") + "&date-end=" + DateTime.UtcNow.AddHours(1).ToString("s") + "&url-path=" + tag.ToLower() + "&principal-id=public-access&permission-id=view-hidden"; XmlDocument xmlDoc = API.GetXMLRequest(path); string attrVal = xmlDoc.SelectSingleNode("/results/status/@code").Value; if (attrVal != "ok") { LogInformation.AddLineToLogInformation("Error", "Error returned from Adobe Connect when creating section meetings for " + _section_indicator + " in " + course); AsyncTracker.EventDone(); return; } XmlNodeList item = xmlDoc.GetElementsByTagName("sco"); _meeting_id = item[0].Attributes["sco-id"].Value; EnrollInstructor(); _bgw.ReportProgress(1); AsyncTracker.EventDone(); } }
/// /// CREATE THE SECTION FOLDERS WITHIN THE COURSE FOLDER /// public void SetFolderCreation() { XmlDocument xmlDoc = API.GetXMLRequest(_set_url); string attrVal = xmlDoc.SelectSingleNode("/results/status/@code").Value; if (attrVal != "ok") { LogInformation.AddLineToLogInformation("Error", "Error returned from Adobe Connect when creating a section folder for the course: " + _name); AsyncTracker.EventDone(); return; } for (int i = 0; i < _sections.Count; i++) { bool valid = true; Section section = _sections[i]; string set = (section.GetSectionIndicator().Length < 2 ? "SET_0" : "SET_") + section.GetSectionIndicator(); XmlNodeList itemRefList = xmlDoc.GetElementsByTagName("sco"); foreach (XmlNode xn in itemRefList) { if (xn.FirstChild.InnerText == set) { LogInformation.AddLineToLogInformation("Error", "Section " + _sections[i].GetSectionIndicator() + " for " + _name + " already exists and was skipped."); for (int k = 0; k < _sections[i].GetNumberOfMeetings(); k++) { AsyncTracker.EventDone(); } valid = false; } } if (valid) { string path2 = @"sco-update&type=folder&name=" + (section.GetSectionIndicator().Length < 2 ? "SET_0" : "SET_") + section.GetSectionIndicator() + "&folder-id=" + _sco_id + "&depth=1"; xmlDoc = API.GetXMLRequest(path2); attrVal = xmlDoc.SelectSingleNode("/results/status/@code").Value; if (attrVal != "ok") { LogInformation.AddLineToLogInformation("Error", "Error returned from Adobe Connect when creating an section folder for the course: " + _name); AsyncTracker.EventDone(); return; } XmlNodeList item2 = xmlDoc.GetElementsByTagName("sco"); string folderId = item2[0].Attributes["sco-id"].Value; _sections[i].SetFolderId(folderId); _sections[i].CreateSetMeetings(_name); } } }
/// /// EABLE BUTTONS AND RESET PROGRESS BAR WHEN THE BACKGROUND WORKER FINISHES /// void meeting_worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { progressBar.Value = 0; progressBar.Refresh(); AsyncTracker.ResetTracker(); Program._process.Hide(); Program._logInformation.Show(); }
/// /// 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 AN OFFICE FOR THIS INSTRUCTOR /// public void CreateOffice() { string officePath = _office_name.ToLower(); string url = @"sco-update&type=meeting&name=" + _office_name + "&folder-id=" + Program._xDoc.SelectSingleNode("//*[@id='_5']").InnerText + "&date-begin=" + DateTime.UtcNow.ToString("s") + "Z" + "&date-end=" + DateTime.UtcNow.AddHours(1).ToString("s") + "Z" + "&url-path=" + officePath + "&principal-id=public-access&permission-id=view-hidden"; XmlDocument xmlDoc = API.GetXMLRequest(url); string attrVal = xmlDoc.SelectSingleNode("/results/status/@code").Value; if (attrVal != "ok") { LogInformation.AddLineToLogInformation("Error", "Error returned from Adobe Connect when creating an instructor office for " + _last_name + ", " + _first_name); AsyncTracker.EventDone(); return; } _sco_id = xmlDoc.SelectSingleNode("results/sco/@sco-id").Value; SetPermissions(); }
/// /// 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); }