Example #1
0
        // Change body view to Employment section when "EMPLOYMENT" is clicked
        private void emp_btn_Click(object sender, EventArgs e)
        {
            processButtons(sender);
            body.SelectedTab = emp_tab;

            // Ensure we have data, fetch if we don't
            if (employment == null)
            {
                Console.WriteLine("Loading employment...");
                // go get the /employment info
                string jsonEmp = rj.getRestJSON("/employment/");
                employment = JToken.Parse(jsonEmp).ToObject <Employment>();

                Introduction     intro     = employment.introduction;
                DegreeStatistics stats     = employment.degreeStatistics;
                Employers        employers = employment.employers;
                Careers          careers   = employment.careers;

                // Load stuff
                emptitle.Text = intro.title;
                for (int i = 0; i < employers.employerNames.Count; i++)
                {
                    employer_stats.AppendText("\u2022  " + employers.employerNames[i]);
                    if (i != employers.employerNames.Count - 1)
                    {
                        employer_stats.AppendText(Environment.NewLine);
                    }
                }
                for (int i = 0; i < careers.careerNames.Count; i++)
                {
                    careers_stats.AppendText("\u2022  " + careers.careerNames[i]);
                    if (i != careers.careerNames.Count - 1)
                    {
                        careers_stats.AppendText(Environment.NewLine);
                    }
                }
                for (int i = 0; i < stats.statistics.Count; i++)
                {
                    stats_rtb.AppendText("\u2022  " + stats.statistics[i].value + " -- " + stats.statistics[i].description);
                    if (i != stats.statistics.Count - 1)
                    {
                        stats_rtb.AppendText(Environment.NewLine);
                    }
                }

                // Coop tab
                coop_desc.Text = intro.content[1].description;
                // populate the dataGridView...
                for (int i = 0; i < employment.coopTable.coopInformation.Count; i++)
                {
                    DataGridView1.Rows.Add();
                    DataGridView1.Rows[i].Cells[0].Value = employment.coopTable.coopInformation[i].employer;
                    DataGridView1.Rows[i].Cells[1].Value = employment.coopTable.coopInformation[i].degree;
                    DataGridView1.Rows[i].Cells[2].Value = employment.coopTable.coopInformation[i].city;
                    DataGridView1.Rows[i].Cells[3].Value = employment.coopTable.coopInformation[i].term;
                }

                // Professional emp tab
                prof_emp_desc.Text = intro.content[0].description;
                // populate the dataGridView...
                for (int i = 0; i < employment.employmentTable.professionalEmploymentInformation.Count; i++)
                {
                    dataGridView2.Rows.Add();
                    dataGridView2.Rows[i].Cells[0].Value = employment.employmentTable.professionalEmploymentInformation[i].degree;
                    dataGridView2.Rows[i].Cells[1].Value = employment.employmentTable.professionalEmploymentInformation[i].employer;
                    dataGridView2.Rows[i].Cells[2].Value = employment.employmentTable.professionalEmploymentInformation[i].title;
                    dataGridView2.Rows[i].Cells[3].Value = employment.employmentTable.professionalEmploymentInformation[i].city;
                    dataGridView2.Rows[i].Cells[4].Value = employment.employmentTable.professionalEmploymentInformation[i].startDate;
                }
            }
        }
        //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;
            }
        }