public GradingStandardInfo SetGrade(int studentId, int standardId, int classId, int gradingPeriodId, int?alphaGradeId, string note)
        {
            var standardScore = new StandardScore
            {
                SectionId  = classId,
                StudentId  = studentId,
                StandardId = standardId,
                Note       = note,
                EnteredScoreAlphaGradeId = alphaGradeId,
                GradingPeriodId          = gradingPeriodId
            };
            var res      = ConnectorLocator.StandardScoreConnector.Update(classId, studentId, standardId, gradingPeriodId, standardScore);
            var standard = ServiceLocator.StandardService.GetStandardById(standardId);

            return(GradingStandardInfo.Create(res, standard));
        }
Esempio n. 2
0
        public Task <IList <GradingStandardInfo> > GetGradingStandards(int classId, int?gradingPeriodId, bool reCalculateStandards = true)
        {
            var standardScores = GetStandardScores(classId, null, gradingPeriodId);
            var standards      = ServiceLocator.StandardService.GetStandards(classId, null, null);
            var res            = new List <GradingStandardInfo>();

            foreach (var standardScore in standardScores)
            {
                var standard = standards.FirstOrDefault(x => x.Id == standardScore.StandardId);
                if (standard != null)
                {
                    res.Add(GradingStandardInfo.Create(standardScore, standard));
                }
            }
            return(new Task <IList <GradingStandardInfo> >(() => res));
        }
Esempio n. 3
0
        public GradingStandardInfo SetGrade(int studentId, int standardId, int classId, int gradingPeriodId, int?alphaGradeId, string note)
        {
            var alphaGradeName = alphaGradeId.HasValue ? ((DemoAlphaGradeService)ServiceLocator.AlphaGradeService).GetAlphaGradeById(alphaGradeId.Value).Name : "";
            var standardScore  = new StandardScore
            {
                SectionId  = classId,
                StudentId  = studentId,
                StandardId = standardId,
                Note       = note,
                EnteredScoreAlphaGradeId    = alphaGradeId,
                ComputedScoreAlphaGradeId   = alphaGradeId,
                EnteredScoreAlphaGradeName  = alphaGradeName,
                ComputedScoreAlphaGradeName = alphaGradeName,
                GradingPeriodId             = gradingPeriodId
            };

            standardScore = StandardScoreStorage.Update(classId, studentId, standardId, gradingPeriodId, standardScore);
            var standard = ServiceLocator.StandardService.GetStandardById(standardId);

            return(GradingStandardInfo.Create(standardScore, standard));
        }
        public async Task <IList <GradingStandardInfo> > GetGradingStandards(int classId, int?gradingPeriodId, bool reCalculateStandards = true)
        {
            var isTeacherClass             = DoRead(u => new ClassTeacherDataAccess(u).Exists(classId, Context.PersonId));
            Task <Gradebook> calculateTask = null;

            if (reCalculateStandards && GradebookSecurity.CanReCalculateGradebook(Context, isTeacherClass))
            {
                calculateTask = ConnectorLocator.GradebookConnector.Calculate(classId, gradingPeriodId);
            }

            var standards = ServiceLocator.StandardService.GetGridStandardsByPacing(classId, null, null, gradingPeriodId);

            if (calculateTask != null)
            {
                await calculateTask;
            }
            var standardScores = ConnectorLocator.StandardScoreConnector.GetStandardScores(classId, null, gradingPeriodId);

            standards = standards.Where(s => s.IsActive || standardScores.Any(ss => ss.StandardId == s.Id && ss.HasScore)).ToList();
            var res = GradingStandardInfo.Create(standardScores, standards);

            return(res);
        }