Esempio n. 1
0
        private Minors loadData()
        {
            if (minors == null)
            {
                string jsonMinors = rest.getRESTData("/minors/");
                minors = JToken.Parse(jsonMinors).ToObject <Minors>();
            }

            return(minors);
        }
Esempio n. 2
0
        private void showMinorDetails()
        {
            string degreelink = baseurl.getRestData("/minors/");

            m = JToken.Parse(degreelink).ToObject <Minors>();
            foreach (UgMinor ugm in m.UgMinors)
            {
                if (ugm.name.Equals(mid))
                {
                    labelTitle.Text        = ugm.title;
                    labelTitle.MaximumSize = new Size(this.Width, 0);
                    labelTitle.Location    = new Point((this.ClientSize.Width) / 2, 50);
                    labelTitle.AutoSize    = true;

                    labelDescription.Text        = ugm.description;
                    labelDescription.MaximumSize = new Size(800, 0);
                    labelDescription.Location    = new Point((this.ClientSize.Width - labelDescription.Width) / 2, 100);
                    labelDescription.AutoSize    = true;

                    labelCon.Text        = "Courses";
                    labelCon.MaximumSize = new Size(this.Width / 2, 0);
                    labelCon.Location    = new Point((this.ClientSize.Width) / 2 + 150, 300);
                    labelCon.AutoSize    = true;

                    TableLayoutPanel panelm = new TableLayoutPanel();
                    panelm.Location    = new Point((this.ClientSize.Width - panelm.Width) / 2 + 50, 400);
                    panelm.RowCount    = ugm.courses.Count / 4;
                    panelm.Size        = new Size(105 * 4, ((ugm.courses.Count / 4) + 5) * 50);
                    panelm.ColumnCount = 4;
                    this.Controls.Add(panelm);

                    int count = 0;
                    for (int i = 0; i < ugm.courses.Count / 4; i++)
                    {
                        for (int j = 0; j < 4; j++)
                        {
                            MetroFramework.Controls.MetroTile tile = new MetroFramework.Controls.MetroTile();
                            tile.Size        = new Size(100, 50);
                            tile.TextAlign   = ContentAlignment.MiddleCenter;
                            tile.Text        = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(ugm.courses[count]);
                            tile.Click      += new EventHandler(TileClickEventC);
                            tile.Name        = ugm.courses[count];
                            tile.AutoSize    = true;
                            tile.MaximumSize = new Size(100, 0);
                            panelm.Controls.Add(tile, j, i);
                            count++;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        // Load minors data when entering "Minors" tab for the first time
        private void tabControl3_Enter(object sender, EventArgs e)
        {
            // Ensure we have the data, fetch if we don't
            if (minors == null)
            {
                Console.WriteLine("Loading minors...");
                string jsonMinors = rj.getRestJSON("/minors/");
                minors = JToken.Parse(jsonMinors).ToObject <Minors>();

                // Dynamically load minors
                int row    = 0;
                int column = 0;
                for (int i = 0; i < minors.UgMinors.Count; i++)
                {
                    UgMinor thisMinor = minors.UgMinors[i];
                    // Minor title
                    Label minorTitle = new Label();
                    minorTitle.Text        = thisMinor.title;
                    minorTitle.MouseEnter += (sender2, e2) => changeCellColor(sender2, e2);
                    minorTitle.MouseLeave += (sender3, e3) => changeCellColor(sender3, e3);
                    minorTitle.Margin      = new Padding(0, 0, minorTitle.Margin.Right, minorTitle.Margin.Right);
                    minorTitle.BorderStyle = BorderStyle.FixedSingle;
                    minorTitle.TextAlign   = ContentAlignment.MiddleCenter;
                    minorTitle.Anchor      = (AnchorStyles.Left | AnchorStyles.Right);

                    // Add components to degree panel, then to main panel
                    ug_minors.Controls.Add(minorTitle, column, row);

                    // Set onclick event handler to show degree details in popup
                    minorTitle.Click += (sender4, e4) => showUgMinorPopup(sender4, e4, thisMinor);

                    // 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 ug_minors.RowStyles)
                {
                    style.SizeType = SizeType.AutoSize;
                }
            }
        }
        //code to show different minors
        private void minorFn()
        {
            string         link    = baseurl.getRestData("/minors/");
            Minors         minor   = JToken.Parse(link).ToObject <Minors>();
            List <UgMinor> mdegree = minor.UgMinors;

            Label mTitle = new Label();

            mTitle.Text        = "Minors";
            mTitle.MaximumSize = new Size(1000, 0);
            mTitle.BackColor   = Color.Transparent;
            mTitle.Font        = new Font("Verdana", 12.75F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
            mTitle.Location    = new Point(((this.ClientSize.Width - mTitle.Width) / 2) - 75, 50);
            mTitle.AutoSize    = true;
            mPage.Controls.Add(mTitle);

            TableLayoutPanel panelm = new TableLayoutPanel();

            panelm.Location    = new Point((this.ClientSize.Width - panelm.Width) / 6, 100);
            panelm.RowCount    = mdegree.Count / 4;
            panelm.Size        = new Size(4 * 205, 400);
            panelm.ColumnCount = mdegree.Count - 1;
            mPage.Controls.Add(panelm);
            int count = 0;

            for (int i = 0; i < mdegree.Count / 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    MetroFramework.Controls.MetroTile tile = new MetroFramework.Controls.MetroTile();
                    tile.Size        = new Size(200, 200);
                    tile.TextAlign   = ContentAlignment.MiddleCenter;
                    tile.Text        = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(mdegree[count].title);
                    tile.Click      += new EventHandler(TileClickEventM);
                    tile.Name        = mdegree[count].name;
                    tile.AutoSize    = true;
                    tile.Style       = MetroFramework.MetroColorStyle.Orange;
                    tile.MaximumSize = new Size(200, 200);
                    panelm.Controls.Add(tile, j, i);
                    count++;
                }
            }
        }
Esempio n. 5
0
        // Consumes Minors data and displays it on the form
        public void Minors()
        {
            string jsonMinors = getRESTData("/minors");
            Minors minors     = JToken.Parse(jsonMinors).ToObject <Minors>();

            // Minor1
            gbMinor1.Text  = minors.UgMinors[0].name;
            lblMinor1.Text = minors.UgMinors[0].title;
            rtbMinor1.Text = minors.UgMinors[0].description + "\n\nCourses:\n";
            rtbMinor1.AppendText(minors.UgMinors[0].courses[0] + "\n");
            rtbMinor1.AppendText(minors.UgMinors[0].courses[1] + "\n");
            rtbMinor1.AppendText(minors.UgMinors[0].courses[2] + "\n");
            rtbMinor1.AppendText(minors.UgMinors[0].courses[3] + "\n");
            rtbMinor1.AppendText(minors.UgMinors[0].courses[4]);

            // Minor2
            gbMinor2.Text  = minors.UgMinors[1].name;
            lblMinor2.Text = minors.UgMinors[1].title;
            rtbMinor2.Text = minors.UgMinors[1].description + "\n\nCourses:\n";
            rtbMinor2.AppendText(minors.UgMinors[1].courses[0] + "\n");
            rtbMinor2.AppendText(minors.UgMinors[1].courses[1] + "\n");
            rtbMinor2.AppendText(minors.UgMinors[1].courses[2] + "\n");
            rtbMinor2.AppendText(minors.UgMinors[1].courses[3] + "\n");
            rtbMinor2.AppendText(minors.UgMinors[1].courses[4] + "\n");
            rtbMinor2.AppendText(minors.UgMinors[1].courses[5] + "\n");
            rtbMinor2.AppendText("Note: \n" + minors.UgMinors[1].note);

            // Minor3
            gbMinor3.Text  = minors.UgMinors[2].name;
            lblMinor3.Text = minors.UgMinors[2].title;
            rtbMinor3.Text = minors.UgMinors[2].description + "\n\nCourses:\n";
            rtbMinor3.AppendText(minors.UgMinors[2].courses[0] + "\n");
            rtbMinor3.AppendText(minors.UgMinors[2].courses[1] + "\n");
            rtbMinor3.AppendText(minors.UgMinors[2].courses[2] + "\n");
            rtbMinor3.AppendText(minors.UgMinors[2].courses[3] + "\n");
            rtbMinor3.AppendText(minors.UgMinors[2].courses[4] + "\n");
            rtbMinor3.AppendText("Note: \n" + minors.UgMinors[2].note);

            // Minor4
            gbMinor4.Text  = minors.UgMinors[3].name;
            lblMinor4.Text = minors.UgMinors[3].title;
            rtbMinor4.Text = minors.UgMinors[3].description + "\n\nCourses:\n";
            rtbMinor4.AppendText(minors.UgMinors[3].courses[0] + "\n");
            rtbMinor4.AppendText(minors.UgMinors[3].courses[1] + "\n");
            rtbMinor4.AppendText(minors.UgMinors[3].courses[2] + "\n");
            rtbMinor4.AppendText(minors.UgMinors[3].courses[3] + "\n");
            rtbMinor4.AppendText(minors.UgMinors[3].courses[4] + "\n");

            // Minor5
            gbMinor5.Text  = minors.UgMinors[4].name;
            lblMinor5.Text = minors.UgMinors[4].title;
            rtbMinor5.Text = minors.UgMinors[4].description + "\n\nCourses:\n";
            rtbMinor5.AppendText(minors.UgMinors[4].courses[0] + "\n");
            rtbMinor5.AppendText(minors.UgMinors[4].courses[1] + "\n");
            rtbMinor5.AppendText(minors.UgMinors[4].courses[2] + "\n");
            rtbMinor5.AppendText(minors.UgMinors[4].courses[3] + "\n");
            rtbMinor5.AppendText(minors.UgMinors[4].courses[4] + "\n");
            rtbMinor5.AppendText(minors.UgMinors[4].courses[5] + "\n");
            rtbMinor5.AppendText("Note: \n" + minors.UgMinors[4].note);

            // Minor6
            gbMinor6.Text  = minors.UgMinors[5].name;
            lblMinor6.Text = minors.UgMinors[5].title;
            rtbMinor6.Text = minors.UgMinors[5].description + "\n\nCourses:\n";
            rtbMinor6.AppendText(minors.UgMinors[5].courses[0] + "\n");
            rtbMinor6.AppendText(minors.UgMinors[5].courses[1] + "\n");
            rtbMinor6.AppendText(minors.UgMinors[5].courses[2] + "\n");
            rtbMinor6.AppendText(minors.UgMinors[5].courses[3] + "\n");
            rtbMinor6.AppendText(minors.UgMinors[5].courses[4] + "\n");
            rtbMinor6.AppendText(minors.UgMinors[5].courses[5] + "\n");
            rtbMinor6.AppendText(minors.UgMinors[5].courses[6] + "\n");
            rtbMinor6.AppendText(minors.UgMinors[5].courses[7] + "\n");
            rtbMinor6.AppendText("Note: \n" + minors.UgMinors[5].note);

            // Minor7
            gbMinor7.Text  = minors.UgMinors[6].name;
            lblMinor7.Text = minors.UgMinors[6].title;
            rtbMinor7.Text = minors.UgMinors[6].description + "\n\nCourses:\n";
            rtbMinor7.AppendText(minors.UgMinors[6].courses[0] + "\n");
            rtbMinor7.AppendText(minors.UgMinors[6].courses[1] + "\n");
            rtbMinor7.AppendText(minors.UgMinors[6].courses[2] + "\n");
            rtbMinor7.AppendText(minors.UgMinors[6].courses[3] + "\n");
            rtbMinor7.AppendText(minors.UgMinors[6].courses[4] + "\n");
            rtbMinor7.AppendText("Note: \n" + minors.UgMinors[6].note);

            // Minor8
            gbMinor8.Text  = minors.UgMinors[7].name;
            lblMinor8.Text = minors.UgMinors[7].title;
            rtbMinor8.Text = minors.UgMinors[7].description + "\n\nCourses:\n";
            rtbMinor8.AppendText(minors.UgMinors[7].courses[0] + "\n");
            rtbMinor8.AppendText(minors.UgMinors[7].courses[1] + "\n");
            rtbMinor8.AppendText(minors.UgMinors[7].courses[2] + "\n");
            rtbMinor8.AppendText(minors.UgMinors[7].courses[3] + "\n");
            rtbMinor8.AppendText(minors.UgMinors[7].courses[4] + "\n");
            rtbMinor8.AppendText(minors.UgMinors[7].courses[5] + "\n");
            rtbMinor8.AppendText("Note: \n" + minors.UgMinors[7].note);
        }
        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;
        }