コード例 #1
0
        public List <CourseLists> Get()
        {
            var reader  = this.GetReader($"select * from CourseLists  ");
            var courses = new List <CourseLists>();

            while (reader.Read())
            {
                var course = new CourseLists();
                course.CourseListId = reader.GetInt32(0);
                course.CourseName   = reader.GetString(1);
                course.Description  = reader.GetString(2);
                course.Type         = reader.GetBoolean(3);
                course.Price        = reader.GetString(4);

                courses.Add(course);
            }
            return(courses);
        }
コード例 #2
0
 public IActionResult Post(CourseLists courseLists)
 {
     CourseListDomain.Add(courseLists);
     return(Ok());
 }
コード例 #3
0
 public void Add(CourseLists courseLists)
 {
     this.ExecuteNonQuery($"insert into CourseLists  values('{courseLists.CourseName}','{courseLists .Description}','{courseLists.Type }','{courseLists.Price}')");
 }
コード例 #4
0
        private void loadFromCourseList(List <HtmlNode> found)
        {
            this.SetupRequirements();

            CourseList    cl  = null;
            HtmlNode      n   = null;
            GenericCourse crs = null;

            //if (ProgramTitle == "Minor in Agricultural Business") Debugger.Break();
            for (int i = 0; i < found.Count; i++)
            {
                n = found[i];

                if (n.HasClass("hidden") || n.ParentNode.Name == "thead")
                {
                    continue;
                }

                if (n.HasClass("orclass"))
                {
                    string orCrs = n.FirstChild.InnerText;
                    if (orCrs.Contains("or"))
                    {
                        int orIndex = orCrs.IndexOf("or") + 2;
                        orCrs = orCrs.Substring(orIndex, orCrs.Length - orIndex).Trim();
                    }
                    cl.Courses[cl.Courses.Count - 1].OR = orCrs;
                    continue;
                }

                if (n.HasClass("firstrow"))
                {
                    cl = new CourseList();
                }
                else if (n.HasClass("listsum"))
                {
                    if (cl != null)
                    {
                        CourseLists.Add(cl);
                    }

                    if (Credits == null /*|| int.Parse(Credits) < int.Parse(n.LastChild.InnerText)*/)
                    {
                        this.Credits = n.LastChild.InnerText;
                    }

                    continue;
                }

                if (n.HasClass("areaheader"))
                {
                    string[] desc_footnums = Course.getDescAndFootnotes(n);
                    crs           = new ProgramInfo(desc_footnums[0], false, false);
                    crs.Footnotes = desc_footnums[1];
                }
                else
                {
                    crs = Course.GetCourse(found, ref i);
                }


                //TODO: Write a function for getting all footnotes at once.
                if (crs != null)
                {
                    cl.AddCourse(crs);
                }
            }

            if (printStatus)
            {
                Console.WriteLine(CourseLists.Count + " Requirements<Course Lists> found");
            }
        }