예제 #1
0
        public override string toCSV(Year yr, Semester sm, string program, string code, string key, bool isreq)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(csvFormat, key);                              //Key
            sb.AppendFormat(csvFormat, code);                             //ProgramCode
            sb.AppendFormat(csvFormat, program);                          //ProgramDescription
            sb.AppendFormat(csvFormat, Department);                       //Subject
            sb.AppendFormat(csvFormat, Number);                           //CourseNum
            sb.AppendFormat(csvFormat, yr != null ? yr.Level : "");       //stdClass
            sb.AppendFormat(csvFormat, sm != null ? sm.Description : ""); //Semester
            sb.AppendFormat(csvFormat, Note);                             //Note
            sb.AppendFormat(csvFormat, "");                               //AND
            sb.AppendFormat(csvFormat, "");                               //OR
            sb.AppendFormat(csvFormat, Credits);                          //Credit
            sb.AppendFormat(csvFormat, GetCreditNum());                   //Creditnum
            sb.AppendFormat(csvFormat, "");                               //Critical
            sb.AppendFormat(csvFormat, "");                               //AUCC_4A
            sb.AppendFormat(csvFormat, "");                               //AUCC_4B
            sb.AppendFormat(csvFormat, "");                               //AUCC_4C
            sb.AppendFormat(csvFormat, "");                               //Recommended
            sb.AppendFormat(csvFormat, "");                               //SelectFrom
            sb.AppendFormat(csvFormat, "");                               //AKA
            sb.AppendFormat(csvFormat, "");                               //IsCourse
            sb.AppendFormat(csvFormat, GetAUCC());                        //Memo
            if (isreq)                                                    //Footnotes
            {
                sb.AppendFormat(csvFormat, Footnotes);
            }
            sb.AppendLine();

            foreach (GenericCourse crs in Courses)
            {
                sb.Append(crs.toCSV(yr, sm, program, code, key));
            }

            return(sb.ToString());
        }
 public override string toCSV(Year yr, Semester sm, string program, string code, string key, bool isreq = false)
 {
     throw new NotImplementedException();
 }
 public abstract string toCSV(Year yr, Semester sm, string program, string code, string key, bool isreq = false);
        private void loadMajorCompletion()
        {
            //Query for all table rows in the major completion table
            List <HtmlNode> found = _scraper.query("//table[@class='sc_mcgrid']//tr");

            if (found == null || found.Count == 0)
            {
                return;
            }
            //Mark that this degree program has a completion map on the page.
            HasCompletionMap = true;

            string msg = "Loading Major Completion for " + Program + ", " + Level + ", " + string.Join(" ", DegreeType);

            msg = msg.Substring(0, (msg.Length < 125 ? msg.Length : 125));
            if (printStatus)
            {
                Console.Write(String.Format("{0, -125} | ", msg) + "\t\t");
            }

            CompletionInfo = GetAdditionalRequirements("majorcompletionmaptextcontainer");

            Year     yr = null;
            Semester sm = null;

            HtmlNode n = null;

            for (int i = 0; i < found.Count; i++)
            {
                n = found[i];
                if (n.HasClass("hidden") || n.ParentNode.Name == "thead")
                {
                    continue;
                }
                //If this is the level row (FRESHMAN | SOPHOMORE | JUNIOR | SENIOR)
                if (n.HasClass("plangridyear"))
                {
                    //Add the year, which by this point has been filled out with each course, to the completion map
                    if (yr != null)
                    {
                        CompletionMap.Add(yr);
                    }
                    //Start the next year with the level found in this row
                    yr = new Year(n.InnerText.Trim());
                }
                //If this is the term row (SEMESTER #)
                else if (n.HasClass("plangridterm"))
                {
                    //Start the next semester
                    sm = new Semester(n.FirstChild.InnerText.Trim());
                }
                //If this is the credit sum (of the semester) row
                else if (n.HasClass("plangridsum"))
                {
                    //Add the total credits to the semester
                    sm.Credits = n.LastChild.InnerText.Trim();
                    //Add the semester to the year
                    if (sm != null)
                    {
                        yr.AddSemester(sm);
                    }
                }
                //If this is the credit total row OR is marked as the last row
                else if (n.HasClass("plangridtotal") && n.HasClass("lastrow"))
                {
                    //Grab the total credits required for this program
                    this.Credits = n.LastChild.InnerText;
                    //Add the final year to the degree map.
                    if (yr != null)
                    {
                        CompletionMap.Add(yr);
                    }
                    break;
                }
                //Otherwise this is a course row of some sort.
                else
                {
                    sm.AddCourse(Course.GetCourse(found, ref i));
                }
            }
            if (printStatus)
            {
                Console.WriteLine(CompletionMap.Count + " Years found");
            }
        }