示例#1
0
        public ExcelClassSettings Clone()
        {
            ExcelClassSettings Clone = new ExcelClassSettings
            {
                Export                      = Export,
                TemplateFileName            = TemplateFileName,
                TemplateDirectory           = TemplateDirectory,
                SaveFileName                = SaveFileName,
                SaveFileDirectory           = SaveFileDirectory,
                SaveFileNameIncludesQuarter = SaveFileNameIncludesQuarter,
                ExportSID                   = ExportSID,
                SIDColumnLetter             = SIDColumnLetter,
                SIDLast4ColumnLetter        = SIDLast4ColumnLetter,
                ExportSIDLast4              = ExportSIDLast4,
                ExportMiddleInitial         = ExportMiddleInitial,
                LastNameColumnLetter        = LastNameColumnLetter,
                FirstNameColumnLetter       = FirstNameColumnLetter,
                ItemCell                    = ItemCell,
                FirstStudent                = FirstStudent,
                OptHead1ColumnLetter        = OptHead1ColumnLetter,
                ExportoptHead1              = ExportoptHead1,
                OptHead2ColumnLetter        = OptHead2ColumnLetter,
                ExportoptHead2              = ExportoptHead2,
                OptHead3ColumnLetter        = OptHead3ColumnLetter,
                ExportoptHead3              = ExportoptHead3
            };

            return(Clone);
        }
示例#2
0
        internal void AddTestData()
        {
            ExcelClassSettings ExcelClassSettings = new ExcelClassSettings();

            Add("", "MICHAEL JENCK", "MATH 075", "2121", "A782", "Fall 2008", ExcelClassSettings).Export = true;
            Add("", "MICHAEL JENCK", "MATH 075", "2122", "A782", "Fall 2008", ExcelClassSettings).Export = true;
            Add("", "MICHAEL JENCK", "MATH 075", "2123", "A782", "Fall 2008", ExcelClassSettings).Export = true;
        }
示例#3
0
        private Course Add(String RawHTML, String InstructorName, String CourseName,
                           String ItemNumber, String YRQ, String QuarterName, ExcelClassSettings ExcelClassSettings)
        {
            Course value = new Course(RawHTML, InstructorName, CourseName, ItemNumber, YRQ, QuarterName, ExcelClassSettings);

            this.List.Add(value);
            return(value);
        }
示例#4
0
        //private readonly HeaderColumn Phone;

        public Course(string RawHTML, string InstructorName, string CourseName,
                      string ItemNumber, string YRQ, string QuarterName, ExcelClassSettings ExcelClassSettings)
        {
            SchoolHeaders     = new OptionHeaders();
            StrInstructorName = InstructorName;
            StrCourseName     = CourseName;
            StrItemNumber     = ItemNumber;
            StrYRQ            = YRQ;
            StrQuarterName    = QuarterName;
            // Set to export
            blnExport = true;

            if (RawHTML != "")
            {
                ExtractValue EV = new ExtractValue();
                StrTitle   = EV.FromJavaScript(RawHTML, "title", "'", "'");
                StrSection = EV.FromJavaScript(RawHTML, "sect", "'", "'");
                StrCredits = EV.FromJavaScript(RawHTML, "credit", "'", "'");

                StrRoom      = EV.FromJavaScript(RawHTML, "room", "'", "'");
                StrStartTime = EV.FromJavaScript(RawHTML, "strtTime", "'", "'");
                StrEndTime   = EV.FromJavaScript(RawHTML, "endTime", "'", "'");
                StrDays      = EV.FromJavaScript(RawHTML, "days", "'", "'");
                StrStartDate = EV.FromJavaScript(RawHTML, "strtDate", "'", "'");
                StrTenthDate = EV.FromJavaScript(RawHTML, "tenDay", "'", "'");

                StrOpt1Header  = EV.FromJavaScript(RawHTML, "optHead1", "'", "'");
                StrOpt2Header  = EV.FromJavaScript(RawHTML, "optHead2", "'", "'");
                StrOpt3Header  = EV.FromJavaScript(RawHTML, "optHead3", "'", "'");
                StrOptWlHeader = EV.FromJavaScript(RawHTML, "optWLHead", "'", "'");

                if (SaveOptionHeader)
                {
                    ExcelClassSettings.HeaderNames.Header1        = StrOpt1Header;
                    ExcelClassSettings.HeaderNames.Header2        = StrOpt2Header;
                    ExcelClassSettings.HeaderNames.Header3        = StrOpt3Header;
                    ExcelClassSettings.HeaderNames.WaitListHeader = StrOptWlHeader;
                    SaveOptionHeader = false;
                }

                int Count = Convert.ToInt32(EV.FromJavaScript(RawHTML, "totStu", "'", "'"));
                myStudents = new Student[Count];

                Count      = Convert.ToInt32(EV.FromJavaScript(RawHTML, "totStuWl", "'", "'"));
                myWaitlist = new Student[Count];

                // Extract all students from RawHTML
                ProcessStudentsFromHTML(RawHTML, ExcelClassSettings.HeaderNames);
            }
        }
