// Upon entering the employment tab the data is requested from the API and loaded into the text boxes and headers private void employTab_Enter(object sender, EventArgs e) { string jsonEmp = getRESTData("/employment/"); Employment employ = JToken.Parse(jsonEmp).ToObject <Employment>(); empTitle.Text = employ.introduction.title; empLbl.Text = employ.introduction.content[0].title; empDesc.Text = employ.introduction.content[0].description + "\n" + employ.degreeStatistics.title + ":" + "\n"; for (int i = 0; i < employ.degreeStatistics.statistics.Count; i++) { empDesc.Text += " " + employ.degreeStatistics.statistics[i].value + "\n" + " - " + employ.degreeStatistics.statistics[i].description + "\n"; } coopLbl.Text = employ.introduction.content[1].title; coopDesc.Text = employ.introduction.content[1].description + "\n" + employ.employers.title + ":" + "\n"; for (int i = 0; i < employ.employers.employerNames.Length; i++) { coopDesc.Text += " - " + employ.employers.employerNames[i] + "\n"; } coopDesc.Text += employ.careers.title + ":" + "\n"; for (int i = 0; i < employ.careers.careerNames.Length; i++) { coopDesc.Text += " - " + employ.careers.careerNames[i] + "\n"; } }
private void loadEmploymentData() { if (emp == null) { string jsonEmp = getRESTData("/employment/"); emp = JToken.Parse(jsonEmp).ToObject <Employment>(); } }
private void loadEmploymentData() { // Have we loaded the data before if (emp == null) { string jsonEmp = rest.getRESTData("/employment/"); emp = JToken.Parse(jsonEmp).ToObject <Employment>(); } }
private void loadEmploymentData() { // Have we loaded the data before? if (emp == null) { // get employment data from api string jsonEmp = rest.getRESTData("/employment/"); // cast the object to an employee emp = JToken.Parse(jsonEmp).ToObject <Employment>(); } }
//------------------Employment Page------------------------// private void tab_employment_Enter(object sender, EventArgs e) { //get the /employment/ data from api string jsonEmp = rest.getRESTData("/employment"); Employment emp = JToken.Parse(jsonEmp).ToObject <Employment>(); // get the title for emp_label1 emp_label1.Text = emp.introduction.title; // get the description for rtb_employment rtb_employment.Text = " "; rtb_employment.AppendText(emp.introduction.content[0].title + Environment.NewLine); rtb_employment.AppendText(Environment.NewLine + emp.introduction.content[0].description); // get the data for four degree statistics gb_stat.Text = emp.degreeStatistics.title; //get the title int i = gb_stat.Controls.Count - 1; foreach (RichTextBox rtb in gb_stat.Controls) { rtb.Text = " "; rtb.AppendText(emp.degreeStatistics.statistics[i].value + Environment.NewLine); rtb.AppendText(emp.degreeStatistics.statistics[i].description); i--; } // get the cooperative education data in rtb_coop rtb_coop.Text = " "; rtb_coop.AppendText(emp.introduction.content[1].title + Environment.NewLine); rtb_coop.AppendText(Environment.NewLine + emp.introduction.content[1].description); // get the employer data in rtb_employers rtb_employers.Text = " "; rtb_employers.AppendText(emp.employers.title + Environment.NewLine); foreach (string str in emp.employers.employerNames) { rtb_employers.AppendText(str + Environment.NewLine); } // get the carees data in rtb_carees rtb_carees.Text = " "; rtb_carees.AppendText(emp.careers.title + Environment.NewLine); foreach (string str in emp.careers.careerNames) { rtb_carees.AppendText(str + Environment.NewLine); } }
public void createEmploymentTab() { string jsonEmployment = istRest.getRESTData("/employment/"); // Cast the objects Employment employment = JToken.Parse(jsonEmployment).ToObject <Employment>(); //Create the intro part of the employment table int x = 270; int y = 50; employTab.Controls.Add(e.createLabel(employment.introduction.title, x, y, 250, 20)); x = 50; y += 30; foreach (Content cont in employment.introduction.content) { employTab.Controls.Add(e.createLabel(cont.title, x, y)); y += 30; employTab.Controls.Add(e.createTextBox(cont.description, x, y, 300, 120)); x += 400; y = 80; } y = 300; x = 50; //Creates a panel for each Statistic foreach (Statistic stat in employment.degreeStatistics.statistics) { Panel panel = new Panel(); panel.Controls.Add(e.createLabel(stat.value, 0, 0)); panel.Controls.Add(e.createTextBox(stat.Description, 0, 40, 300, 100)); panel.Size = new Size(300, 150); panel.BackColor = Color.Orange; panel.Location = new Point(x, y); panel.Font = new Font(panel.Font.FontFamily, 14); employTab.Controls.Add(panel); if (x >= 450) { x = 50; y += 175; } else { x += 400; } } Panel panel2 = new Panel(); panel2.BackColor = Color.Orange; panel2.Size = new Size(700, 100); panel2.Controls.Add(e.createLabel(employment.employers.title, 30, 20)); int panelx = 0; int panely = 50; foreach (String employer in employment.employers.employerNames) { panel2.Controls.Add(e.createLabel(employer, panelx, panely)); panelx += 105; if (x >= 600) { x = 0; y += 30; } } panel2.Location = new Point(40, 700); employTab.Controls.Add(panel2); panel2 = new Panel(); panel2.BackColor = Color.Orange; panel2.Size = new Size(700, 100); panel2.Controls.Add(e.createLabel(employment.careers.title, 30, 20)); panelx = 0; panely = 50; foreach (String career in employment.careers.careerNames) { panel2.Controls.Add(e.createLabel(career, panelx, panely)); panelx += 105; if (x >= 600) { x = 0; y += 30; } } panel2.Location = new Point(40, 800); employTab.Controls.Add(panel2); }