///
        /// 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();
        }
Exemplo n.º 3
0
        /////////////////////////////
        // 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();
            }
        }
Exemplo n.º 4
0
        ///
        /// 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);
                }
            }
        }
Exemplo n.º 5
0
        ///
        /// 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);
        }
Exemplo n.º 6
0
        ///
        /// RETURN A LIST OF INSTRUCTORS FROM A SPECIFIED EXCEL WORKBOOK
        ///
        public static List <Instructor> GetInstructorListFromExcelSpreadsheet(string file)
        {
            if (!ValidExcelDocument(file))
            {
                return(null);
            }

            List <Instructor> listOfInstructors = new List <Instructor>();

            _excelDocument = new SLDocument(file);
            _stats         = _excelDocument.GetWorksheetStatistics();

            string columnOne   = _excelDocument.GetCellValueAsString(1, 1).ToLower();
            string columnTwo   = _excelDocument.GetCellValueAsString(1, 2).ToLower();
            string columnThree = _excelDocument.GetCellValueAsString(1, 3).ToLower();

            if (columnOne != "first name" || columnTwo != "last name" || columnThree != "email")
            {
                LogInformation.AddLineToLogInformation("Error", "The first row of the spreadsheet must have the following columns: first name | last name | email");
                return(null);
            }

            int end = _stats.EndRowIndex + 1;

            for (int i = 2; i < end; i++)
            {
                string first = _excelDocument.GetCellValueAsString(i, 1);
                string last  = _excelDocument.GetCellValueAsString(i, 2);
                string email = _excelDocument.GetCellValueAsString(i, 3);
                if (first != "" && last != "" && email != "")
                {
                    Instructor inst = new Instructor(first, last, email);
                    listOfInstructors.Add(inst);
                }
                else
                {
                    LogInformation.AddLineToLogInformation("Error", "Row " + i + " is missing information and was skipped.");
                }
            }

            return(listOfInstructors);
        }
Exemplo n.º 7
0
 ///
 /// SETUP UP ALL OF THE FORM INITIALLY
 ///
 private static void SetForms()
 {
     _mainMenu                  = new MainMenu();
     _instructorOffices         = new InstructorOffices();
     _instructorOfficesTemplate = new InstructorOfficesTemplate();
     _processInstructorOffices  = new ProcessInstructorOffices();
     _courseList                = new CourseList();
     _replaceCourseList         = new ReplaceCourseList();
     _courseListTemplate        = new CourseListTemplate();
     _processCourseList         = new ProcessCourseList();
     _courseGroups              = new CourseGroups();
     _courseGroupsTemplate      = new CourseGroupsTemplate();
     _processCourseGroups       = new ProcessCourseGroups();
     _process                   = new Process();
     _saveFileDialog            = new SaveFileDialog();
     _saveFileDialog.DefaultExt = "xlsx";
     _saveFileDialog.Filter     = "Excel Workbook (.xlsx)|*.xlsx";
     _openFileDialog            = new OpenFileDialog();
     _openFileDialog.DefaultExt = "xlsx";
     _openFileDialog.Filter     = "Excel Workbook (.xlsx)|*.xlsx";
     _logInformation            = new LogInformation();
 }
        ///
        /// 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();
        }
Exemplo n.º 9
0
        ///
        /// 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);
        }
Exemplo n.º 10
0
        ///
        /// RETURN A LIST OF COURSES FROM A SPECIFIED EXCEL WORKBOOK
        ///
        public static List <Course> GetCourseListFromExcelSpreadsheet(string file)
        {
            if (!ValidExcelDocument(file))
            {
                LogInformation.AddLineToLogInformation("Error", "The file must be an Excel file with the extension .xlsx");
                return(null);
            }

            _excelDocument = new SLDocument(file);
            _stats         = _excelDocument.GetWorksheetStatistics();

            string columnOne   = _excelDocument.GetCellValueAsString(1, 1).ToLower();
            string columnTwo   = _excelDocument.GetCellValueAsString(1, 2).ToLower();
            string columnThree = _excelDocument.GetCellValueAsString(1, 3).ToLower();

            if (columnOne != "course name" || columnTwo != "section" || columnThree != "number of meetings")
            {
                LogInformation.AddLineToLogInformation("Error", "The first row of the spreadsheet must have the following columns: course name | section | number of meetings");
                return(null);
            }

            List <Course> listOfCourses = new List <Course>();

            int end = _stats.EndRowIndex + 1;

            for (int i = 2; i < end; i++)
            {
                bool   valid            = true;
                string name             = _excelDocument.GetCellValueAsString(i, 1).ToUpper();
                string section          = _excelDocument.GetCellValueAsString(i, 2);
                int    numberOfMeetings = _excelDocument.GetCellValueAsInt32(i, 3);

                if (name == "")
                {
                    LogInformation.AddLineToLogInformation("Error", "Row " + i + " is missing the name of the course and was skipped.");
                    valid = false;
                }

                if (section == "")
                {
                    LogInformation.AddLineToLogInformation("Error", "Row " + i + " is missing the section and was skipped.");
                    valid = false;
                }

                if (valid)
                {
                    List <Section> sections = new List <Section>();
                    Section        s        = new Section(section, numberOfMeetings);
                    sections.Add(s);
                    Course c = new Course(name, sections, numberOfMeetings);
                    if (listOfCourses.Contains(c))
                    {
                        int idx = listOfCourses.IndexOf(c);
                        listOfCourses[idx].AddSections(sections);
                    }
                    else
                    {
                        listOfCourses.Add(c);
                    }
                }
            }

            return(listOfCourses);
        }