private TableRow GetSecondSuperHeader()
        {
            TableRow   tr       = new TableRow();
            TQRelateTo relateTo = GlobalValues.TQRelateTo;

            WinssDataGrid.AddTableCell(tr, " ", 1); //first label column is always blank

            string wkcewsas = GlobalValues.WOW.Key;
            string grade    = ((GlobalValues.Grade.Key != GradeKeys.Combined_PreK_12 && GlobalValues.Grade.Key != GradeKeys.AllDisAgg)
                ? "Grade " : String.Empty)
                              + GlobalValues.Grade.Key;

            int fayColSpan = 2;

            //   (GlobalValues.Level.Key == LevelKeys.WAA_ELL || GlobalValues.Level.Key == LevelKeys.WAA_SwD)
            //  ? 6 : 2;

            if (GlobalValues.SIZE.Key == SIZEKeys.Off &&
                GlobalValues.SPEND.Key == SPENDKeys.Off)
            {
                fayColSpan++;
            }

            if (GlobalValues.SIZE.Key == SIZEKeys.On)
            {
                WinssDataGrid.AddTableCell(tr, RelKeys.DistrictSize, 1);
            }
            if (GlobalValues.SPEND.Key == SPENDKeys.On)
            {
                WinssDataGrid.AddTableCell(tr, RelKeys.DistrictSpending, 1);
            }

            if (GlobalValues.ECON.Key == ECONKeys.On)
            {
                fayColSpan++;
            }

            if (GlobalValues.LEP.Key == LEPKeys.On)
            {
                fayColSpan++;
            }

            if (GlobalValues.DISABILITY.Key == DISABILITYKeys.On)
            {
                fayColSpan++;
            }

            WinssDataGrid.AddTableCell(tr, wkcewsas + " -- All Students Enrolled FAY -- " + grade, fayColSpan);

            foreach (TableCell cell in tr.Cells)
            {
                cell.BorderColor = System.Drawing.Color.Gray;
                cell.BorderWidth = 4;
            }

            return(tr);
        }
        private TableRow GetSecondSuperHeader()
        {
            TableRow   tr       = new TableRow();
            TQRelateTo relateTo = GlobalValues.TQRelateTo;

            string org = (GlobalValues.OrgLevel.Key == OrgLevelKeys.School) ? "School" : "District";

            string schoolType = TitleBuilder.GetSchoolTypeInTitle(GlobalValues.STYP);

            if (relateTo.CompareToKey(TQRelateToKeys.Spending))
            {
                WinssDataGrid.AddTableCell(tr, org, 1);
                WinssDataGrid.AddTableCell(tr, "District Spending", 1);
                WinssDataGrid.AddTableCell(tr, "Teacher Data: " + schoolType, 3);

                //relateToDenominatorLabel = "Current Education Cost Per Member";
                relateToLabel = "Current Education Cost Per Member";
            }
            else if (relateTo.CompareToKey(TQRelateToKeys.DistrictSize))
            {
                WinssDataGrid.AddTableCell(tr, org, 1);
                WinssDataGrid.AddTableCell(tr, "District Size", 1);
                WinssDataGrid.AddTableCell(tr, "Teacher Data: " + schoolType, 3);

                relateToDenominatorLabel = "Total Number Enrolled";
            }
            else if (relateTo.CompareToKey(TQRelateToKeys.SchoolSize))
            {
                WinssDataGrid.AddTableCell(tr, org, 1);
                WinssDataGrid.AddTableCell(tr, "School Size: " + schoolType, 1);
                WinssDataGrid.AddTableCell(tr, "Teacher Data: " + schoolType, 3);

                relateToDenominatorLabel = "Total Number Enrolled";
            }
            else
            {
                WinssDataGrid.AddTableCell(tr, org, 1);
                WinssDataGrid.AddTableCell(tr, "Student Data:" + schoolType, 2);
                WinssDataGrid.AddTableCell(tr, "Teacher Data:" + schoolType, 3);

                relateToDenominatorLabel = "Total # Enrolled (PreK-12)**";
            }

            foreach (TableCell cell in tr.Cells)
            {
                cell.BorderColor = System.Drawing.Color.Gray;
                cell.BorderStyle = BorderStyle.Double;
                cell.BorderWidth = 4;
            }

            return(tr);
        }
        private TableRow GetSecondSuperHeader()
        {
            TableRow   tr       = new TableRow();
            TQRelateTo relateTo = GlobalValues.TQRelateTo;

            WinssDataGrid.AddTableCell(tr, " ", 1); //first label column is always blank

            string wkcewsas = GlobalValues.WOW.Key;
            string grade    = ((GlobalValues.Grade.Key != GradeKeys.Combined_PreK_12 && GlobalValues.Grade.Key != GradeKeys.AllDisAgg)
                ? "Grade " : String.Empty)
                              + GlobalValues.Grade.Key;

            int fayColSpan =
                (GlobalValues.Level.Key == LevelKeys.WAA_ELL || GlobalValues.Level.Key == LevelKeys.WAA_SwD)
                ? 6 : 2;

            if (GlobalValues.Level.Key == LevelKeys.NoWSAS)
            {
                fayColSpan = fayColSpan + 2;
            }

            if ((GlobalValues.Rel.Key != RelKeys.DistrictSize &&
                 GlobalValues.Rel.Key != RelKeys.DistrictSpending) ||
                (GlobalValues.Group2.Key != Group2Keys.DistrictSize &&
                 GlobalValues.Group2.Key != Group2Keys.DistrictSpending)
                )
            {
                fayColSpan++;
            }

            if (GlobalValues.Rel.Key == RelKeys.DistrictSize ||
                GlobalValues.Group2.Key == Group2Keys.DistrictSize)
            {
                WinssDataGrid.AddTableCell(tr, RelKeys.DistrictSize, 1);
            }

            if (GlobalValues.Rel.Key == RelKeys.DistrictSpending ||
                GlobalValues.Group2.Key == Group2Keys.DistrictSpending)
            {
                WinssDataGrid.AddTableCell(tr, RelKeys.DistrictSpending, 1);
            }

            WinssDataGrid.AddTableCell(tr, wkcewsas + " -- All Students Enrolled FAY -- " + grade, fayColSpan);

            foreach (TableCell cell in tr.Cells)
            {
                cell.BorderColor = System.Drawing.Color.Gray;
                cell.BorderWidth = 4;
            }

            return(tr);
        }
        public override List <string> GetDownloadRawVisibleColumns()
        {
            List <string> cols      = base.GetDownloadRawVisibleColumns();
            TQRelateTo    relatedTo = GlobalValues.TQRelateTo;

            int index;

            if (!(relatedTo.CompareToKey(TQRelateToKeys.DistrictSize) ||
                  relatedTo.CompareToKey(TQRelateToKeys.SchoolSize) ||
                  relatedTo.CompareToKey(TQRelateToKeys.Spending)))
            {
                index = cols.IndexOf(v_TeacherQualificationsScatterplot.RelateToValue);
                cols.Insert(index, v_TeacherQualificationsScatterplot.RelateToNumerator);
            }

            return(cols);
        }
        public override List <string> GetVisibleColumns()
        {
            List <string> cols = base.GetVisibleColumns();

            TQRelateTo        relatedTo       = GlobalValues.TQRelateTo;
            TQTeacherVariable teacherVariable = GlobalValues.TQTeacherVariable;

            //doesn't follow other pages pattern
            cols.Clear();
            // Always display this column
            cols.Add(v_TeacherQualificationsScatterplot.LinkedName);

            if (relatedTo.CompareToKey(TQRelateToKeys.Spending))
            {
                cols.Add(v_TeacherQualificationsScatterplot.RelateToValue);
            }

            else if (relatedTo.CompareToKey(TQRelateToKeys.DistrictSize) ||
                     relatedTo.CompareToKey(TQRelateToKeys.SchoolSize))
            {
                cols.Add(v_TeacherQualificationsScatterplot.RelateToDenominator);
            }
            else
            {
                cols.Add(v_TeacherQualificationsScatterplot.RelateToDenominator);
                cols.Add(v_TeacherQualificationsScatterplot.RelateToValue);
            }

            cols.Add(v_TeacherQualificationsScatterplot.FTETotal);

            // Teacher Variable column to display

            if (teacherVariable.CompareToKey(TQTeacherVariableKeys.WiscLicense))
            {
                cols.Add(
                    v_TeacherQualificationsScatterplot.FTELicenseFull);
                cols.Add(
                    v_TeacherQualificationsScatterplot.LicenseFullFTEPercentage);
            }
            else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.EmergencyLic))
            {
                cols.Add(
                    v_TeacherQualificationsScatterplot.LicenseEmerFTE);
                cols.Add(
                    v_TeacherQualificationsScatterplot.LicenseEmerFTEPercentage);
            }

            else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.NoLicense))
            {
                cols.Add(v_TeacherQualificationsScatterplot.LicenseNoFTE);
                cols.Add(v_TeacherQualificationsScatterplot.LicenseNoFTEPercentage);
            }

            else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.DistrictExp))
            {
                cols.Add(v_TeacherQualificationsScatterplot.LocalExperience5YearsOrMoreFTE);
                cols.Add(v_TeacherQualificationsScatterplot.LocalExperience5YearsOrMoreFTEPercentage);
            }

            else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.TotalExp))
            {
                cols.Add(v_TeacherQualificationsScatterplot.TotalExperience5YearsOrMoreFTE);
                cols.Add(v_TeacherQualificationsScatterplot.TotalExperience5YearsOrMoreFTEPercentage);
            }

            else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.Degree))
            {
                cols.Add(v_TeacherQualificationsScatterplot.DegreeMastersOrHigherFTE);
                cols.Add(v_TeacherQualificationsScatterplot.DegreeMastersOrHigherFTEPercentage);
            }

            else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.ESEA))
            {
                cols.Add(v_TeacherQualificationsScatterplot.EHQYesFTE);
                cols.Add(v_TeacherQualificationsScatterplot.EHQYesFTEPercentage);
            }

            return(cols);
        }
        /// <summary>
        ///  Set up graph
        /// </summary>
        /// <param name="ds"></param>
        private void SetUpChart(DataSet ds)
        {
            try
            {
                scatterplot.Title = DataSetTitle;

                #region X-Axis settings

                TQRelateTo relatedTo        = GlobalValues.TQRelateTo;
                string     xValueColumnName = string.Empty;
                int        xMin             = 0;
                int        xMax             = 100;
                int        xStep            = 10;
                string     axisXDescription = string.Empty;
                int        maxValueInResult = 0;

                if (relatedTo.CompareToKey(TQRelateToKeys.DistrictSize) ||
                    relatedTo.CompareToKey(TQRelateToKeys.SchoolSize))
                {
                    xValueColumnName = v_TeacherQualificationsScatterplot.RelateToDenominator;
                }
                else
                {
                    xValueColumnName = v_TeacherQualificationsScatterplot.RelateToValue;
                }

                if (relatedTo.CompareToKey(TQRelateToKeys.DistrictSize) ||
                    relatedTo.CompareToKey(TQRelateToKeys.SchoolSize) ||
                    relatedTo.CompareToKey(TQRelateToKeys.Spending))
                {
                    foreach (DataRow row in DataSet.Tables[0].Rows)
                    {
                        try
                        {
                            if (maxValueInResult < (int)Convert.ToDouble(row[xValueColumnName].ToString().Trim()))
                            {
                                maxValueInResult = (int)Convert.ToDouble(row[xValueColumnName].ToString().Trim());
                            }
                        }
                        catch
                        {
                            continue;
                        }
                    }
                }


                if (relatedTo.CompareToKey(TQRelateToKeys.Spending))
                {
                    axisXDescription = "District Current Education Cost Per Member";
                    xMax             = maxValueInResult + 1;
                    xStep            = 2000;
                    scatterplot.AxisX.LabelsFormat.Format = ChartFX.WebForms.AxisFormat.Currency;
                }
                else if (relatedTo.CompareToKey(TQRelateToKeys.DistrictSize))
                {
                    axisXDescription = "District Size -- Number of Students Enrolled";
                    xMax             = maxValueInResult + 1;
                    xStep            = 10000;
                    scatterplot.AxisX.LabelsFormat.Format = ChartFX.WebForms.AxisFormat.Number;
                }
                else if (relatedTo.CompareToKey(TQRelateToKeys.SchoolSize))
                {
                    axisXDescription = "School Size -- Number of Students Enrolled";
                    xMax             = maxValueInResult + 1;
                    xStep            = 200;
                    scatterplot.AxisX.LabelsFormat.Format = ChartFX.WebForms.AxisFormat.Number;
                }
                else
                {
                    axisXDescription = relatedTo.Key.Replace("&#37;", "Percent of Students Who Are");
                    scatterplot.AxisX.LabelsFormat.CustomFormat = "0" + "\\%";
                }

                scatterplot.XValueColumnName = xValueColumnName;
                scatterplot.AxisXMin         = xMin;
                scatterplot.AxisXMax         = xMax;
                scatterplot.AxisXStep        = xStep;
                scatterplot.AxisXDescription = axisXDescription;
                #endregion

                #region Y-Axis settings

                string            yValueColumnName = string.Empty;
                TQTeacherVariable teacherVariable  = base.GlobalValues.TQTeacherVariable;
                if (teacherVariable.CompareToKey(TQTeacherVariableKeys.WiscLicense))
                {
                    yValueColumnName = v_TeacherQualificationsScatterplot.LicenseFullFTEPercentage;
                }
                else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.EmergencyLic))
                {
                    yValueColumnName = v_TeacherQualificationsScatterplot.LicenseEmerFTEPercentage;
                }

                else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.NoLicense))
                {
                    yValueColumnName = v_TeacherQualificationsScatterplot.LicenseNoFTEPercentage;
                }

                else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.DistrictExp))
                {
                    yValueColumnName = v_TeacherQualificationsScatterplot.LocalExperience5YearsOrMoreFTEPercentage;
                }

                else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.TotalExp))
                {
                    yValueColumnName = v_TeacherQualificationsScatterplot.TotalExperience5YearsOrMoreFTEPercentage;
                }

                else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.Degree))
                {
                    yValueColumnName = v_TeacherQualificationsScatterplot.DegreeMastersOrHigherFTEPercentage;
                }

                else if (teacherVariable.CompareToKey(TQTeacherVariableKeys.ESEA))
                {
                    yValueColumnName = v_TeacherQualificationsScatterplot.EHQYesFTEPercentage;
                }
                scatterplot.YValueColumnName = yValueColumnName;
                scatterplot.AxisYMin         = 0;
                scatterplot.AxisYMax         = 100;
                scatterplot.AxisYStep        = 10;
                scatterplot.AxisYDescription = "Percent of FTE Teachers With \n" + GlobalValues.TQTeacherVariable.Key.Replace("&#37;", String.Empty);
                scatterplot.AxisY.LabelsFormat.CustomFormat = "0" + "\\%";

                #endregion

                ArrayList friendlySeriesName = new ArrayList();
                if (GlobalValues.OrgLevel.Key == OrgLevelKeys.School)
                {
                    friendlySeriesName.Add("Current School");
                    friendlySeriesName.Add("Other Schools");
                }
                else //HT: district level. There is no state level in live page. To check if we should show state level?
                {
                    friendlySeriesName.Add("Current District");

                    friendlySeriesName.Add("Other Districts");
                }
                scatterplot.FriendlySeriesName = friendlySeriesName;
                if ((GlobalValues.TQRelateTo.Key == TQRelateToKeys.DistrictSize) && ((SligoCS.Web.WI.WebUserControls.GraphBarChart.GetMaxRateInColumn(DataSet.Tables[0], v_TeacherQualificationsScatterplot.RelateToDenominator)) < 20000))
                {
                    scatterplot.AxisX.Step = 2000;
                }

                //scatterplot.DataSource = DataSet.Tables[0];
                //scatterplot.DataBind();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
        }