private void FillDropDowns(AssessmentClassScoreViewModel model, bool isPostBack)
 {
     siteUser = ((SiteUser)Session["SiteUser"]);
     db = new dbTIREntities();
     commonService = new CommonService(siteUser, db);
     modelServices = new ModelServices();
     model.DropDown = new DropDownData();
     int schoolYearId = int.Parse(model.SchoolYearId);
     model.DistrictName = siteUser.Districts[0].Name;
     model.DistrictId = siteUser.Districts[0].Id;
     model.Assessment = commonService.GetAssessmentType();
     model.SchoolYears = commonService.GetSchoolYear();
     model.SchoolTerms = commonService.GetSchoolTerm();
     model.Subjects = commonService.GetSubjects();
     int[] userSchools = modelServices.getSchoolsByUserId(siteUser.EdsUserId).ToArray();
     model.DropDown.School = new SchoolDropDown(modelServices.GetSchoolDropDownData(siteUser.EdsUserId, schoolYearId), true, "--SELECT--", "");
     int[] schoolsTeacher = modelServices.getTeachersBySchoolsId(userSchools).ToArray();
     if (isPostBack)
     {
         model.DropDown.Teacher = new TeacherDropDown(modelServices.TeacherDropDownDataBySchoolAndYear(new int[] { int.Parse(model.SchoolId) }, schoolYearId, model.DistrictId), "--SELECT--", "");
         model.DropDown.SchoolClass = new ClassDropDown(modelServices.GetClassesByTeacher(schoolYearId, new[] { int.Parse(model.TeacherId) }), "--SELECT--", "");
     }
     else
     {
         model.DropDown.Teacher = new TeacherDropDown(modelServices.TeacherDropDownDataBySchoolAndYear(userSchools, schoolYearId, model.DistrictId), "--SELECT--", "");
         model.DropDown.SchoolClass = new ClassDropDown(modelServices.GetClassesByTeacher(schoolYearId, schoolsTeacher), "--SELECT--", "");
     }
 }
        public ActionResult SummaryReport(bool viewMeetExceedSummary = true)
        {
            try
            {
                SetNavigationLinksUrl();
                ViewBag.SummaryLink = "SummaryReport";

                SetViewBag(viewMeetExceedSummary);
                SiteUser su = ((SiteUser)Session["SiteUser"]);
                ModelServices modelServices = new ModelServices();
                StudentService studentService = new StudentService(su, entities);

                int defaultDistrict = su.Districts[0].Id;
                int schoolYearId = modelServices.SchoolYearId();
                int[] userSchools = modelServices.getSchoolsByUserId(su.EdsUserId).ToArray();

               

                TIRSummaryModel data = new TIRSummaryModel();
                data.SchoolYear = modelServices.SchoolYearDescription();
                data.DropDown = new DropDownData();
                data.DropDown.Year = new YearDropDown(modelServices.SchoolYearDropDownData());
                data.DropDown.Year.SelectedYear = schoolYearId;
                data.DropDown.District = new DistrictDropDown(modelServices.DistrictDropDownDataByUser(su.EdsUserId));

                data.DropDown.Race = new RaceDropDown(modelServices.DropDownDataForRace(), true);
                data.DropDown.Race.SelectedRace = -1;
                data.DropDown.Gender = new GenderDropDown(modelServices.DropDownDataForGender(), true);
                data.DropDown.Gender.SelectedGender = -1;

                data.DropDown.School = new SchoolDropDown(modelServices.GetSchoolDropDownData(su.EdsUserId, schoolYearId));
                if (su.isTeacher)
                {
                    data.DropDown.Teacher = new TeacherDropDown(
                        new List<DropDownIdName>() { new DropDownIdName() { Id = su.EdsUserId, Name = su.UserFullName } });
                    data.DropDown.SchoolClass = new ClassDropDown(modelServices.GetClassesByTeacher(schoolYearId, new[] { su.EdsUserId }));
                }
                else // data administrator and eds administrator
                {
                    int[] schoolsTeacher = modelServices.getTeachersBySchoolsId(userSchools).ToArray();
                    data.DropDown.Teacher = new TeacherDropDown(modelServices.TeacherDropDownDataBySchoolAndYear(userSchools, schoolYearId, defaultDistrict));
                    data.DropDown.SchoolClass = new ClassDropDown(modelServices.GetClassesByTeacher(schoolYearId, schoolsTeacher));
                }

                var filterParameter = new FilterParameter
                {
                    ClassId = classDefaultValue,
                    Teacher = su.EdsUserId,
                    School = userSchools.First(),
                    Year = schoolYearId,
                    SchoolYear = data.SchoolYear
                };
                data.SummaryList = modelServices.GetSummaryReport(filterParameter);
                var reportFilterViewModel = ReportsFilterHelper.PopulateReportFilterViewModel(filterParameter, modelServices, su);
                ViewBag.ReportFilters = reportFilterViewModel;
                return View(data);
            }
            catch (Exception ex)
            {
                Logging log = new Logging();
                log.LogException(ex);
                return View("GeneralError");
            }
        }