示例#1
0
        public ActionResult DistrictAdmin()
        {
            Trace.Assert(Context.PersonId.HasValue);
            Trace.Assert(Context.SchoolYearId.HasValue);

            var distictAdmin = SchoolLocator.PersonService.GetPersonDetails(Context.PersonId.Value);
            var district     = PrepareCommonViewData();

            ViewData[ViewConstants.ROLE_NAME] = CoreRoles.DISTRICT_ADMIN_ROLE.LoweredName;
            PrepareJsonData(PersonViewData.Create(distictAdmin), ViewConstants.CURRENT_PERSON);
            var gradeLevel = SchoolLocator.GradeLevelService.GetGradeLevels();

            PrepareJsonData(GradeLevelViewData.Create(gradeLevel), ViewConstants.GRADE_LEVELS);
            PrepareJsonData(AttendanceReasonDetailsViewData.Create(SchoolLocator.AttendanceReasonService.GetAll()), ViewConstants.ATTENDANCE_REASONS);

            var sy = SchoolLocator.SchoolYearService.GetCurrentSchoolYear();

            PrepareJsonData(SchoolYearViewData.Create(sy), ViewConstants.SCHOOL_YEAR);
            PrepareJsonData(SchoolLocator.SchoolYearService.GetYears(), ViewConstants.YEARS);

            var announcementAttributes = SchoolLocator.AnnouncementAttributeService.GetList(true);

            PrepareJsonData(AnnouncementAttributeViewData.Create(announcementAttributes), ViewConstants.ANNOUNCEMENT_ATTRIBUTES);

            var gradingPeriods       = SchoolLocator.GradingPeriodService.GetGradingPeriodsDetails(Context.SchoolYearId.Value);
            var currentGradingPeriod = SchoolLocator.GradingPeriodService.GetGradingPeriodDetails(Context.SchoolYearId.Value, Context.NowSchoolYearTime.Date);

            PrepareJsonData(GradingPeriodViewData.Create(gradingPeriods), ViewConstants.GRADING_PERIODS);
            PrepareJsonData(ShortGradingPeriodViewData.Create(currentGradingPeriod), ViewConstants.GRADING_PERIOD);

            var mps = SchoolLocator.MarkingPeriodService.GetMarkingPeriods(sy.Id);

            PrepareJsonData(MarkingPeriodViewData.Create(mps), ViewConstants.MARKING_PERIODS);

            var schoolOption = SchoolLocator.SchoolService.GetSchoolOption();

            PrepareJsonData(SchoolOptionViewData.Create(schoolOption), ViewConstants.SCHOOL_OPTIONS);

            var alternateScore = SchoolLocator.AlternateScoreService.GetAlternateScores();

            PrepareJsonData(AlternateScoreViewData.Create(alternateScore), ViewConstants.ALTERNATE_SCORES);

            var gradingComments = SchoolLocator.GradingCommentService.GetGradingComments();

            PrepareJsonData(GradingCommentViewData.Create(gradingComments), ViewConstants.GRADING_COMMMENTS);

            ViewData[ViewConstants.REPORT_CARDS_ENABLED] = MasterLocator.DistrictService.IsReportCardsEnabled();

            var ip = RequestHelpers.GetClientIpAddress(Request);

            MasterLocator.UserTrackingService.IdentifyDistrictAdmin(distictAdmin.Email, "", "",
                                                                    district.Name, null, Context.DistrictTimeZone, Context.Role.Name, ip, Context.SCEnabled);
            return(View());
        }
示例#2
0
        private void PrepareTeacherJsonData()
        {
            var startProcessingTime = DateTime.Now.TimeOfDay;

            var timeCallBuilder = new StringBuilder();

            Trace.Assert(Context.PersonId.HasValue);

            var startupData = ProcessMethodAndCallTime(() => SchoolLocator.SchoolService.GetStartupData(), timeCallBuilder, "Retrieving StartUpData ");
            var district    = ProcessMethodAndCallTime(() => PrepareCommonViewDataForSchoolPerson(startupData), timeCallBuilder, "PrepareCommonSchoolPersonData");

            var person = startupData.Person;

            ProcessMethodAndCallTime(() => ProcessFirstLogin(person), timeCallBuilder, "ProcessFirstLogin");
            var personView = PersonInfoViewData.Create(person);

            ProcessMethodAndCallTime(() => ProcessActive(person, personView), timeCallBuilder, "ProcessActive");
            PrepareJsonData(personView, ViewConstants.CURRENT_PERSON);


            if (!CanTeacherViewChalkable())
            {
                return;
            }

            var classes    = startupData.Classes;
            var classNames = classes.Select(x => x.Name).ToList();

            var schoolOption = startupData.SchoolOption;

            PrepareJsonData(SchoolOptionViewData.Create(schoolOption), ViewConstants.SCHOOL_OPTIONS);

            var dayTypes    = SchoolLocator.DayTypeService.GetDayTypes(classes.SelectMany(x => x.ClassPeriods, (a, b) => b.DayTypeRef).ToList());
            var classesList = ClassComplexViewData.Create(classes, startupData.Rooms, dayTypes).ToList();

            PrepareJsonData(classesList, ViewConstants.CLASSES);

            var gradeLevel = SchoolLocator.GradeLevelService.GetGradeLevels();

            PrepareJsonData(GradeLevelViewData.Create(gradeLevel), ViewConstants.GRADE_LEVELS);

            ProcessMethodAndCallTime(() => PrepareClassesAdvancedData(startupData), timeCallBuilder, "Retrieving Activity Category from Inow");
            PrepareClassesAdvancedData(startupData);

            PrepareJsonData(GradingCommentViewData.Create(startupData.GradingComments), ViewConstants.GRADING_COMMMENTS);

            PrepareJsonData(AttendanceReasonDetailsViewData.Create(startupData.AttendanceReasons), ViewConstants.ATTENDANCE_REASONS);

            var announcementAttributes = ProcessMethodAndCallTime(() => SchoolLocator.AnnouncementAttributeService.GetList(true), timeCallBuilder, "Retrieving AnnouncementAttribute");

            PrepareJsonData(AnnouncementAttributeViewData.Create(announcementAttributes), ViewConstants.ANNOUNCEMENT_ATTRIBUTES);

            var ip = RequestHelpers.GetClientIpAddress(Request);

            MasterLocator.UserTrackingService.IdentifyTeacher(Context.Login, person.FirstName, person.LastName, district.Name,
                                                              classNames, person.FirstLoginDate, Context.DistrictTimeZone, ip, Context.SCEnabled);

            var time = DateTime.Now.TimeOfDay - startProcessingTime;

            if (time.Seconds > 5)
            {
                var message = $"Timeout Error. Teacher.aspx performance time issue. Processing Time {time} \n";
                var ex      = new ChalkableException(message + timeCallBuilder);
                SendErrorToRaygun(ex, "Teacher SisUserLogin Performance Issue ", SchoolLocator.Context);
            }
        }