コード例 #1
0
        public void DrawReport()
        {
            using (IChart excel = new ExcelModel("Change in Survey Reponses"))
            {
                int col = 1;
                int row = 1;
                PropertyInfo[] properties = typeof(PersonalSurvey).GetProperties();
                foreach (var property in properties)
                {
                    excel.SetCellValue(row, col++, property.Name);
                }
                col = 1;
                row = 2;
                foreach (PersonalSurvey survey in _surveys)
                {
                    foreach (var property in properties)
                    {
                        var value = typeof(PersonalSurvey).GetProperty(property.Name).GetValue(survey);
                        excel.SetCellValue(row, col++, value);
                    }
                    row++;
                    col = 1;
                }
                Graph colChart = excel.ColumnChart(50, 50, 1000, 300);

                colChart.SetSource(1, 1, _surveys.Count + 1, properties.Count());

                excel.Close();
            }
        }
コード例 #2
0
ファイル: DataExporter.cs プロジェクト: jgiunti/EmployerData
        public void Export()
        {
            int offset;
            using (IChart excel = new ExcelModel(_view.Name + " export"))
            {
                foreach (DataGridViewRow row in _view.Rows)
                {                 
                    foreach (DataGridViewCell cell in row.Cells)
                    {
                        // Excel is 1 based not zero, must add 1 to indexes
                        offset = row.Index == 0 ? 2 : 1;
                        if (row.Index == 0)
                        {
                            excel.SetCellValue(row.Index + 1, cell.ColumnIndex + 1, cell.OwningColumn.HeaderCell.Value);
                        }

                        excel.SetCellValue(row.Index + offset, cell.ColumnIndex + 1, cell.Value);
                    }
                }
                excel.Close();
            }
        }
コード例 #3
0
        public void DrawReport()
        {   
            Tuple<string, double> workLife;
            Tuple<string, double> jobsec;
            Tuple<string, double> training;
            Tuple<string, double> workload;
            Tuple<string, double> careerpath;
            Tuple<string, double> promocrit;
            Tuple<string, double> promo;
            Tuple<string, double> auton;
            Tuple<string, double> salary;
            Tuple<string, double> goodSuper;
            Tuple<string, double> flex;
            Tuple<string, double> rewPerf;
            Tuple<string, double> mission;
            Tuple<string, double> health;
            Tuple<string, double> rewrecog;
            Tuple<string, double> workspace;
            Tuple<string, double> poorperfs;

            int totalExplorers = JobExplorerManager.JobExplorers.Count();

            int totalSurveys = PersonalSurveyManager.PersonalSurveys.Count();

            workLife = new Tuple<string, double>("Work Life Balance", PersonalSurveyManager.PersonalSurveys.Sum(x => x.worklife_self) / totalSurveys);
            jobsec = new Tuple<string, double>("Job Security", PersonalSurveyManager.PersonalSurveys.Sum(x => x.jobsec_self) / totalSurveys);
            training = new Tuple<string, double>("Training and Development", PersonalSurveyManager.PersonalSurveys.Sum(x => x.td_self) / totalSurveys);
            careerpath = new Tuple<string, double>("Clear Career Path", PersonalSurveyManager.PersonalSurveys.Sum(x => x.careerpath_self) / totalSurveys);
            promocrit = new Tuple<string, double>("Clear Promotion Criteria", PersonalSurveyManager.PersonalSurveys.Sum(x => x.promocrit_self) / totalSurveys);
            workload = new Tuple<string, double>("Manageable Workload", PersonalSurveyManager.PersonalSurveys.Sum(x => x.workload_self) / totalSurveys);
            promo = new Tuple<string, double>("Promotion Opportunities", PersonalSurveyManager.PersonalSurveys.Sum(x => x.promo_self) / totalSurveys);
            auton = new Tuple<string, double>("Autonomy", PersonalSurveyManager.PersonalSurveys.Sum(x => x.auton_self) / totalSurveys);
            salary = new Tuple<string, double>("High Salary", PersonalSurveyManager.PersonalSurveys.Sum(x => x.salary_self) / totalSurveys);
            goodSuper = new Tuple<string, double>("Good Supervisors", PersonalSurveyManager.PersonalSurveys.Sum(x => x.goodsup_self) / totalSurveys);
            flex = new Tuple<string, double>("Flexible Schedules", PersonalSurveyManager.PersonalSurveys.Sum(x => x.flex_self) / totalSurveys);
            rewPerf = new Tuple<string, double>("Performance Rewards", PersonalSurveyManager.PersonalSurveys.Sum(x => x.rewperf_self) / totalSurveys);
            mission = new Tuple<string, double>("A Clear Mission", PersonalSurveyManager.PersonalSurveys.Sum(x => x.mission_self) / totalSurveys);
            health = new Tuple<string, double>("Good Health Benefits", PersonalSurveyManager.PersonalSurveys.Sum(x => x.health_self) / totalSurveys);
            rewrecog = new Tuple<string, double>("Rewards and Recognition", PersonalSurveyManager.PersonalSurveys.Sum(x => x.rewrecog_self) / totalSurveys);
            workspace = new Tuple<string, double>("Private Work Space", PersonalSurveyManager.PersonalSurveys.Sum(x => x.workspace_self) / totalSurveys);
            poorperfs = new Tuple<string, double>("Deals with Poor Performance", PersonalSurveyManager.PersonalSurveys.Sum(x => x.poorperfs_self) / totalSurveys);

            List<Tuple<string, double>> critList = new List<Tuple<string, double>>();
            critList.Add(workLife);
            critList.Add(jobsec);
            critList.Add(training);
            critList.Add(workload);
            critList.Add(careerpath);
            critList.Add(promocrit);
            critList.Add(promo);
            critList.Add(auton);
            critList.Add(salary);
            critList.Add(goodSuper);
            critList.Add(flex);
            critList.Add(rewPerf);
            critList.Add(mission);
            critList.Add(health);
            critList.Add(rewrecog);
            critList.Add(workspace);
            critList.Add(poorperfs);

            using (IChart excel = new ExcelModel("Top 10 Employee Work Values"))
            {
                int idx = 1;
                foreach (Tuple<string, double> pair in critList.OrderBy(x => x.Item2).Take(10))
                {
                    excel.SetCellValue(idx, 1, pair.Item1);
                    excel.SetCellValue(idx, 2, pair.Item2);
                    idx++;
                }

                Graph newG = excel.BarChart(50, 50, 1000, 300);

                newG.SetSource(1, 1, idx-1, 2);

                excel.Close();
            }
        }
