public static ApplicationViewData PrepareAppInfo(IServiceLocatorMaster locator, Application application, bool needsliveApp = false, bool needsSecretKey = false) { bool canGetSecretKey = false; if (needsSecretKey) { canGetSecretKey = locator.ApplicationService.CanGetSecretKey(new List <Application> { application }); } var categories = locator.CategoryService.ListCategories(); //TODO: IMPLEMENT STANDARTS LATER var res = ApplicationViewData.Create(application, categories, null, canGetSecretKey); if (needsliveApp && application.OriginalRef.HasValue) { var liveApp = locator.ApplicationService.GetApplicationById(application.Id); //TODO: IMPLEMENT STANDARTS LATER res.LiveApplication = ApplicationViewData.Create(liveApp, categories, null, canGetSecretKey); } return(res); }
public PersonPictureService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { SupportedSizes.Add(new PictureSize { Height = 24, Width = 24 }); SupportedSizes.Add(new PictureSize { Height = 40, Width = 40 }); SupportedSizes.Add(new PictureSize { Height = 47, Width = 47 }); SupportedSizes.Add(new PictureSize { Height = 64, Width = 64 }); SupportedSizes.Add(new PictureSize { Height = 70, Width = 70 }); SupportedSizes.Add(new PictureSize { Height = 128, Width = 128 }); SupportedSizes.Add(new PictureSize { Height = 256, Width = 256 }); }
public override object PrepareDataSource(FeedReportInputModel inputModel, ReportingFormat format, IServiceLocatorSchool serviceLocator, IServiceLocatorMaster masterLocator) { var baseData = PrepareBaseReportData(inputModel, serviceLocator); var settings = inputModel.Settings; var annType = inputModel.Settings.LessonPlanOnly ? AnnouncementTypeEnum.LessonPlan : (AnnouncementTypeEnum?)inputModel.AnnouncementType; var anns = serviceLocator.AnnouncementFetchService.GetAnnouncementDetailses(settings.StartDate, settings.EndDate, inputModel.ClassId, inputModel.Complete, annType); //hide hidden activities if not included if (!settings.IncludeHiddenActivities) { anns = anns.Where(x => x.ClassAnnouncementData == null || x.ClassAnnouncementData.VisibleForStudent).ToList(); } // hide attachments and applications if not included if (!settings.IncludeAttachments) { anns = anns.Select(x => { x.AnnouncementAttachments = new List <AnnouncementAttachment>(); x.AttachmentNames = new List <string>(); x.ApplicationCount = 0; x.AnnouncementApplications = new List <AnnouncementApplication>(); return(x); }).ToList(); } // hide hidden attributes if not included if (!settings.IncludeHiddenAttributes) { anns = anns.Select(x => { x.AnnouncementAttributes = x.AnnouncementAttributes.Where(a => a.VisibleForStudents).ToList(); return(x); }).ToList(); } //Get apps with images var appIds = anns.SelectMany(x => x.AnnouncementApplications.Select(y => y.ApplicationRef)).Distinct().ToList(); var apps = masterLocator.ApplicationService.GetApplicationsByIds(appIds); IDictionary <Guid, byte[]> appsImages = new Dictionary <Guid, byte[]>(); foreach (var app in apps) { if (appsImages.ContainsKey(app.Id)) { continue; } var image = masterLocator.ApplicationPictureService.GetPicture(app.BigPictureRef.Value, 170, 110); appsImages.Add(app.Id, image); } var fromDate = settings.StartDate ?? serviceLocator.Context.SchoolYearStartDate; var toDate = settings.EndDate ?? serviceLocator.Context.SchoolYearEndDate; return(FeedDetailsExportModel.Create(baseData.Person, baseData.SchoolName, baseData.SchoolYearName, serviceLocator.Context.NowSchoolTime, fromDate, toDate, anns, baseData.Classes, baseData.DayTypes, baseData.Staffs, apps, appsImages)); }
//TODO: think to move notify Applications logic public static void NotifyApplications(IServiceLocatorMaster masterLocator, IList <AnnouncementApplication> annApps , int announcemnetType, string sessionKey, NotifyAppType type) { foreach (var annApp in annApps) { NotifyApplication(masterLocator, annApp.ApplicationRef, annApp.Id, announcemnetType, sessionKey, type); } }
public static async Task NotifyApplicationAsync(IServiceLocatorMaster masterLocator, Guid applicationId, int announcementApplicationId, int announcemnetType, string sessionKey, NotifyAppType type) { try { var app = masterLocator.ApplicationService.GetApplicationById(applicationId); var url = app.Url; var token = masterLocator.ApplicationService.GetAccessToken(applicationId, sessionKey); var mode = type == NotifyAppType.Attach ? API.Settings.ANNOUNCEMENT_APPLICATION_SUBMIT : API.Settings.ANNOUNCEMENT_APPLICATION_REMOVE; var ps = new Dictionary <string, string> { ["apiRoot"] = "https://" + Chalkable.Common.Settings.Domain, ["announcementApplicationId"] = announcementApplicationId.ToString(), ["announcementType"] = announcemnetType.ToString(), ["mode"] = mode, ["token"] = token, ["_"] = Guid.NewGuid().ToString() }; var webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.KeepAlive = true; webRequest.Credentials = CredentialCache.DefaultCredentials; webRequest.Method = WebRequestMethods.Http.Post; webRequest.Accept = "application/json"; webRequest.AllowAutoRedirect = false; SignRequest(webRequest, ps, app.SecretKey); PrepareParams(webRequest, ps); var response = await webRequest.GetResponseAsync(); using (var stream = response.GetResponseStream()) { var statusCode = (response as HttpWebResponse)?.StatusCode; if (stream == null || (statusCode.HasValue && statusCode.Value != HttpStatusCode.OK)) { HandleException(new ChalkableException($"Server {url} faild to responce." + $"Request Parameters: {ps.Select(x => $"{x.Key}={x.Value}").JoinString("&")}")); } } } catch (WebException ex) { HandleException(ex); } catch (Exception e) { HandleException(e); } }
public static IList <BaseApplicationViewData> GetSuggestedAppsForAttach(IServiceLocatorMaster masterLocator, IServiceLocatorSchool schooLocator , IList <Guid> abIds, int?start = null, int?count = null) { start = start ?? 0; count = count ?? int.MaxValue; var applications = masterLocator.ApplicationService.GetSuggestedApplications(abIds, start.Value, count.Value); applications = applications.Where(a => a.CanAttach).ToList(); var res = applications.Select(BaseApplicationViewData.Create); // get without content apps only return(res.Where(x => !x.ApplicationAccess.ProvidesRecommendedContent).ToList()); }
public CustomReportTemplateIconService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { SupportedSizes.Add(new PictureSize { Height = 24, Width = 24 }); SupportedSizes.Add(new PictureSize { Height = 64, Width = 64 }); SupportedSizes.Add(new PictureSize { Height = 40, Width = 40 }); SupportedSizes.Add(new PictureSize { Height = 47, Width = 47 }); }
public DepartmentIconService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { SupportedSizes.Add(new PictureSize { Height = 80, Width = 45 }); SupportedSizes.Add(new PictureSize { Height = 46, Width = 26 }); SupportedSizes.Add(new PictureSize { Height = 24, Width = 48 }); SupportedSizes.Add(new PictureSize { Height = 164, Width = 92 }); }
private BackgroundTaskService.BackgroundTaskLog CreateLog(IServiceLocatorMaster sl, BackgroundTask task) { int logFlushSize = 100; if (task.DistrictRef.HasValue) { var d = sl.DistrictService.GetByIdOrNull(task.DistrictRef.Value); logFlushSize = d.LastSync.HasValue ? d.SyncLogFlushSize : 1; } else { if (task.Type == BackgroundTaskTypeEnum.DatabaseDacPacUpdate) { logFlushSize = 1; } } return(new BackgroundTaskService.BackgroundTaskLog(task.Id, logFlushSize)); }
public DeveloperService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public ApplicationService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public PictureService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { SupportedSizes = new List <PictureSize>(); }
public DemoCategoryService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { CategoryStorage = new DemoCategoryStorage(); }
public CustomReportTemplateService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public DbMaintenanceService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public DemoSchoolService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { MasterSchoolStorage = new DemoMasterSchoolStorage(); }
public override object PrepareDataSource(FeedReportInputModel inputModel, ReportingFormat format, IServiceLocatorSchool serviceLocator, IServiceLocatorMaster masterLocator) { var baseData = PrepareBaseReportData(inputModel, serviceLocator); var feedSettings = new FeedSettingsInfo { AnnouncementType = inputModel.Settings.LessonPlanOnly ? (int)AnnouncementTypeEnum.LessonPlan : inputModel.AnnouncementType, FromDate = inputModel.Settings.StartDate, ToDate = inputModel.Settings.EndDate }; //bool isForAdminPortal = BaseSecurity.IsDistrictAdmin(serviceLocator.Context) && !inputModel.ClassId.HasValue; //var anns = isForAdminPortal // ? serviceLocator.AnnouncementFetchService.GetAnnouncementsForAdminFeed(inputModel.Complete, null, feedSettings) // : serviceLocator.AnnouncementFetchService.GetAnnouncementsForFeed(inputModel.Complete, inputModel.ClassId, feedSettings); var anns = serviceLocator.AnnouncementFetchService.GetAnnouncementDetailses(feedSettings.FromDate, feedSettings.ToDate, inputModel.ClassId, inputModel.Complete, feedSettings.AnnouncementTypeEnum); //hide hidden activities if (!inputModel.Settings.IncludeHiddenActivities) { anns = anns.Where(x => x.ClassAnnouncementData == null || x.ClassAnnouncementData.VisibleForStudent).ToList(); } ////remove standards if groupByStandards is not selected //if (!inputModel.Settings.GroupByStandards) // anns = anns.Select(x => // { // x.AnnouncementStandards = new List<AnnouncementStandardDetails>(); // return x; // }).ToList(); var fromDate = inputModel.Settings.StartDate ?? serviceLocator.Context.SchoolYearStartDate; var toDate = inputModel.Settings.EndDate ?? serviceLocator.Context.SchoolYearEndDate; return(ShortFeedExportModel.Create(baseData.Person, baseData.SchoolName, baseData.SchoolYearName, serviceLocator.Context.NowSchoolTime, fromDate, toDate, baseData.Classes, baseData.Staffs, baseData.DayTypes, anns, inputModel.Settings.GroupByStandards)); }
public AcademicBenchmarkService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { _abConnectorLocator = new ConnectorLocator(); }
public abstract object PrepareDataSource(FeedReportInputModel settings, ReportingFormat format, IServiceLocatorSchool serviceLocator, IServiceLocatorMaster masterLocator);
public ImportServiceLocatorSchool(IServiceLocatorMaster serviceLocatorMaster) : base(serviceLocatorMaster) { SchoolDbService = new ImportDbService(Context.SchoolConnectionString); }
public ChalkableDepartmentService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public CategoryService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public DemoUserService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public ServiceLocatorSchool(IServiceLocatorMaster serviceLocatorMaster) : base(serviceLocatorMaster.Context) { this.serviceLocatorMaster = serviceLocatorMaster; personService = new PersonService(this); addressSerivce = new AddressService(this); gradeLevelService = new GradeLevelService(this); markingPeriodService = new MarkingPeriodService(this); classService = new ClassService(this); schoolYearService = new SchoolYearService(this); announcementQnAService = new AnnouncementQnAService(this); announcementAttachmentService = new AnnouncementAttachmentService(this); phoneService = new PhoneService(this); privateMessageService = new PrivateMessageService(this); roomService = new RoomService(this); periodService = new PeriodService(this); calendarDateService = new CalendarDateService(this); dayTypeService = new DayTypeService(this); classPeriodService = new ClassPeriodService(this); notificationService = new NotificationService(this); attendanceReasonService = new AttendanceReasonService(this); attendanceService = new AttendanceService(this); studentParentService = new StudentParentService(this); studentAnnouncementService = new StudentAnnouncementService(this); classClassAnnouncementTypeService = new ClassClassAnnouncementTypeService(this); infractionService = new InfractionService(this); applicationSchoolService = new ApplicationSchoolService(this); disciplineService = new DisciplineService(this); gradingStatisticService = new GradingStatisticService(this); schoolService = new SchoolService(this); schoolPersonService = new SchoolPersonService(this); standardService = new StandardService(this); alphaGradeService = new AlphaGradeService(this); alternateScoreService = new AlternateScoreService(this); gradingPeriodService = new GradingPeriodService(this); syncService = new SyncService(this); gradingStandardService = new GradingStandardService(this); reportService = new ReportingService(this); gradingCommentService = new GradingCommentService(this); gradingScaleService = new GradingScaleService(this); classroomOptionService = new ClassroomOptionService(this); personEmailService = new PersonEmailService(this); schoolDbService = new DbService(Context != null ? Context.SchoolConnectionString : null); scheduledTimeSlotService = new ScheduledTimeSlotService(this); studentService = new StudentService(this); staffService = new StaffService(this); userSchoolService = new UserSchoolService(this); bellScheduleService = new BellScheduleService(this); practiceGradeService = new PracticeGradeService(this); attendanceMonthService = new AttendanceMonthService(this); gradedItemService = new GradedItemService(this); announcementAttributeService = new AnnouncementAttributeService(this); announcementAssignedAttributeService = new AnnouncementAssignedAttributeService(this); contactService = new ContactService(this); teacherCommentService = new TeacherCommentService(this); dbMaintenanceService = new DbMaintenanceService(this); groupService = new GroupService(this); courseTypeService = new CourseTypeService(this); settingsService = new SettingsService(this); lpGalleryCategoryService = new LPGalleryCategoryService(this); lessonPlanService = new LessonPlanService(this); classAnnouncementService = new ClassAnnouncementService(this); adminAnnouncementService = new AdminAnnouncementService(this); announcementFetchService = new AnnouncementFetchService(this); leService = new LEService(this); attachementService = new AttachmentService(this); personSettingService = new PersonSettingService(this); studentCustomAlertDetailService = new StudentCustomAlertDetailService(this); panoramaSettingsService = new PanoramaSettingsService(this); standardizedTestService = new StandardizedTestService(this); supplementalAnnouncementService = new SupplementalAnnouncementService(this); ethnicityService = new EthnicityService(this); languageService = new LanguageService(this); countryService = new CountryService(this); announcementCommentService = new AnnouncementCommentService(this); appSettingService = new AppSettingService(this); limitedEnglishService = new LimitedEnglishService(this); schoolProgramService = new SchoolProgramService(this); studentSchoolProgramService = new StudentSchoolProgramService(this); mealTypeService = new MealTypeService(this); lunchCountService = new LunchCountService(this); }
public DemoEmailService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public DistrictService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public BackgroundTaskService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public PreferenceService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { }
public DemoDistrictService(IServiceLocatorMaster serviceLocator) : base(serviceLocator) { DistrictStorage = new DemoDistrictStorage(); }
public MasterServiceBase(IServiceLocatorMaster serviceLocator) { ServiceLocator = serviceLocator; }