Пример #1
0
        public void Populate()
        {
            rest = new RESTapi("http://ist.rit.edu/api");
            // Get About information
            string jsonAbout = rest.getRESTData("/about/");

            Console.WriteLine(jsonAbout);

            // Convert the JSON to an About C# object
            // use http://json2csharp.com
            // enter http://ist.rit.edu/api/about

            About about = JToken.Parse(jsonAbout).ToObject <About>();

            lbl_aboutTitle.Text = about.title;

            richTextBox1.Text = about.description;

            lbl_about_quoteAuthor.Text = about.quoteAuthor;

            textBox1.Text = about.quote;

            // Get /resources/
            string jsonRes = rest.getRESTData("/resources/");

            // Create Resources object to load the parsed JSON
            Resources resources =
                JToken.Parse(jsonRes).ToObject <Resources>();

            // Add the link text to the display
            lnkLbl_http.Text =
                resources.tutorsAndLabInformation.tutoringLabHoursLink;
        } // Populate()
        private void Research()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonResearch = baseRestURL.getRESTData("/research/");

            research = JToken.Parse(jsonResearch).ToObject <Research>();
            // Console.WriteLine(jsonResearch);

            try
            {
                for (int i = 0; i < research.byInterestArea.Count(); i++)
                {
                    listboxResearchByInterestArea.Items.Add(research.byInterestArea[i].areaName);
                }
            }
            catch (Exception)
            {
            }

            try
            {
                for (int i = 0; i < research.byFaculty.Count(); i++)
                {
                    listboxResearchByFaculty.Items.Add(research.byFaculty[i].facultyName +
                                                       " (" + research.byFaculty[i].username + ")");
                }
            }
            catch (Exception)
            {
            }
        }
        private void Minors()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonMinors = baseRestURL.getRESTData("/minors/");

            minors = JToken.Parse(jsonMinors).ToObject <Minors>();
            // Console.WriteLine(jsonMinors);

            listBoxUgMinorsName.Items.Clear();

            try
            {
                for (int i = 0; i < minors.UgMinors.Count(); i++)
                {
                    listBoxUgMinorsName.Items.Add(minors.UgMinors[i].name);
                }
            }
            catch (Exception)
            {
            }

            lblUgMinorsTitle.Text    = "";
            txtboxUgMinorsTitle.Text = "";
            txtBoxUgNote.Text        = "";
        }
Пример #4
0
        public Minors_Box(Main m)
        {
            InitializeComponent();
            f = m;

            // Get the /minors/ information from the API
            string jsonMinor = rest.getRESTData("/minors/");
            minor  minor     = JToken.Parse(jsonMinor).ToObject <minor>();

            string[] minorCourses = new string[8];  // 8 is the longest courses number

            rtb_minors.AppendText(minor.UgMinors.Find(x => x.title.Equals(f.selected_name)).title + Environment.NewLine);
            rtb_minors.AppendText(minor.UgMinors.Find(x => x.title.Equals(f.selected_name)).description + Environment.NewLine);
            rtb_minors.AppendText(Environment.NewLine + "Courses:" + Environment.NewLine);

            int count = 0;

            foreach (String course in minor.UgMinors.Find(x => x.title.Equals(f.selected_name)).courses)
            {
                minorCourses[count] = minor.UgMinors.Find(x => x.title.Equals(f.selected_name)).courses[count];
                count++;
            }
            count = 0;
            while (count < minorCourses.Length)
            {
                rtb_minors.AppendText(minorCourses[count] + Environment.NewLine);
                count++;
            }
        }
