Beispiel #1
0
 public void UpdateReportCardsLogo(int?schoolId, byte[] logoIcon)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u =>
     {
         var da  = new DataAccessBase <ReportCardsLogo, int>(u);
         var res = da.GetAll(new AndQueryCondition {
             { nameof(ReportCardsLogo.SchoolRef), schoolId }
         })
                   .FirstOrDefault();
         var logoAddress = UploadLogo(schoolId, logoIcon);
         if (res == null)
         {
             res = new ReportCardsLogo {
                 SchoolRef = schoolId, LogoAddress = logoAddress
             };
             da.Insert(res);
         }
         else if (logoIcon == null)
         {
             da.Delete(res.Id);
         }
         else
         {
             res.SchoolRef   = schoolId;
             res.LogoAddress = logoAddress;
             da.Update(res);
         }
     });
 }
Beispiel #2
0
        public Group AddGroup(string name, IntList studentIds)
        {
            if (!Context.PersonId.HasValue)
            {
                throw new UnassignedUserException();
            }
            if (string.IsNullOrEmpty(name))
            {
                throw new ChalkableException(string.Format(ChlkResources.ERR_PARAM_IS_MISSING_TMP, "Name"));
            }

            BaseSecurity.EnsureDistrictAdmin(Context);

            using (var uow = Update())
            {
                var da      = new GroupDataAccess(uow);
                var groupId = da.InsertWithEntityId(new Group {
                    Name = name, OwnerRef = Context.PersonId.Value
                });
                AssignStudentsToGroup(groupId, studentIds, uow);
                uow.Commit();
                var group = da.GetById(groupId);
                group.StudentCount = studentIds?.Count ?? 0;
                return(group);
            }
        }
Beispiel #3
0
 public AnnouncementDetails Create(DateTime expiresDate)
 {
     Trace.Assert(Context.PersonId.HasValue);
     BaseSecurity.EnsureDistrictAdmin(Context);
     using (var u = Update())
     {
         var date = Context.NowSchoolTime;
         var res  = CreateAdminAnnouncementDataAccess(u).Create(date, date, Context.PersonId.Value);
         u.Commit();
         return(res);
     }
 }
Beispiel #4
0
        public override void Submit(int announcementId)
        {
            Trace.Assert(Context.PersonId.HasValue);
            BaseSecurity.EnsureDistrictAdmin(Context);
            var res = GetAnnouncementDetails(announcementId);

            using (var uow = Update())
            {
                var da  = CreateAdminAnnouncementDataAccess(uow);
                var ann = da.GetAnnouncement(announcementId, Context.PersonId.Value);
                AnnouncementSecurity.EnsureInModifyAccess(ann, Context);
                ValidateAdminAnnouncement(ann, uow, da);
                ServiceLocator.AnnouncementAssignedAttributeService.ValidateAttributes(res.AnnouncementAttributes);
                if (ann.IsDraft)
                {
                    ann.Created = Context.NowSchoolTime;
                    ann.State   = AnnouncementState.Created;
                }
                da.Update(ann);
                uow.Commit();
            }
        }
        private async Task <ReportCard> GetInowReportData(ReportCardsInputModel inputModel)
        {
            Trace.Assert(ServiceLocator.Context.SchoolYearId.HasValue);
            Trace.Assert(ServiceLocator.Context.SchoolLocalId.HasValue);
            BaseSecurity.EnsureDistrictAdmin(ServiceLocator.Context);
            if (inputModel == null)
            {
                throw new ArgumentNullException(nameof(ReportCardsInputModel));
            }
            var studentIds = inputModel.StudentIds ?? new List <int>();

            if (inputModel.GroupIds != null && inputModel.GroupIds.Count > 0)
            {
                studentIds.AddRange(ServiceLocator.GroupService.GetStudentIdsByGroups(inputModel.GroupIds));
                studentIds = studentIds.Distinct().ToList();
            }
            var options = new ReportCardOptions
            {
                AbsenceReasonIds             = inputModel.AttendanceReasonIds,
                GradingPeriodId              = inputModel.GradingPeriodId,
                AcadSessionId                = ServiceLocator.Context.SchoolYearId.Value,
                IncludeAttendance            = inputModel.IncludeAttendance,
                IncludeGradingPeriodNotes    = inputModel.IncludeGradingPeriodNotes,
                IncludeComments              = inputModel.IncludeComments,
                IncludeMeritDemerit          = inputModel.IncludeMeritDemerit,
                IncludeWithdrawnStudents     = inputModel.IncludeWithdrawnStudents,
                IncludePromotionStatus       = inputModel.IncludePromotionStatus,
                IncludeYearToDateInformation = inputModel.IncludeYearToDateInformation,
                IncludeGradingScales         = inputModel.IncludeGradingScaleStandards || inputModel.IncludeGradingScaleTraditional,
                StudentIds       = studentIds,
                Recipient        = inputModel.RecipientStr,
                IncludeStandards = inputModel.StandardTypeEnum != StandardsType.None
            };

            return(await ConnectorLocator.ReportConnector.GetReportCardData(options));
        }
Beispiel #6
0
 public void AssignClassToMarkingPeriod(IList <MarkingPeriodClass> markingPeriodClasses)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new MarkingPeriodClassDataAccess(u).Insert(markingPeriodClasses));
 }
 public IList <StudentSchoolYear> GetStudentAssignments()
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     return(DoRead(u => new DataAccessBase <StudentSchoolYear>(u).GetAll()));
 }
 public IList <SchoolYear> Edit(IList <SchoolYear> schoolYears)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new SchoolYearDataAccess(u).Update(schoolYears));
     return(schoolYears);
 }
 public void Delete(IList <int> schoolYearIds)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new SchoolYearDataAccess(u).Delete(schoolYearIds));
 }
Beispiel #10
0
 public IList <ClassDetails> GetAllSchoolsActiveClasses()
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     return(DoRead(u => new ClassDataAccess(u).GetAllSchoolsActiveClasses()));
 }
Beispiel #11
0
 public void DeleteStandardSubjects(IList <int> ids)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new StandardSubjectDataAccess(u).Delete(ids));
 }
Beispiel #12
0
 public void EditStandardSubjects(IList <StandardSubject> standardSubjects)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new StandardSubjectDataAccess(u).Update(standardSubjects));
 }
Beispiel #13
0
 public void DeleteStandards(IList <Standard> standards)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new StandardDataAccess(u).Delete(standards));
 }
Beispiel #14
0
 public void DeleteClassStandards(IList <ClassStandard> classStandards)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new DataAccessBase <ClassStandard, int>(u).Delete(classStandards));
 }
Beispiel #15
0
 public void AddStudents(IList <ClassPerson> classPersons)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new ClassPersonDataAccess(u).Insert(classPersons));
 }
Beispiel #16
0
 public void DeleteStudent(IList <ClassPerson> classPersons)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new ClassPersonDataAccess(u).Delete(classPersons));
 }
Beispiel #17
0
 public void DeleteReportCardsLogo(int id)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new DataAccessBase <ReportCardsLogo, int>(u).Delete(id));
 }
Beispiel #18
0
 public void Edit(IList <Class> classes)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new ClassDataAccess(u).Update(classes));
 }
Beispiel #19
0
 public void SubmitApplicationBan(Guid applicationId, IList <Guid> schoolIds)
 {
     BaseSecurity.EnsureDistrictAdmin(Context);
     DoUpdate(u => new ApplicationSchoolOptionDataAccess(u).BanSchoolsByIds(applicationId, schoolIds));
 }