//Code to show statistics of employment private void employmentFn() { string link = baseurl.getRestData("/employment/"); //Console.WriteLine(link); EmploymentData emp = JToken.Parse(link).ToObject <EmploymentData>(); Introduction intro = emp.introduction; Console.WriteLine(intro.ToString()); DegreeStatistics stat = emp.degreeStatistics; Console.WriteLine(stat.ToString()); Employers e = emp.employers; Careers career = emp.careers; Label label = new Label(); employmentPage.Controls.Add(label); label.BackColor = Color.Transparent; label.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label.ForeColor = Color.Black; label.Text = intro.title; label.AutoSize = true; label.Location = new Point(((this.ClientSize.Width - label.Width) / 2), 50); label.TextAlign = ContentAlignment.MiddleCenter; int count = 1; foreach (Content c in intro.content) { Label label1 = new Label(); employmentPage.Controls.Add(label1); label1.BackColor = Color.Transparent; label1.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label1.ForeColor = Color.Black; label1.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(c.title); label1.AutoSize = true; label1.MaximumSize = new Size(1000, 0); label1.Location = new Point(((this.ClientSize.Width - label1.Width) / 2), 80 * count); label1.TextAlign = ContentAlignment.MiddleCenter; Label label2 = new Label(); employmentPage.Controls.Add(label2); label2.BackColor = Color.Transparent; label2.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label2.ForeColor = Color.Black; label2.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(c.description); label2.AutoSize = true; label2.MaximumSize = new Size(1000, 0); label2.Location = new Point(((this.ClientSize.Width - label2.Width) / 2), 95 * count); label2.TextAlign = ContentAlignment.MiddleCenter; count++; } // Statistics Box Label label3 = new Label(); employmentPage.Controls.Add(label3); label3.BackColor = Color.Transparent; label3.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label3.ForeColor = Color.Black; label3.Text = stat.title; label3.AutoSize = true; label3.Location = new Point(((this.ClientSize.Width - label3.Width) / 2), 280); label3.TextAlign = ContentAlignment.MiddleCenter; TableLayoutPanel panelstat = new TableLayoutPanel(); panelstat.Location = new Point((this.ClientSize.Width - panelstat.Width) / 4, 310); panelstat.RowCount = 1; panelstat.Size = new Size((stat.statistics.Count) * 205, 150); panelstat.ColumnCount = stat.statistics.Count; employmentPage.Controls.Add(panelstat); for (int i = 0; i < stat.statistics.Count; i++) { Statistic s = stat.statistics[i]; MetroFramework.Controls.MetroTile tile = new MetroFramework.Controls.MetroTile(); tile.Size = new Size(200, 150); tile.TextAlign = ContentAlignment.MiddleCenter; //tile.MaximumSize=new Size(300, 200); tile.Style = MetroFramework.MetroColorStyle.Silver; tile.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s.value + "\n" + s.description); panelstat.Controls.Add(tile, i, 0); } //Employers Label label4 = new Label(); employmentPage.Controls.Add(label4); label4.BackColor = Color.Transparent; label4.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label4.ForeColor = Color.Black; label4.Text = e.title; label4.AutoSize = true; label4.Location = new Point(((this.ClientSize.Width - label4.Width) / 2), 470); label4.TextAlign = ContentAlignment.MiddleCenter; for (int i = 0; i < 5; i++) { Label label5 = new Label(); employmentPage.Controls.Add(label5); label5.BackColor = Color.Transparent; label5.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label5.ForeColor = Color.Black; label5.Text = e.employerNames[i]; label5.AutoSize = true; label5.Location = new Point(220 * (i + 1), 500); label5.TextAlign = ContentAlignment.MiddleCenter; } //Careers Label label6 = new Label(); employmentPage.Controls.Add(label6); label6.BackColor = Color.Transparent; label6.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label6.ForeColor = Color.Black; label6.Text = career.title; label6.AutoSize = true; label6.Location = new Point(((this.ClientSize.Width - label6.Width) / 2), 540); label6.TextAlign = ContentAlignment.MiddleCenter; for (int i = 0; i < 5; i++) { Label label5 = new Label(); employmentPage.Controls.Add(label5); label5.BackColor = Color.Transparent; label5.Font = new Font("Verdana", 9.75F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); label5.ForeColor = Color.Black; label5.Text = career.careerNames[i]; label5.AutoSize = true; label5.Location = new Point(200 * (i + 1), 580); label5.TextAlign = ContentAlignment.MiddleCenter; } }
//Code to display employment table and coop table and faculty details private void employmentDetails() { mapdata.Navigate("http://ist.rit.edu/api/map"); string link = baseurl.getRestData("/employment/"); EmploymentData emp = JToken.Parse(link).ToObject <EmploymentData>(); for (var i = 0; i < emp.coopTable.coopInformation.Count; i++) { coopData.Rows.Add(); coopData.Rows[i].Cells[0].Value = emp.coopTable.coopInformation[i].employer; coopData.Rows[i].Cells[1].Value = emp.coopTable.coopInformation[i].degree; coopData.Rows[i].Cells[2].Value = emp.coopTable.coopInformation[i].city; coopData.Rows[i].Cells[3].Value = emp.coopTable.coopInformation[i].term; } for (var i = 0; i < emp.employmentTable.professionalEmploymentInformation.Count; i++) { empData.Rows.Add(); empData.Rows[i].Cells[0].Value = emp.employmentTable.professionalEmploymentInformation[i].employer; empData.Rows[i].Cells[1].Value = emp.employmentTable.professionalEmploymentInformation[i].title; empData.Rows[i].Cells[2].Value = emp.employmentTable.professionalEmploymentInformation[i].degree; empData.Rows[i].Cells[3].Value = emp.employmentTable.professionalEmploymentInformation[i].city; empData.Rows[i].Cells[4].Value = emp.employmentTable.professionalEmploymentInformation[i].startDate; } string link2 = baseurl.getRestData("/people/"); PeopleData p = JToken.Parse(link2).ToObject <PeopleData>(); TableLayoutPanel panelp = new TableLayoutPanel(); panelp.Location = new Point((this.ClientSize.Width - panelp.Width) / 6, 50); panelp.RowCount = (p.faculty.Count / 4) + 1; panelp.Size = new Size(4 * 205, 500); panelp.ColumnCount = 4; panelp.Name = "faculty"; panelp.AutoScroll = true; facultyPage.Controls.Add(panelp); int count = 0; for (int i = 0; i < (p.faculty.Count / 4) + 1; i++) { for (int j = 0; j < 4; j++) { if (count < p.faculty.Count) { MetroFramework.Controls.MetroTile tile = new MetroFramework.Controls.MetroTile(); tile.Size = new Size(200, 200); tile.TextAlign = ContentAlignment.TopCenter; tile.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(p.faculty[count].name); tile.Click += new EventHandler(TileClickEventPeople); tile.Name = p.faculty[count].username; tile.AutoSize = true; // Image myimage = new Bitmap(); WebClient wc = new WebClient(); byte[] bytes = wc.DownloadData(p.faculty[count].imagePath); MemoryStream ms = new MemoryStream(bytes); Image img = Image.FromStream(ms); Image imgsize = new Bitmap(img, new Size(200, 200)); tile.CustomBackground = true; tile.UseTileImage = true; tile.TileImage = imgsize; tile.MaximumSize = new Size(200, 200); panelp.Controls.Add(tile, j, i); count++; } } } TableLayoutPanel panels = new TableLayoutPanel(); panels.Location = new Point((this.ClientSize.Width - panels.Width) / 6, 50); panels.RowCount = (p.staff.Count / 4) + 1; panels.Size = new Size(4 * 205, 500); panels.ColumnCount = 4; panels.Name = "staff"; panels.AutoScroll = true; staffPage.Controls.Add(panels); count = 0; for (int i = 0; i < (p.staff.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.TopCenter; tile.Text = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(p.staff[count].name); tile.Click += new EventHandler(TileClickEventPeople); tile.Name = p.staff[count].username; tile.AutoSize = true; // Image myimage = new Bitmap(); WebClient wc = new WebClient(); byte[] bytes = wc.DownloadData(p.staff[count].imagePath); MemoryStream ms = new MemoryStream(bytes); Image img = Image.FromStream(ms); Image imgsize = new Bitmap(img, new Size(200, 200)); tile.CustomBackground = true; tile.UseTileImage = true; tile.TileImage = imgsize; tile.MaximumSize = new Size(200, 200); panels.Controls.Add(tile, j, i); count++; } } }