Пример #5
0
        private void Btn_people_Click(object sender, EventArgs e)
        {
            // Load the People information
            string jsonPeople = rest.getRESTData("/people/");

            // cast to a people object
            People people = JToken.Parse(jsonPeople).ToObject <People>();

            // loop through JSON array of faculty
            foreach (Faculty thisfac in people.faculty)
            {
                Console.WriteLine(thisfac.name);
                pictureBox_People.Load(thisfac.imagePath);
                comboBoxFaculty.Items.Add(thisfac.name);
                facultyNames.Add(thisfac.username);
            }

            GetSingleInstance("mjfics", people);
        }
        private void Degrees()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonDegrees = baseRestURL.getRESTData("/degrees/");

            degrees = JToken.Parse(jsonDegrees).ToObject <Degrees>();
            // Console.WriteLine(jsonDegrees);

            lblDegreesTitle.Text   = "";
            txtboxDegreesDesc.Text = "";
        }
Пример #7
0
        //---------------------About Page---------------------------------//
        public void Populate()
        {
            // Get the /about/ information from the API
            string jsonAbout = rest.getRESTData("/about/");

            // need to get the data out of the JSON string
            // into an object form that we can use
            About about = JToken.Parse(jsonAbout).ToObject <About>();

            // About title
            lbl_aboutTitle.Text        = about.title;
            rtb_desc.Text              = about.description;
            lbl_about_quoteAuthor.Text = about.quoteAuthor;
            tb_quote.Text              = about.quote;

            // get resources, a link to click on
            string jsonRes = rest.getRESTData("/resources/");

            // Get information out of the resources object
            Resources resources = JToken.Parse(jsonRes).ToObject <Resources>();

            lblLink_istLabs.Text = resources.tutorsAndLabInformation.tutoringLabHoursLink;
        }
        // AboutUs Section
        #region AboutUs
        // About Us Tab
        private void AboutUs()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");


            string jsonAbout = baseRestURL.getRESTData("/about/");

            // Console.WriteLine(jsonAbout);

            AboutUs about = JToken.Parse(jsonAbout).ToObject <AboutUs>();

            lblAboutUsTitle.Text   = about.title;
            txtboxAboutUs.Text     = '"' + about.quote + '"';
            txtboxAboutUs.Text    += " - " + about.quoteAuthor;
            txtboxAboutUsDesc.Text = about.description;
        }
        public void Populate()
        {
            rest = new RESTapi("http://ist.rit.edu/api");
            // Get About information
            string jsonAbout = rest.getRESTData("/about/");

            // Convert the JSON to an About C# object
            // use http://json2csharp.com
            // enter http://ist.rit.edu/api/about

            About about = JToken.Parse(jsonAbout).ToObject <About>();

            lbl_aboutTitle.Text             = about.title;
            richTextBox1.Text               = about.description;
            richTextBox1.SelectionAlignment = HorizontalAlignment.Center;
            lbl_about_quoteAuthor.Text      = about.quoteAuthor;
            lbl_about_quoteAuthor.TextAlign = ContentAlignment.MiddleCenter;
            textBox1.Text      = about.quote;
            textBox1.TextAlign = HorizontalAlignment.Center;
        } // Populate()
        public void News()
        {
            Random ran = new Random();

            RESTapi baseRestUrls = new RESTapi("http://ist.rit.edu/api");

            string jsonNews = baseRestUrls.getRESTData("/news/");

            Console.WriteLine(jsonNews);
            news = JToken.Parse(jsonNews).ToObject <News>();

            int minBreakingNews = ran.Next(news.older.Count());

            String desc = news.older[minBreakingNews].description;

            String title = news.older[minBreakingNews].title;

            dlgBreakingNews dlg = new dlgBreakingNews(title, desc);

            dlg.Show();
        }
        private void comboBoxCoursesDegree_SelectedIndexChanged(object sender, EventArgs e)
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonCourses = baseRestURL.getRESTData("/courses/");

            courseses = JToken.Parse(jsonCourses).ToObject <Courses[]>();
            int index = comboBoxCoursesDegree.SelectedIndex;

            dataGridViewDegreeCourses.Rows.Clear();

            try
            {
                for (int i = 0; i < courseses.Count(); i++)
                {
                    dataGridViewDegreeCourses.Rows.Add(courseses[index].courses[i]);
                }
            }
            catch (Exception)
            {
            }
        }