コード例 #4
0
ファイル: EmpMismatch.cs プロジェクト: jgiunti/EmployerData
        public void DrawReport()
        {
            int surveyCnt = _plist.Count;
            int jobsec = 0;
            int wrklife = 0;
            int wrkload = 0;
            int careerpth = 0;
            int td = 0;
            int promo = 0;
            int goodsup = 0;
            int auton = 0;
            int promocrit = 0;
            int salary = 0;
            int flex = 0;
            int rewperf = 0;
            int mission = 0;
            int health = 0;
            int rewrecog = 0;
            int wrkspc = 0;
            int poorperfs = 0;

            foreach (PersonalSurvey survey in _plist)
            {
                jobsec += survey.jobsec_self;
                wrklife += survey.worklife_self;
                wrkload += survey.workload_self;
                careerpth += survey.careerpath_self;
                td += survey.td_self;
                promo += survey.promo_self;
                goodsup += survey.goodsup_self;
                auton += survey.auton_self;
                promocrit += survey.promo_self;
                salary += survey.salary_self;
                flex += survey.flex_self;
                rewperf += survey.rewperf_self;
                mission += survey.mission_self;
                health += survey.health_self;
                rewrecog += survey.rewrecog_self;
                wrkspc += survey.workspace_self;
                poorperfs += survey.poorperfs_self;
            }

            jobsec /= surveyCnt;
            wrklife /= surveyCnt;
            wrkload /= surveyCnt;
            careerpth /= surveyCnt;
            td /= surveyCnt;
            promo /= surveyCnt;
            goodsup /= surveyCnt;
            auton /= surveyCnt;
            promocrit /= surveyCnt;
            salary /= surveyCnt;
            flex /= surveyCnt;
            rewperf /= surveyCnt;
            mission /= surveyCnt;
            health /= surveyCnt;
            rewrecog /= surveyCnt;
            wrkspc /= surveyCnt;
            poorperfs /= surveyCnt;

            using (IChart excel = new ExcelModel("Employers Mismatch vs " + _employer.employerName))
            {
                int row = 1;
                int col = 1;
                int diff = 0;
                int total = 0;
                excel.SetCellValue(row + 1, col, "Employee");
                excel.SetCellValue(row + 2, col++, _employer.employerName);

                diff = Math.Abs(jobsec - _employer.jobsec);
                excel.SetCellValue(row, col, "Job security");
                excel.SetCellValue(row + 3, col, "Job security");
                excel.SetCellValue(row + 4, col, diff);
                excel.SetCellValue(row + 1, col, jobsec);
                excel.SetCellValue(row + 2, col++, _employer.jobsec);

                total += diff;

                diff = Math.Abs(wrklife - _employer.worklife);
                excel.SetCellValue(row, col, "Work-life balance");
                excel.SetCellValue(row + 3, col, "Work-life balance");
                excel.SetCellValue(row + 4, col, diff);
                excel.SetCellValue(row + 1, col, wrklife);
                excel.SetCellValue(row + 2, col++, _employer.worklife);

                total += diff;

                diff = Math.Abs(wrkload - _employer.workload);
                excel.SetCellValue(row, col, "A manageable workload");
                excel.SetCellValue(row + 3, col, "A manageable workload");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, wrkload);
                excel.SetCellValue(row + 2, col++, _employer.workload);

                total += diff;

                diff = Math.Abs(careerpth - _employer.careerpath);
                excel.SetCellValue(row, col, "A clear career path");
                excel.SetCellValue(row + 3, col, "A clear career path");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, careerpth);
                excel.SetCellValue(row + 2, col++, _employer.careerpath);

                total += diff;

                diff = Math.Abs(td - _employer.td);
                excel.SetCellValue(row, col, "Providing training and development");
                excel.SetCellValue(row + 3, col, "Providing training and development");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, td);
                excel.SetCellValue(row + 2, col++, _employer.td);

                total += diff;

                diff = Math.Abs(promo - _employer.promo);
                excel.SetCellValue(row, col, "Opportunities for promotion");
                excel.SetCellValue(row + 3, col, "Opportunities for promotion");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, promo);
                excel.SetCellValue(row + 2, col++, _employer.promo);

                total += diff;

                diff = Math.Abs(goodsup - _employer.goodsup);
                excel.SetCellValue(row, col, "Good supervisors");
                excel.SetCellValue(row + 3, col, "Good supervisors");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, goodsup);
                excel.SetCellValue(row + 2, col++, _employer.goodsup);

                total += diff;

                diff = Math.Abs(auton - _employer.auton);
                excel.SetCellValue(row, col, "Autonomy");
                excel.SetCellValue(row + 3, col, "Autonomy");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, auton);
                excel.SetCellValue(row + 2, col++, _employer.auton);

                total += diff;

                diff = Math.Abs(promocrit - _employer.promocrit);
                excel.SetCellValue(row, col, "Clear promotion criteria");
                excel.SetCellValue(row + 3, col, "Clear promotion criteria");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, promocrit);
                excel.SetCellValue(row + 2, col++, _employer.promocrit);

                total += diff;

                diff = Math.Abs(salary - _employer.salary);
                excel.SetCellValue(row, col, "High salary");
                excel.SetCellValue(row + 3, col, "High salary");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, salary);
                excel.SetCellValue(row + 2, col++, _employer.salary);

                total += diff;

                diff = Math.Abs(flex - _employer.flex);
                excel.SetCellValue(row, col, "Flexibility");
                excel.SetCellValue(row + 3, col, "Flexibility");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, flex);
                excel.SetCellValue(row + 2, col++, _employer.flex);

                total += diff;

                diff = Math.Abs(rewperf - _employer.rewperf);
                excel.SetCellValue(row, col, "Rewards performance");
                excel.SetCellValue(row + 3, col, "Rewards performance");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, rewperf);
                excel.SetCellValue(row + 2, col++, _employer.rewperf);

                total += diff;

                diff = Math.Abs(mission - _employer.mission);
                excel.SetCellValue(row, col, "A clear mission");
                excel.SetCellValue(row + 3, col, "A clear mission");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, mission);
                excel.SetCellValue(row + 2, col++, _employer.mission);

                total += diff;

                diff = Math.Abs(health - _employer.health);
                excel.SetCellValue(row, col, "Good health benefits");
                excel.SetCellValue(row + 3, col, "Good health benefits");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, health);
                excel.SetCellValue(row + 2, col++, _employer.health);

                total += diff;

                diff = Math.Abs(rewrecog - _employer.rewrecog);
                excel.SetCellValue(row, col, "Provides rewards and recognition");
                excel.SetCellValue(row + 3, col, "Provides rewards and recognition");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, rewrecog);
                excel.SetCellValue(row + 2, col++, _employer.rewrecog);

                total += diff;

                diff = Math.Abs(wrkspc - _employer.workspace);
                excel.SetCellValue(row, col, "Private office or work space");
                excel.SetCellValue(row + 3, col, "Private office or work space");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, wrkspc);
                excel.SetCellValue(row + 2, col++, _employer.workspace);

                total += diff;

                diff = Math.Abs(poorperfs - _employer.poorperfs);
                excel.SetCellValue(row, col, "takes actions against poor performers");
                excel.SetCellValue(row + 3, col, "takes actions against poor performers");
                excel.SetCellValue(row + 4, col, diff);

                excel.SetCellValue(row + 1, col, poorperfs);
                excel.SetCellValue(row + 2, col++, _employer.poorperfs);

                excel.SetCellValue(row + 3, col, "Total Mismatch");
                excel.SetCellValue(row + 4, col, total);


                Graph colChart = excel.BarChart(50, 50, 500, 750);

                colChart.SetSource(1, 1, 3, 18);

                colChart.SetTitle("Employer Mismatch vs " + _employer.employerName);

                Graph mismatch = excel.ColumnChart(600, 50, 750, 500);

                mismatch.SetSource(4, 2, 5, 19);

                mismatch.SetTitle("Total Mismatch vs " + _employer.employerName);

                excel.Close();
            }
        }