private Research loadData()
        {
            if (research == null)
            {
                string jsonResearch = rest.getRESTData("/research/");
                research = JToken.Parse(jsonResearch).ToObject <Research>();
            }

            return(research);
        }
Пример #2
0
        // Change body view to Research section when "RESEARCH" is clicked
        private void research_btn_Click(object sender, EventArgs e)
        {
            processButtons(sender);

            body.SelectedTab = research_tab;

            // Ensure we have the data, fetch if we don't
            if (research == null)
            {
                Console.WriteLine("Loading research...");
                string jsonResearch = rj.getRestJSON("/research/");
                research = JToken.Parse(jsonResearch).ToObject <Research>();

                // Dynamically load research by interest area
                int row    = 0;
                int column = 0;
                for (int i = 0; i < research.byInterestArea.Count; i++)
                {
                    ByInterestArea area = research.byInterestArea[i];

                    Label areaName = new Label();
                    areaName.Text        = area.areaName;
                    areaName.MouseEnter += (sender2, e2) => changeCellColor(sender2, e2);
                    areaName.MouseLeave += (sender3, e3) => changeCellColor(sender3, e3);
                    areaName.Margin      = new Padding(0, 0, areaName.Margin.Right, areaName.Margin.Right);
                    areaName.BorderStyle = BorderStyle.FixedSingle;
                    areaName.TextAlign   = ContentAlignment.MiddleCenter;
                    areaName.Anchor      = (AnchorStyles.Left | AnchorStyles.Right);

                    interestareas.Controls.Add(areaName, column, row);

                    // Set onclick event handler to show degree details in popup
                    areaName.Click += (sender4, e4) => showResearchPopup(sender4, e4, area);

                    // Jump to next row if current row is full
                    if ((i + 1) % 3 == 0)
                    {
                        row++;
                        column = 0;
                    }
                    else
                    {
                        column++;
                    }
                }

                // Resize rows
                foreach (RowStyle style in interestareas.RowStyles)
                {
                    style.SizeType = SizeType.AutoSize;
                }
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            Populate();
            //Get the objects...
            //get employment

            string jsonEmp = rj.getJSON("/employment/");

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

            lbl_emp_int_title.Text  = employment.introduction.title;
            lbl_emp_cnt_title.Text  = employment.introduction.content[0].title;
            txt_emp_cnt_desc.Text   = employment.introduction.content[0].description;
            lbl_emp_cnt_title2.Text = employment.introduction.content[1].title;
            txt_emp_cnt2_desc.Text  = employment.introduction.content[1].description;
            foreach (string s in employment.employers.employerNames)
            {
                txt_emp_employers.AppendText(s);
                txt_emp_employers.AppendText("\n");
            }
            foreach (string s in employment.careers.careerNames)
            {
                txt_emp_careers.AppendText(s);
                txt_emp_careers.AppendText("\n");
            }

            //set up the listView...
            //make columns...
            //for co-op table
            listView1.View          = View.Details;//text
            listView1.GridLines     = true;
            listView1.FullRowSelect = true;

            listView1.Width = 820;
            listView1.Columns.Add("EMPLOYER", 235);
            listView1.Columns.Add("DEGREE", 235);
            listView1.Columns.Add("CITY", 235);
            listView1.Columns.Add("TERM", 115);

            ListViewItem item;

            for (var i = 0; i < employment.coopTable.coopInformation.Count; i++)
            {
                item = new ListViewItem(
                    new string[] {
                    employment.coopTable.coopInformation[i].employer,
                    employment.coopTable.coopInformation[i].degree,
                    employment.coopTable.coopInformation[i].city,
                    employment.coopTable.coopInformation[i].term
                }
                    );
                //append the row
                listView1.Items.Add(item);
            }

            //for employment table
            listView2.View          = View.Details;//text
            listView2.GridLines     = true;
            listView2.FullRowSelect = true;

            listView2.Width = 820;
            listView2.Columns.Add("DEGREE", 175);
            listView2.Columns.Add("EMPLOYER", 175);
            listView2.Columns.Add("LOCATION", 175);
            listView2.Columns.Add("TITLE", 175);
            listView2.Columns.Add("START DATE", 120);

            ListViewItem empl;

            for (var i = 0; i < employment.employmentTable.professionalEmploymentInformation.Count; i++)
            {
                empl = new ListViewItem(
                    new string[] {
                    employment.employmentTable.professionalEmploymentInformation[i].employer,
                    employment.employmentTable.professionalEmploymentInformation[i].degree,
                    employment.employmentTable.professionalEmploymentInformation[i].city,
                    employment.employmentTable.professionalEmploymentInformation[i].title,
                    employment.employmentTable.professionalEmploymentInformation[i].startDate
                }
                    );
                //append the row
                listView2.Items.Add(empl);
            }

            //get minors
            string jsonMnr = rj.getJSON("/minors/");

            minors = JToken.Parse(jsonMnr).ToObject <Minors>();

            //get degrees
            string jsonDegree = rj.getJSON("/degrees/");

            degrees = JToken.Parse(jsonDegree).ToObject <Degrees>();

            //get research
            string jsonResearch = rj.getJSON("/research/");

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

            //get resources
            string jsonResource = rj.getJSON("/resources/");

            resources = JToken.Parse(jsonResource).ToObject <Resources>();

            //get news
            string jsonnew = rj.getJSON("/news/");
            News   news    = JToken.Parse(jsonnew).ToObject <News>();

            //appending to the news tab page
            rtb_news_latest.Text  = news.year[0].title + "\n" + news.year[0].date + "\n" + "   " + news.year[0].description + "\n" + "\n" + news.year[1].title + "\n" + news.year[1].date + "\n" + "  " + news.year[1].description + "\n" + "\n" + news.year[3].title + "\n" + news.year[3].date + "\n" + "  " + news.year[3].description + "\n" + "\n" + news.year[4].title + "\n" + news.year[4].date + "\n" + "  " + news.year[4].description + "\n" + "\n" + news.year[5].title + "\n" + news.year[5].date + "\n" + "  " + news.year[5].description;
            rtb_news_quarter.Text = news.quarter[0].title + "\n" + news.quarter[0].date + "\n" + "   " + news.quarter[0].description + "\n" + "\n" + news.quarter[1].title + "\n" + news.quarter[1].date + "\n" + "  " + news.quarter[1].description;
            rtb_news_older.Text   = news.older[0].title + "\n" + news.older[0].date + "\n" + "   " + news.older[0].description + "\n" + "\n" + news.older[1].title + "\n" + news.older[1].date + "\n" + "  " + news.older[1].description + "\n" + "\n" + news.older[2].title + "\n" + news.older[2].date + "\n" + "  " + news.older[2].description + "\n" + "\n" + news.older[3].title + "\n" + news.older[3].date + "\n" + "  " + news.older[3].description + "\n" + "\n" + news.older[4].title + "\n" + news.older[4].date + "\n" + "  " + news.older[4].description + "\n" + "\n" + news.older[5].title + "\n" + news.older[5].date + "\n" + "  " + news.older[5].description;

            //get people
            string jsonPeople = rj.getJSON("/people/");

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

            //get images of faculties for their research areas
            pic_rec_fac1.ImageLocation  = people.faculty[1].imagePath;
            pic_rec_fac2.ImageLocation  = people.faculty[3].imagePath;
            pic_rec_fac3.ImageLocation  = people.faculty[4].imagePath;
            pic_rec_fac4.ImageLocation  = people.faculty[5].imagePath;
            pic_rec_fac5.ImageLocation  = people.faculty[7].imagePath;
            pic_rec_fac6.ImageLocation  = people.faculty[8].imagePath;
            pic_rec_fac7.ImageLocation  = people.faculty[9].imagePath;
            pic_rec_fac8.ImageLocation  = people.faculty[11].imagePath;
            pic_rec_fac9.ImageLocation  = people.faculty[12].imagePath;
            pic_rec_fac10.ImageLocation = people.faculty[13].imagePath;
            pic_rec_fac11.ImageLocation = people.faculty[15].imagePath;
            pic_rec_fac12.ImageLocation = people.faculty[17].imagePath;
            pic_rec_fac13.ImageLocation = people.faculty[19].imagePath;
            pic_rec_fac14.ImageLocation = people.faculty[22].imagePath;
            pic_rec_fac15.ImageLocation = people.faculty[24].imagePath;
            pic_rec_fac16.ImageLocation = people.faculty[26].imagePath;
            pic_rec_fac17.ImageLocation = people.faculty[28].imagePath;
            pic_rec_fac18.ImageLocation = people.faculty[29].imagePath;
            pic_rec_fac19.ImageLocation = people.faculty[30].imagePath;
            pic_rec_fac20.ImageLocation = people.faculty[31].imagePath;
            pic_rec_fac21.ImageLocation = people.faculty[32].imagePath;
        }