Пример #12
0
        public People_Box(string peoType, string uName)
        {
            InitializeComponent();

            Main f = new Main();

            string jsonPeople = rest.getRESTData("/people/");
            People people     = JToken.Parse(jsonPeople).ToObject <People>();

            // to separate the peoType into faculty and staff
            if (peoType == "faculty")
            {
                // get the /faculty/ data from api


                // get the data for rtb_peo
                rtb_peo.Text = " ";
                rtb_peo.AppendText(people.faculty.Find(x => x.name.Equals(uName)).name + Environment.NewLine);
                rtb_peo.AppendText(people.faculty.Find(x => x.name.Equals(uName)).title + Environment.NewLine);
                rtb_peo.AppendText(people.faculty.Find(x => x.name.Equals(uName)).office + Environment.NewLine);
                rtb_peo.AppendText(people.faculty.Find(x => x.name.Equals(uName)).phone + Environment.NewLine);
                rtb_peo.AppendText(people.faculty.Find(x => x.name.Equals(uName)).email + Environment.NewLine);

                // get the image for each people
                pictureBox_peo.Load(people.faculty.Find(x => x.name.Equals(uName)).imagePath);
            }
            else
            {
                // get the data for rtb_peo
                rtb_peo.Text = " ";
                rtb_peo.AppendText(people.staff.Find(x => x.name.Equals(uName)).name + Environment.NewLine);
                rtb_peo.AppendText(people.staff.Find(x => x.name.Equals(uName)).title + Environment.NewLine);
                rtb_peo.AppendText(people.staff.Find(x => x.name.Equals(uName)).email + Environment.NewLine);

                // get the image for each staff
                pictureBox_peo.Load(people.staff.Find(x => x.name.Equals(uName)).imagePath);
            }
        }
        private void People()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonPeople = baseRestURL.getRESTData("/people/");

            people = JToken.Parse(jsonPeople).ToObject <People>();

            lblPeopleFacultyMainTitle.Text = people.title;
            lblPeopleStaffMainTitle.Text   = people.title;
            lblPeopleFacultySubtitle.Text  = people.subTitle;
            lblPeopleStaffSubtitle.Text    = people.subTitle;

            try
            {
                for (int i = 0; i < people.faculty.Count(); i++)
                {
                    cbPeopleFacultyNames.Items.Add(people.faculty[i].name);
                }
            }
            catch (Exception)
            {
            }

            try
            {
                for (int i = 0; i < people.staff.Count(); i++)
                {
                    cbPeopleStaff.Items.Add(people.staff[i].name);
                }
            }
            catch (Exception)
            {
            }
            // sets first choice to 0 so it is not automatically empty at first
            cbPeopleFacultyNames.SelectedIndex = 0;
            cbPeopleStaff.SelectedIndex        = 0;
        }
        private void Course()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonCourses = baseRestURL.getRESTData("/courses/");

            courseses = JToken.Parse(jsonCourses).ToObject <Courses[]>();


            // Console.WriteLine(jsonCourses);

            try
            {
                for (int i = 0; i < courseses.Length; i++)
                {
                    comboBoxCoursesDegree.Items.Add(courseses[i].degreeName);
                    comboBoxCoursesDegree.SelectedIndex = 0;

                    // Console.WriteLine(courseses[i].degreeName);
                }
            }
            catch (Exception)
            {
            }
        }
        } // Populate()

        private void Btn_people_Enter(object sender, EventArgs e)
        {
            string jsonPeople = rest.getRESTData("/people/");

            // cast to a people object
            People people = JToken.Parse(jsonPeople).ToObject <People>();

            // loop through JSON array of faculty
            foreach (Faculty thisfac in people.faculty)
            {
                comboBoxFaculty.Items.Add(thisfac.name);
                facultyNames.Add(thisfac.username);
            }

            foreach (Staff thisStaff in people.staff)
            {
                comboBoxStaff.Items.Add(thisStaff.name);
                staffNames.Add(thisStaff.username);
            }
        }
        private void Employment()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonEmployment = baseRestURL.getRESTData("/employment/");

            employment = JToken.Parse(jsonEmployment).ToObject <Employment>();

            lblEmpIntroTitle.Text          = employment.introduction.title;
            txtBoxContentTitleAndDesc.Text = "";
            lblEmploymentTitleDesc.Text    = employment.employers.title + ": ";
            // Console.WriteLine(employment.employers.employerNames.Count());
            try
            {
                for (int i = 0; i < employment.employers.employerNames.Count(); i++)
                {
                    // Console.WriteLine(i+1);

                    if (employment.employers.employerNames.Count() == (i + 1))
                    {
                        // Console.WriteLine("Stopping at: " + i + " " + employment.employers.employerNames[i] + " ");
                        lblEmploymentTitleDesc.Text += employment.employers.employerNames[i];
                    }
                    else
                    {
                        lblEmploymentTitleDesc.Text += employment.employers.employerNames[i] + ", ";
                    }
                }
            }
            catch (Exception)
            {
            }

            // Introduction Title and Desc
            try
            {
                for (int i = 0; i < employment.introduction.content.Count(); i++)
                {
                    txtBoxContentTitleAndDesc.Text += employment.introduction.content[i].title + "\n";
                    txtBoxContentTitleAndDesc.Text += employment.introduction.content[i].description + "\n\n";
                }
            }
            catch (Exception)
            {
            }

            // CoopTable
            try
            {
                for (int i = 0; i < employment.coopTable.coopInformation.Count(); i++)
                {
                    dataGridViewCoopTable.Rows.Add(
                        employment.coopTable.coopInformation[i].employer,   // employer
                        employment.coopTable.coopInformation[i].degree,     // degree
                        employment.coopTable.coopInformation[i].city,       // city
                        employment.coopTable.coopInformation[i].term        // term
                        );
                }
            }
            catch (Exception)
            {
            }
            // sorting CoopTable A-Z
            dataGridViewCoopTable.Sort(dataGridViewCoopTable.Columns["Employer"], ListSortDirection.Ascending);
        }