示例#5
0
        public void AddFromCIS(CISLogin MyLogin, ExcelClassSettings ExcelClassSettings, string ActionURL)
        {
            SendMessage(this, new Information("Retrieving Course URL."));

            // Create the http request string for the Instructor
            string HTTPCoursesRequest = MyLogin.HTTPCoursesRequestString;

            SendMessage(this, new Information(HTTPCoursesRequest));

            // Retrieve the Web page with the courses information
            CISWebRequest myWebRequest = new CISWebRequest();
            string        HTTPCourses  = myWebRequest.RetrieveHTMLPage(ActionURL, HTTPCoursesRequest, CISWebRequest.HTMLRequestType.POST, 5000);

            if (HTTPCourses.ToLower().IndexOf("service unavailable") > 0)
            {
                SendMessage(this, new Information(HTTPCourses));
                throw new Exception("Service is unavailable.");
            }
            else if (HTTPCourses.ToLower().IndexOf("pin") > 0)
            {
                SendMessage(this, new Information(HTTPCourses));
                throw new Exception("You have entered an incorrect Employee ID or PIN.");
            }
            else
            {
                SendMessage(this, new Information(HTTPCourses));
            }

            // Extract ticket
            ExtractValue EV          = new ExtractValue();
            string       ticketvalue = EV.FromJavaScript(HTTPCourses, JavaTicketVariable, "'", "'");

            SendMessage(this, new Information("Found Ticket Value " + ticketvalue));

            // Extract Number of classes
            string InstructorName = EV.FromJavaScript(HTTPCourses, JavaInstructorVariable, "'", "'");

            SendMessage(this, new Information("Found Instructor Name " + InstructorName));

            string RawHTML;
            string HTTPRequestString;
            String CourseName;
            String ItemNumber;
            int    Start;
            int    End;
            int    HTTPStart = HTTPCourses.IndexOf(JavaRosterVariable);

            if (HTTPStart >= 0)
            {
                int[] ArrayStart = new int[10];  // list of starting points for courses
                int[] ArrayEnd   = new int[10];  // list of ending points for courses

                int CourseIndex = 0;             // number of courses

                do
                {
                    ArrayStart[CourseIndex] = HTTPStart;
                    ArrayEnd[CourseIndex]   = HTTPCourses.IndexOf(")", HTTPStart);
                    CourseIndex++;
                    HTTPStart = HTTPCourses.IndexOf(JavaRosterVariable, HTTPStart + 1);
                } while ((HTTPStart > 0) && (CourseIndex < 11));

                for (int i = 0; i < CourseIndex; i++)
                {
                    HTTPStart = ArrayStart[i];
                    End       = ArrayEnd[i];
                    String OneCourse = HTTPCourses.Substring(HTTPStart, End - HTTPStart);
                    Start      = OneCourse.IndexOf("'") + 1; // don't include the '
                    End        = OneCourse.IndexOf("'", Start + 1);
                    ItemNumber = OneCourse.Substring(Start, End - Start);

                    Start      = OneCourse.IndexOf("'", End + 1) + 1;
                    End        = OneCourse.IndexOf("'", Start + 1);
                    CourseName = OneCourse.Substring(Start, End - Start).Trim();

                    SendMessage(this, new Information("\r\n\nFound Course " + ItemNumber + " - " + CourseName));

                    // get request String
                    CISCourse myCISCourses = new CISCourse(ItemNumber, ticketvalue, MyLogin.Quarter.YRQ);
                    HTTPRequestString = myCISCourses.HTTPRequestString;
                    try
                    {
                        // retrieve class data
                        RawHTML = myWebRequest.RetrieveHTMLPage(ActionURL, HTTPRequestString, CISWebRequest.HTMLRequestType.POST, 5000);
                    }
                    catch (Exception Ex)
                    {
                        string ErrorMessage = Ex.Message;
                        if (ErrorMessage.IndexOf("403", 0) > 0)
                        {
                            // Error forbidden
                            SendMessage(this, new Information(CourseName + " " + ItemNumber + " " + Ex.Message));

                            // try again
                            RawHTML = myWebRequest.RetrieveHTMLPage(ActionURL, HTTPRequestString, CISWebRequest.HTMLRequestType.POST, 5000);
                        }
                        else
                        {
                            // fail
                            throw;
                        }
                    }

                    SendMessage(this, new Information(RawHTML));

                    this.Add(RawHTML, InstructorName, CourseName, ItemNumber, MyLogin.Quarter.YRQ, MyLogin.Quarter.Name, ExcelClassSettings);
                }
            }
            else
            {
                // error no courses found
                SendMessage(this, new Information(HTTPCourses));
                throw new Exception("No courses found for " + MyLogin.Quarter.Name + " which I have a YRQ " + MyLogin.Quarter.YRQ);
            }
        }