public void AddStandardSubjects(IList <StandardSubject> standardSubjects) { BaseSecurity.EnsureSysAdmin(Context); if (standardSubjects != null && standardSubjects.Count > 0) { DoUpdate(u => new StandardSubjectDataAccess(u).Insert(standardSubjects)); } }
public PaginatedList <BackgroundTaskLogItem> GetLogItems(Guid backgroundTaskId, int start, int count) { BaseSecurity.EnsureSysAdmin(Context); var helper = new TableHelper <BackgroundTaskLogItem>(); var items = helper.GetByPartKey(backgroundTaskId.ToString(), start, count); return(items); }
public void DeleteUsers(IList <int> localIds, Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { new UserDataAccess(uow).Delete(localIds, districtId); uow.Commit(); } }
public void Delete(IList <Person> persons) { BaseSecurity.EnsureSysAdmin(Context); if (!Context.DistrictId.HasValue) { throw new UnassignedUserException(); } DoUpdate(u => new PersonDataAccess(u).Delete(persons.Select(x => x.Id).ToList())); }
public void RerunTasks(IList <Guid> taskIds) { if (taskIds.Count == 0) { return; } BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new BackgroundTaskDataAccess(u).RerunTasks(taskIds)); }
public void UpdateAssessmentEnabled(Guid?districtId, Guid?schoolId, bool enabled) { BaseSecurity.EnsureSysAdmin(Context); if (districtId == null && schoolId == null) { throw new ChalkableException("Required districtId or schoolId!"); } DoUpdate(uow => new SchoolDataAccess(uow).UpdateAssessmentEnabled(districtId, schoolId, enabled)); }
public void Delete(Guid templateId) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => { new DataAccessBase <CustomReportTemplate, Guid>(u).Delete(templateId); ServiceLocator.CustomReportTemplateIconService.DeletePicture(templateId); }); }
public void Add(IList <Person> persons) { BaseSecurity.EnsureSysAdmin(Context); if (!Context.DistrictId.HasValue) { throw new UnassignedUserException(); } DoUpdate(u => new PersonDataAccess(u).Insert(persons)); }
public Category Edit(Guid id, string name, string description) { BaseSecurity.EnsureSysAdmin(Context); var res = GetById(id); res.Description = description; res.Name = name; DoUpdate(u => new CategoryDataAccess(u).Update(res)); return(res); }
public void Delete(Guid id) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { new ChalkableDepartmentDataAccess(uow).Delete(id); ServiceLocator.DepartmentIconService.DeletePicture(id); uow.Commit(); } }
public void Delete(IList <int> localIds, Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { var da = new SchoolDataAccess(uow); var schools = da.GetSchools(districtId, 0, int.MaxValue).ToList(); schools = schools.Where(x => localIds.Contains(x.LocalId)).ToList(); da.Delete(schools.Select(x => x.Id).ToList()); uow.Commit(); } }
public void Add(IList <User> users) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => { new UserDataAccess(u).Insert(users); var loginInfos = users.Where(x => x.LoginInfo != null).Select(x => x.LoginInfo).ToList(); if (loginInfos.Count > 0) { new UserLoginInfoDataAccess(u).Insert(loginInfos); } }); }
public Category Add(string name, string description) { BaseSecurity.EnsureSysAdmin(Context); var res = new Category { Id = Guid.NewGuid(), Name = name, Description = description }; DoUpdate(u => new CategoryDataAccess(u).Insert(res)); return(res); }
public ChalkableDepartment Edit(Guid id, string name, IList <string> keywords, byte[] icon) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { var da = new ChalkableDepartmentDataAccess(uow); var res = da.GetById(id); res.Keywords = keywords.JoinString(","); res.Name = name; da.Update(res); ServiceLocator.DepartmentIconService.UploadPicture(id, icon); uow.Commit(); return(res); } }
public ChalkableDepartment Add(string name, IList <string> keywords, byte[] icon) { BaseSecurity.EnsureSysAdmin(Context); var res = new ChalkableDepartment { Id = Guid.NewGuid(), Keywords = keywords.JoinString(","), Name = name }; using (var uow = Update()) { new ChalkableDepartmentDataAccess(uow).Insert(res); ServiceLocator.DepartmentIconService.UploadPicture(res.Id, icon); uow.Commit(); } return(res); }
public void Add(IList <SchoolInfo> schools, Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { new SchoolDataAccess(uow).Insert(schools.Select(x => new Data.Master.Model.School { Name = x.Name, LocalId = x.LocalId, DistrictRef = districtId, IsChalkableEnabled = x.IsChalkableEnabled, IsLESyncComplete = x.IsLESyncComplete, IsLEEnabled = x.IsLEEnabled, Id = Guid.NewGuid(), StudentMessagingEnabled = true, TeacherToStudentMessaginEnabled = true }).ToList()); uow.Commit(); } }
public void Edit(IList <SchoolInfo> schoolInfos, Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); using (var uow = Update()) { var da = new SchoolDataAccess(uow); var schools = da.GetSchools(districtId, 0, int.MaxValue).ToList(); schools = schools.Where(x => schoolInfos.Any(y => y.LocalId == x.LocalId)).ToList(); foreach (var school in schools) { var si = schoolInfos.FirstOrDefault(x => x.LocalId == school.LocalId); if (si != null) { school.IsChalkableEnabled = si.IsChalkableEnabled; school.IsLESyncComplete = si.IsLESyncComplete; school.IsLEEnabled = si.IsLEEnabled; school.Name = si.Name; } } da.Update(schools); uow.Commit(); } }
public CustomReportTemplate Edit(Guid templateId, string name, string layout, string style, byte[] icon, Guid?headerId, Guid?footerId, TemplateType type) { BaseSecurity.EnsureSysAdmin(Context); CustomReportTemplate template = null; DoUpdate(u => { var da = new DataAccessBase <CustomReportTemplate, Guid>(u); template = da.GetById(templateId); template.Layout = layout; template.Style = style; template.Name = name; template.FooterRef = footerId; template.HeaderRef = headerId; template.Type = (int)type; da.Update(template); if (icon != null) { ServiceLocator.CustomReportTemplateIconService.UploadPicture(templateId, icon); } }); return(template); }
public CustomReportTemplate Add(string name, string layout, string style, byte[] icon, Guid?headerId, Guid?footerId, TemplateType type) { BaseSecurity.EnsureSysAdmin(Context); var template = new CustomReportTemplate { Id = Guid.NewGuid(), Name = name, Layout = layout, Style = style, HeaderRef = headerId, FooterRef = footerId, Type = (int)type }; DoUpdate(u => { new DataAccessBase <CustomReportTemplate, Guid>(u).Insert(template); if (icon != null) { ServiceLocator.CustomReportTemplateIconService.UploadPicture(template.Id, icon); } }); return(template); }
public void Delete(IList <StudentCustomAlertDetail> studentCustomAlertDetail) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new DataAccessBase <StudentCustomAlertDetail>(u).Delete(studentCustomAlertDetail)); }
public void Delete(IList <LimitedEnglish> models) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new DataAccessBase <LimitedEnglish>(u).Delete(models)); }
public IList <RestoreLogItem> AfterSisRestore(Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); return(DoRead(uow => new DbMaintenanceDataAccess(uow).AfterSisRestore(districtId))); }
public void BeforeSisRestore(Guid districtId) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(uow => new DbMaintenanceDataAccess(uow).BeforeSisRestore(districtId)); }
public void Edit(IList <GradeLevel> gradeLevels) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new DataAccessBase <GradeLevel>(u).Update(gradeLevels)); }
public void DeleteSectionTimeSlotVariations(IList <SectionTimeSlotVariation> sectionTimeSlotVariations) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new DataAccessBase <SectionTimeSlotVariation>(u).Delete(sectionTimeSlotVariations)); }
public void Delete(IList <ScheduledTimeSlot> scheduledTimeSlots) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new DataAccessBase <ScheduledTimeSlot>(u).Delete(scheduledTimeSlots)); }
public void RemoveAllAnnouncementStandards(int standardId) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new AnnouncementStandardDataAccess(u).Delete(null, standardId)); }
public void DeleteOlder(Guid?districtId, DateTime dateTime) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new BackgroundTaskDataAccess(u).DeleteOlder(districtId, dateTime)); }
public void Cancel(Guid taskId) { BaseSecurity.EnsureSysAdmin(Context); DoUpdate(u => new BackgroundTaskDataAccess(u).Cancel(taskId)); }
public PaginatedList <BackgroundTask> Find(Guid?districtId, BackgroundTaskStateEnum?state, BackgroundTaskTypeEnum?type, bool allDistricts = false, int start = 0, int count = int.MaxValue) { BaseSecurity.EnsureSysAdmin(Context); return(DoRead(u => new BackgroundTaskDataAccess(u).Find(districtId, state, type, allDistricts, start, count))); }