public ActionResult UpdateGrid(string hiddenSchoolFilter, string hiddenSchoolYearFilter)
        {
            try
            {
                dbTIREntities db = new dbTIREntities();
                SiteUser siteUser = ((SiteUser)Session["SiteUser"]);
                StudentService studentService = new StudentService(siteUser, db);
                SchoolService schoolService = new SchoolService(siteUser, db);
                ModelServices modelService = new ModelServices();
                ViewBag.DistrictDesc = siteUser.Districts[0].Name;
                int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(hiddenSchoolYearFilter));
                ViewBag.SchoolId = modelService.DropDownDataSchool(hiddenSchoolFilter, siteUser.EdsUserId, schoolYearId, true);
                ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "STUDENT");
                ViewBag.SchoolYearList = schoolService.DropDownDataSchoolYear(hiddenSchoolYearFilter);

                ViewBag.SchoolYear = hiddenSchoolYearFilter;

                return View("Index", new SiteModels()
                {
                    Students = studentService.GetViewData(hiddenSchoolYearFilter, hiddenSchoolFilter)
                });
            }
            catch (Exception ex)
            {
                Logging log = new Logging();
                log.LogException(ex);
                return View("GeneralError");
            }
        }
 public ActionResult UpdateGrid(string hiddenSchoolFilter, string schoolYearFilter)
 {
     try
     {
         db = new dbTIREntities();
         siteUser = ((SiteUser)Session["SiteUser"]);
         userService = new UserService(siteUser, db);
         schoolService = new SchoolService(siteUser, db);
         modelService = new ModelServices();
         ViewBag.SchoolYearList = schoolService.DropDownDataSchoolYear(schoolYearFilter);
         int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(schoolYearFilter));
         FillViewBagValues(siteUser.Districts[0].Name, hiddenSchoolFilter, siteUser.RoleDesc, schoolYearId);
         return View("Index", userService.GetViewData(schoolYearFilter, hiddenSchoolFilter, ""));
     }
     catch (Exception ex)
     {
         Logging log = new Logging();
         log.LogException(ex);
         return View("GeneralError");
     }
 }
 private void FillUserExtendedCommanData(ModelServices modelService, tblUserExt tbluserExtended)
 {
     ViewBag.RoleId = new SelectList(modelService.GetRolesForRole((int)(siteUser.Role)), "RoleId", "RoleDesc", tbluserExtended.RoleId);
     ViewBag.SchoolYear = schoolService.GetSchoolYearDownData((int)tbluserExtended.SchoolYearId);
     int currentSchoolYear = Convert.ToInt32(schoolService.GetCurrentSchoolYear());
     ViewBag.CurrentSchoolYearId = modelService.GetSchoolYearId(currentSchoolYear);
     var classData = modelService.GetClassesByTeacher((int)tbluserExtended.SchoolYearId, new[] { (int)tbluserExtended.UserId });
     tbluserExtended.SchoolClasses = new List<SchoolClass>();
     foreach (var classItem in classData)
     {
         SchoolClass classItems = new SchoolClass() { ClassDesc = classItem.Name, SchoolClassId = classItem.Id };
         tbluserExtended.SchoolClasses.Add(classItems);
     }
 }
        public void PopulateViewData(StudentExt studentExt)
        {

            dbTIREntities db = new dbTIREntities();
            SiteUser siteUser = ((SiteUser)Session["SiteUser"]);
            StudentService studentService = new StudentService(siteUser, db);
            ModelServices modelService = new ModelServices();

            studentExt.DistrictId = siteUser.Districts[0].Id;
            studentExt.DistrictDesc = siteUser.Districts[0].Name;
            studentExt.StudentClasses = studentExt.StudentId != 0 ? modelService.GetClassesByStudent(studentExt.StudentId, studentExt.SchoolYear) : null;
            studentExt.SchoolYears = studentExt.StudentId != 0 ? modelService.GetSchoolYearByStudent(studentExt.StudentId) : null;

            studentExt.DropDown = new DropDownData();
            int schoolYearId = modelService.GetSchoolYearId(studentExt.SchoolYear);
            studentExt.DropDown.School = new SchoolDropDown(modelService.GetSchoolDropDownData(siteUser.EdsUserId, schoolYearId), false);
            studentExt.DropDown.School.SelectedSchool = studentExt.ServingSchoolId;
            studentExt.DropDown.Grade = new GradeDropDown(studentService.DropDownDataForGrade());
            studentExt.DropDown.Grade.SelectedGrade = (studentExt.GradeLevel != null) ? (int)studentExt.GradeLevel : -1;
            studentExt.DropDown.Gender = new GenderDropDown(modelService.DropDownDataForGender());
            studentExt.DropDown.Gender.SelectedGender = (studentExt.GenderId != null) ? (int)studentExt.GenderId : 1;
            studentExt.DropDown.Lineage = new LineageDropDown(studentService.DropDownDataForLineage());
            studentExt.DropDown.Lineage.SelectedLineage = (studentExt.LineageId != null) ? (int)studentExt.LineageId : -1;
            studentExt.DropDown.HomeLanguage = new LanguageDropDown(studentService.DropDownDataForLanguage());
            studentExt.DropDown.HomeLanguage.SelectedLanguage = (studentExt.HomeLanguageId != null) ? (int)studentExt.HomeLanguageId : -1;
            studentExt.DropDown.NativeLanguage = new LanguageDropDown(studentService.DropDownDataForLanguage());
            studentExt.DropDown.NativeLanguage.SelectedLanguage = (studentExt.NativeLanguageId != null) ? (int)studentExt.NativeLanguageId : -1;
            studentExt.DropDown.Race = new RaceDropDown(modelService.DropDownDataForRace());
            studentExt.DropDown.Race.SelectedRace = (studentExt.RaceId != null) ? (int)studentExt.RaceId : -1;
            ViewBag.SchoolYear = studentExt.SchoolYear;
        }
 public ActionResult GetSchoolByYear(string schoolYear)
 {
     ModelServices modelService = new ModelServices();
     SiteUser siteUser = ((SiteUser)Session["SiteUser"]);
     int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(schoolYear));
     return Json(modelService.DropDownDataSchool("", siteUser.EdsUserId, schoolYearId, true), JsonRequestBehavior.AllowGet);
 }
        public ActionResult Search(string searchClass, string hiddenSchoolFilterSearch, string hiddenSchoolYearFilterSearch)
        {
            try
            {
                dbTIREntities db = new dbTIREntities();

                SiteUser siteUser = ((SiteUser)Session["SiteUser"]);
                ClassService classService = new ClassService(siteUser, db);
                SchoolService schoolService = new SchoolService(siteUser, db);
                ModelServices modelService = new ModelServices();
                ViewBag.DistrictDesc = siteUser.Districts[0].Name;
                int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(hiddenSchoolYearFilterSearch));
                ViewBag.SchoolId = modelService.DropDownDataSchool(hiddenSchoolFilterSearch, siteUser.EdsUserId, schoolYearId, true);
                ViewBag.SchoolYear = schoolService.DropDownDataSchoolYear(hiddenSchoolYearFilterSearch);
                ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "CLASS");
                return View("Index", new SiteModels()
                {
                    SchoolClasses = classService.GetViewData(hiddenSchoolYearFilterSearch, hiddenSchoolFilterSearch, searchClass)
                });
            }
            catch (Exception ex)
            {
                Logging log = new Logging();
                log.LogException(ex);
                return View("GeneralError");
            }
        }