public static DataTable GetCredentialReport(string selectedViewBy, int selectedSchoolID, int selectedTeacherId, int selectedClassID,
            List<Demographics.ValueObject> selectedDemographics, int selectedGroupID, int selectedStudentID, string selectedAlignments, string selectedYear = null, int credentialID = 0, int levelID = 0)
        {
            DataTable credentialReport = new DataTable();

            drGeneric_Int drAlignments = new drGeneric_Int();
            if (!string.IsNullOrEmpty(selectedAlignments))
            {
                string[] arAlignments = (selectedAlignments).Split(',');
                int alignment = 0;
                foreach (string strAlign in arAlignments)
                    if (Int32.TryParse(strAlign, out alignment))
                        drAlignments.Add(alignment);
            }

            var objparams = new object[] { 
                    selectedViewBy ?? "", 
                    selectedSchoolID, 
                    selectedTeacherId,
                    selectedClassID,
                    selectedStudentID,
                    selectedGroupID,
                    drAlignments.ToSql(),
                    selectedYear??"",
                    selectedDemographics.Any(x=>x.DemoLabel=="Race")?selectedDemographics.Where(x=>x.DemoLabel=="Race").Select(x=>x.DemoValue).First():"",
                    selectedDemographics.Any(x=>x.DemoLabel=="Students With Disabilities")?selectedDemographics.Where(x=>x.DemoLabel=="Students With Disabilities").Select(x=>x.DemoValue).First():"",
                    selectedDemographics.Any(x=>x.DemoLabel=="English Language Learner")?selectedDemographics.Where(x=>x.DemoLabel=="English Language Learner").Select(x=>x.DemoValue).First():"",
                    selectedDemographics.Any(x=>x.DemoLabel=="Economically Disadvantaged")?selectedDemographics.Where(x=>x.DemoLabel=="Economically Disadvantaged").Select(x=>x.DemoValue).First():"",
                    selectedDemographics.Any(x=>x.DemoLabel=="Early Intervention Program")?selectedDemographics.Where(x=>x.DemoLabel=="Early Intervention Program").Select(x=>x.DemoValue).First():"",
                    selectedDemographics.Any(x=>x.DemoLabel=="Gender")?selectedDemographics.Where(x=>x.DemoLabel=="Gender").Select(x=>x.DemoValue).First():"",
                    selectedDemographics.Any(x=>x.DemoLabel=="Gifted")?selectedDemographics.Where(x=>x.DemoLabel=="Gifted").Select(x=>x.DemoValue).First():"",
                    credentialID,
                    levelID
                };

            DataSet dsCredentialReport = ThinkgateDataAccess.FetchDataSet(Thinkgate.Base.Classes.Data.StoredProcedures.E3_CREDENTIALS_TRACKINGREPORT_GET, objparams);
            return dsCredentialReport.Tables[0];
        }
        public static DataSet GetCredentialReport(string selectedCriteria)
        {
            DataTable credentialReport = new DataTable();

            var Tempobjparams = selectedCriteria.Split(';');
            string selectedViewBy = Tempobjparams[0];
            int selectedSchoolID =Tempobjparams[1]==""?0: Convert.ToInt32(Tempobjparams[1]);
            int selectedTeacherId = Tempobjparams[2] == "" ? 0 : Convert.ToInt32(Tempobjparams[2]);
            int selectedClassID = Tempobjparams[3] == "" ? 0 : Convert.ToInt32(Tempobjparams[3]);
            int selectedGroupID = Tempobjparams[4] == "" ? 0 : Convert.ToInt32(Tempobjparams[4]);
            int selectedStudentID = Tempobjparams[5] == "" ? 0 : Convert.ToInt32(Tempobjparams[5]);
            string selectedAlignments = Tempobjparams[6];
            string selectedYear = Tempobjparams[7];


            string Race = Tempobjparams[8];
            string Students_With_Disabilities = Tempobjparams[9];
            string English_Language_Learner = Tempobjparams[10];
            string Economically_Disadvantaged = Tempobjparams[11];
            string Early_Intervention_Program = Tempobjparams[12];
            string Gender = Tempobjparams[13];
            string Gifted = Tempobjparams[14];
            int credentialID = Tempobjparams[15] == "" ? 0 : Convert.ToInt32(Tempobjparams[15]);
            int levelID = Tempobjparams[16] == "" ? 0 : Convert.ToInt32(Tempobjparams[16]);

            drGeneric_Int drAlignments = new drGeneric_Int();
            if (!string.IsNullOrEmpty(selectedAlignments))
            {
                string[] arAlignments = (selectedAlignments).Split(',');
                int alignment = 0;
                foreach (string strAlign in arAlignments)
                    if (Int32.TryParse(strAlign, out alignment))
                        drAlignments.Add(alignment);
            }



            var objparams = new object[] { 
                    selectedViewBy ?? "", 
                    selectedSchoolID, 
                    selectedTeacherId,
                    selectedClassID,
                    selectedStudentID,
                    selectedGroupID,
                    drAlignments.ToSql(),
                    selectedYear??"",
                    Race,
                   Students_With_Disabilities,
                   English_Language_Learner,
                   Economically_Disadvantaged,
                   Early_Intervention_Program,
                   Gender,
                   Gifted,
                    credentialID,
                    levelID
                };

            DataSet dsCredentialReport = ThinkgateDataAccess.FetchDataSet(Thinkgate.Base.Classes.Data.StoredProcedures.E3_CREDENTIALS_TRACKINGREPORT_GET, objparams);
            return dsCredentialReport;
        }