Пример #17
0
        public void Populate()
        {
            // Get the /about/ information from the API
            string jsonAbout = rest.getRESTData("/about/");

            // Console.WriteLine(jsonAbout);

            // need to get the data out of the JSON string
            // into an object form that we can use
            About about = JToken.Parse(jsonAbout).ToObject <About>();

            // About title
            lbl_aboutTitle.Text        = about.title;
            lbl_aboutTitle.Font        = new Font("Trebuchet MS", 12, FontStyle.Regular);
            rtb_desc.Text              = about.description;
            lbl_about_quoteAuthor.Text = about.quoteAuthor;
            tb_quote.Text              = about.quote;
            lbl_quote.Font             = new Font("Trebuchet MS", 12, FontStyle.Regular);
        }
        private void Resources()
        {
            baseRestURL = new RESTapi("http://ist.rit.edu/api");
            string jsonResources = baseRestURL.getRESTData("/resources/");

            resources = JToken.Parse(jsonResources).ToObject <Resources>();
            // Console.WriteLine(jsonResources);

            lblStudentResourcesTitle.Text    = resources.title;
            lblStudentResourcesSubtitle.Text = resources.subTitle;

            lblResourcesStudyAbroad.Text = resources.studyAbroad.title;

            richTextBoxResourcesStudyAbroadDesc.Text = resources.studyAbroad.description;
            try
            {
                for (int i = 0; i < resources.studyAbroad.places.Count(); i++)
                {
                    richTextBoxResourcesStudyAbroadDesc.Text += "\n\n- " +
                                                                resources.studyAbroad.places[i].nameOfPlace + "\n\t" +
                                                                resources.studyAbroad.places[i].description;
                }
            }
            catch (Exception)
            {
            }

            lblResourcesTutorTitle.Text        = resources.tutorsAndLabInformation.title;
            richTextBoxResourcesTutorDesc.Text = resources.tutorsAndLabInformation.description;

            lblResourcesAdvisingAcademicTitle.Text = resources.studentServices.academicAdvisors.title;
            richtextboxAcademicAdvisorDesc.Text    = resources.studentServices.academicAdvisors.description;
            linkLblAcademicAdvisor.Text            = resources.studentServices.academicAdvisors.faq.title;

            lblResourcesAdvisingFacultyTitle.Text = resources.studentServices.facultyAdvisors.title;
            richtextboxFacultyAdvisorDesc.Text    = resources.studentServices.facultyAdvisors.description;
            // Academic Advisors

            try
            {
                for (int i = 0; i < resources.studentServices.professonalAdvisors.advisorInformation.Count(); i++)
                {
                    datagridviewResourcesAcademicAdvisor.Rows.Add(
                        resources.studentServices.professonalAdvisors.advisorInformation[i].name,             // name
                        resources.studentServices.professonalAdvisors.advisorInformation[i].department,       // department
                        resources.studentServices.professonalAdvisors.advisorInformation[i].email             // email
                        );
                }
            }
            catch (Exception)
            {
            }

            try
            {
                for (int i = 0; i < resources.studentServices.istMinorAdvising.minorAdvisorInformation.Count(); i++)
                {
                    datagridviewResourcesISTAdvisor.Rows.Add(
                        resources.studentServices.istMinorAdvising.minorAdvisorInformation[i].advisor,          // name of advisor
                        resources.studentServices.istMinorAdvising.minorAdvisorInformation[i].title,            // title (department)
                        resources.studentServices.istMinorAdvising.minorAdvisorInformation[i].email             // email
                        );
                }
            }
            catch (Exception)
            {
            }


            lblResourcesAmbassadorsTitle.Text = resources.studentAmbassadors.title;
            pictureBoxResourcesAmbassadorsPic.ImageLocation = resources.studentAmbassadors.ambassadorsImageSource;

            try
            {
                for (int i = 0; i < (resources.studentAmbassadors.subSectionContent.Count() - 1); i++)
                {
                    richTextBoxAmbassadorsContent.Text +=
                        resources.studentAmbassadors.subSectionContent[i].title + "\n";
                    richTextBoxAmbassadorsContent.Text += "- " +
                                                          resources.studentAmbassadors.subSectionContent[i].description
                                                          + "\n\n";
                }
            }
            catch (Exception)
            {
            }

            lblResourcesAmbassadorsApplyDesc.Text = resources.studentAmbassadors.subSectionContent[6].description;
            linkLabelAmbassadorsUrl.Text          = resources.studentAmbassadors.subSectionContent[6].title.ToUpper();
            lblResourcesAmbassadorNote.Text       = resources.studentAmbassadors.note;


            lblResourcesAcademicCoopInfoTitle.Text = resources.coopEnrollment.title;
            try
            {
                for (int i = 0; i < resources.coopEnrollment.enrollmentInformationContent.Count(); i++)
                {
                    richTextBoxResourcesAcademicCoopInfoDesc.Text +=
                        resources.coopEnrollment.enrollmentInformationContent[i].title + "\n";
                    richTextBoxResourcesAcademicCoopInfoDesc.Text +=
                        resources.coopEnrollment.enrollmentInformationContent[i].description + "\n\n";
                }
            }
            catch (Exception)
            {
            }


            linkLblResourcesGradOne.Text   = resources.forms.graduateForms[0].formName;
            linkLblResourcesGradTwo.Text   = resources.forms.graduateForms[1].formName;
            linkLblResourcesGradThree.Text = resources.forms.graduateForms[2].formName;
            linkLblResourcesGradFour.Text  = resources.forms.graduateForms[3].formName;
            linkLblResourcesGradFive.Text  = resources.forms.graduateForms[4].formName;
            linkLblResourcesGradSix.Text   = resources.forms.graduateForms[5].formName;
            linkLblResourcesGradSeven.Text = resources.forms.graduateForms[6].formName;

            linkLblResourcesUnderOne.Text = resources.forms.undergraduateForms[0].formName;
        }