示例#1
0
        //Methods for Retreiving data from API
        public Admin getAdmin(int ID)
        {
            String json  = APIProxy.GetFromAPI(String.Format("{0}?team=general&function=getAdmin&adminID={1}", API_URL, ID)).Result;
            Admin  admin = (Admin)ModelFactory.createModelFromJson("admin", json);

            return(admin);
        }
示例#2
0
        public Term[] getTerms()
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getTerms", API_URL)).Result;

            Term[] terms = (Term[])ModelFactory.createModelArrayFromJson("term", json);
            return(terms);
        }
示例#3
0
        public Book getBook(int ID)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=book_store&function=getBook&bookID={1}", API_URL, ID)).Result;
            Book   book = (Book)ModelFactory.createModelFromJson("book", json);

            return(book);
        }
示例#4
0
        public Student getStudent(int ID)
        {
            String  json    = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getStudentUser&userID={1}", API_URL, ID)).Result;
            Student student = (Student)ModelFactory.createModelFromJson("student", json);

            return(student);
        }
示例#5
0
        public Term getTerm(String termCode)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getTerm&termCode={1}", API_URL, termCode)).Result;
            Term   term = (Term)ModelFactory.createModelFromJson("term", json);

            return(term);
        }
示例#6
0
        public Location getLocation(int ID) // TODO: Wait for a getRoom location in the API
        {
            String   json     = APIProxy.GetFromAPI(String.Format("{0}?team=facility_management&function=getClassroom&id={1}", API_URL, ID)).Result;
            Location location = (Location)ModelFactory.createModelFromJson("location", json);

            return(location);
        }
示例#7
0
        public User getUser(int ID)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=general&function=getUser&userID={1}", API_URL, ID)).Result;
            User   user = (User)ModelFactory.createModelFromJson("user", json);

            return(user);
        }
示例#8
0
        public Instructor getInstructor(int ID)
        {
            String     json       = APIProxy.GetFromAPI(String.Format("{0}?team=general&function=getUser&userID={1}", API_URL, ID)).Result;
            Instructor instructor = (Instructor)ModelFactory.createModelFromJson("instructor", json);

            return(instructor);
        }
示例#9
0
        public string getQuote()
        {
            string  json     = APIProxy.GetFromAPI("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1").Result;
            dynamic contents = JsonConvert.DeserializeObject(json);

            return(contents.First.content);
        }
示例#10
0
        public Course getCourse(int ID)
        {
            String json   = APIProxy.GetFromAPI(String.Format("{0}?team=general&function=getCourse&courseID={1}", API_URL, ID)).Result;
            Course course = (Course)ModelFactory.createModelFromJson("course", json);

            return(course);
        }
示例#11
0
        public Section[] getCourseSections(Course course)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getCourseSections&courseID={1}", API_URL, course.ID)).Result;

            Section[] sections = (Section[])ModelFactory.createModelArrayFromJson("section", json);

            return(sections);
        }
示例#12
0
        public Course[] getCourseList()
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getCourseList", API_URL)).Result;

            Course[] courses = (Course[])ModelFactory.createModelArrayFromJson("course", json);

            return(courses);
        }
示例#13
0
        //Returning arrays of Model objects from tables of IDs
        public Student[] getSectionStudents(Section section)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getSectionEnrolled&sectionID={1}", API_URL, section.ID)).Result;

            String[]       studentIDs = ModelFactory.createIDListFromJson("student", json);
            List <Student> students   = new List <Student>();

            foreach (String studentID in studentIDs)
            {
                students.Add(getStudent(Convert.ToInt32(studentID)));
            }
            return(students.ToArray());
        }
示例#14
0
        public Term getCurrentTerm()
        {
            String      json        = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getTerms", API_URL)).Result;
            List <Term> terms       = ((Term[])ModelFactory.createModelArrayFromJson("term", json)).ToList();
            DateTime    currentDate = DateTime.Now;
            Term        currentTerm = null;

            if (terms.Exists(x => x.StartDate <= currentDate && x.EndDate >= currentDate))
            {
                currentTerm = terms.Find(x => x.StartDate <= currentDate && x.EndDate >= currentDate);
            }
            return(currentTerm);
        }
示例#15
0
        public Section[] getInstructorSectionsByID(int id)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getProfessorSections&professorID={1}", API_URL, id)).Result;

            String[]       ids      = ModelFactory.createIDListFromJson("sectionInstructor", json);
            List <Section> sections = new List <Section>();

            foreach (String str in ids)
            {
                sections.Add(this.getSection(Convert.ToInt32(str)));
            }
            return(sections.ToArray());
        }
示例#16
0
        public Course[] getCoursePrereqs(Course course)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getPrereqs&courseID={1}", API_URL, course.ID)).Result;

            String[]      courseIDs = ModelFactory.createIDListFromJson("course", json);
            List <Course> courses   = new List <Course>();

            foreach (String courseID in courseIDs)
            {
                courses.Add(getCourse(Convert.ToInt32(courseID)));
            }
            return(courses.ToArray());
        }
示例#17
0
        public Section[] getStudentWaitlists(Student student)
        {
            String json = APIProxy.GetFromAPI(String.Format("{0}?team=student_enrollment&function=getStudentWaitlist&studentID={1}", API_URL, student.ID)).Result;

            String[]       ids      = ModelFactory.createIDListFromJson("section", json);
            List <Section> sections = new List <Section>();

            foreach (String str in ids)
            {
                sections.Add(this.getSection(Convert.ToInt32(str)));
            }
            return(sections.ToArray());
        }