// ProfessionalEmploymentInformation table button private void button6_Click(object sender, EventArgs e) { // Get Employment from the API string jsonEmployment = getRESTData("/employment/"); Employment employment = JToken.Parse(jsonEmployment).ToObject <Employment>(); tbIntroTitle.Text = employment.introduction.title; DataTable table = new DataTable(); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(ProfessionalEmploymentInformation)); foreach (PropertyDescriptor prop in properties) { table.Columns.Add(prop.Name, Nullable.GetUnderlyingType(prop.PropertyType) ?? prop.PropertyType); } foreach (ProfessionalEmploymentInformation item in employment.employmentTable.professionalEmploymentInformation) { DataRow row = table.NewRow(); foreach (PropertyDescriptor prop in properties) { row[prop.Name] = prop.GetValue(item) ?? DBNull.Value; } table.Rows.Add(row); } dataGridView1.DataSource = table; }
// Careers button private void button4_Click(object sender, EventArgs e) { rtbContent.Text = ""; // Get Employment from the API string jsonEmployment = getRESTData("/employment/"); Employment employment = JToken.Parse(jsonEmployment).ToObject <Employment>(); foreach (String car in employment.careers.careerNames) { rtbContent.Text += car + Environment.NewLine; } }
// Degree Statistics button private void button2_Click(object sender, EventArgs e) { rtbContent.Text = ""; // Get Employment from the API string jsonEmployment = getRESTData("/employment/"); Employment employment = JToken.Parse(jsonEmployment).ToObject <Employment>(); foreach (Statistic stat in employment.degreeStatistics.statistics) { rtbContent.Text += stat.value + " "; rtbContent.Text += stat.description + Environment.NewLine + Environment.NewLine; } }
// Introduction button private void button1_Click(object sender, EventArgs e) { rtbContent.Text = ""; // Get Employment from the API string jsonEmployment = getRESTData("/employment/"); Employment employment = JToken.Parse(jsonEmployment).ToObject <Employment>(); foreach (Content con in employment.introduction.content) { rtbContent.Text += con.title + ":" + Environment.NewLine; rtbContent.Text += con.description + Environment.NewLine + Environment.NewLine; } }
private void employ_click(object sender, EventArgs e) { //load the data string jsonEmploy = rj.getJSON("/employment/"); //turn into object employment = JToken.Parse(jsonEmploy).ToObject <Employment>(); //prepare the listView //set up how I want it to look... listView1.View = View.Details; listView1.GridLines = true; listView1.FullRowSelect = true; listView1.Width = 700; listView1.Height = 400; //assing the headers listView1.Columns.Add("Employers", 200); listView1.Columns.Add("Degree", 200); listView1.Columns.Add("City", 200); listView1.Columns.Add("Term", 100); //dump in data ListViewItem items; for (int i = 0; i < employment.coopTable.coopInformation.Count; i++) { items = new ListViewItem(new string[] { employment.coopTable.coopInformation[i].employer, employment.coopTable.coopInformation[i].degree, employment.coopTable.coopInformation[i].city, employment.coopTable.coopInformation[i].term }); listView1.Items.Add(items); } //load the data string jsonEmploys = rj.getJSON("/employment/"); //turn into object employment = JToken.Parse(jsonEmploys).ToObject <Employment>(); //prepare the listView //set up how I want it to look... listView2.View = View.Details; listView2.GridLines = true; listView2.FullRowSelect = true; listView2.Width = 700; listView2.Height = 400; //assing the headers listView2.Columns.Add("Degree", 200); listView2.Columns.Add("Employer", 200); listView2.Columns.Add("Location", 200); listView2.Columns.Add("Title", 100); listView2.Columns.Add("StartDate", 100); //dump in data ListViewItem ite; for (int i = 0; i < employment.employmentTable.professionalEmploymentInformation.Count; i++) { ite = new ListViewItem(new String[] { employment.employmentTable.professionalEmploymentInformation[i].degree, employment.employmentTable.professionalEmploymentInformation[i].employer, employment.employmentTable.professionalEmploymentInformation[i].city, employment.employmentTable.professionalEmploymentInformation[i].title, employment.employmentTable.professionalEmploymentInformation[i].startDate }); listView2.Items.Add(ite); } }