public async Task <IActionResult> GetEvents() { int userId = _authenticationInfo.ActualUser.UserId; var sqlDataBase = _stObjMap.StObjs.Obtain <SqlDefaultDatabase>(); using (var ctx = new SqlStandardCallContext()) { GroupQueries groupQueries = new GroupQueries(ctx, sqlDataBase); EventQueries eventQueries = new EventQueries(ctx, sqlDataBase); GroupData groupData = await groupQueries.GetIdSchoolByConnectUser(userId); AclQueries aclQueries = new AclQueries(ctx, sqlDataBase); if (!await aclQueries.VerifyGrantLevelByUserId(112, await aclQueries.GetAclIdBySchoolId(groupData.ParentZoneId), userId, Operator.SuperiorOrEqual)) { Result result = new Result(Status.Unauthorized, "Vous n'etes pas autorisé à utiliser cette fonctionnalité !"); return(this.CreateResult(result)); } List <EventData> events = await eventQueries.GetAllEventsByIdSchool(groupData.ParentZoneId); return(Ok(events)); } }
public async Task <IActionResult> UpdateEvents([FromBody] SchoolEventChangeModel model) { int userId = _authenticationInfo.ActualUser.UserId; var sqlDataBase = _stObjMap.StObjs.Obtain <SqlDefaultDatabase>(); using (var ctx = new SqlStandardCallContext()) { PeriodServices periodServices = new PeriodServices(); GroupQueries groupQueries = new GroupQueries(ctx, sqlDataBase); EventQueries eventQueries = new EventQueries(ctx, sqlDataBase); if (!await periodServices.CheckPeriodGivenDate(_stObjMap, _authenticationInfo, model.BegDate, model.EndDate)) { Result result = new Result(Status.BadRequest, "Ces Dates ne sont pas comprises dans la periode actuel"); return(this.CreateResult(result)); } GroupData groupData = await groupQueries.GetIdSchoolByConnectUser(userId); AclQueries aclQueries = new AclQueries(ctx, sqlDataBase); if (!await aclQueries.VerifyGrantLevelByUserId(112, await aclQueries.GetAclIdBySchoolId(groupData.ParentZoneId), userId, Operator.SuperiorOrEqual)) { Result result = new Result(Status.Unauthorized, "Vous n'etes pas autorisé à utiliser cette fonctionnalité !"); return(this.CreateResult(result)); } await eventQueries.UpdateEvent(model.EventId, model.Name, model.BegDate, model.EndDate); List <EventData> events = await eventQueries.GetAllEventsByIdSchool(groupData.ParentZoneId); return(Ok(events)); } }
public EventController(EventQueries queries, ReleaseEventService service, AlbumService albumService, IEnumTranslations enumTranslations) { this.queries = queries; this.service = service; this.albumService = albumService; this.enumTranslations = enumTranslations; }
public async Task <IActionResult> GetEventSchoolByName(string eventName, string schoolName) { var sqlDataBase = _stObjMap.StObjs.Obtain <SqlDefaultDatabase>(); int userId = _authenticationInfo.ActualUser.UserId; using (var ctx = new SqlStandardCallContext()) { EventQueries eventQueries = new EventQueries(ctx, sqlDataBase); GroupQueries groupQueries = new GroupQueries(ctx, sqlDataBase); TimedPeriodQueries timedPeriodQueries = new TimedPeriodQueries(ctx, sqlDataBase); GroupData groupData = await groupQueries.GetIdSchoolByConnectUser(userId); EventData eventData; if (groupData == null) { int idSchool = await groupQueries.GetIdSchoolByName(schoolName); PeriodData periodData = await timedPeriodQueries.GetLastPeriodBySchool(idSchool); eventData = await eventQueries.GetEventSchoolBylNameAndPeriodId(eventName, periodData.ChildId); } else { eventData = await eventQueries.GetEventSchoolBylNameAndPeriodId(eventName, groupData.ZoneId); } return(Ok(eventData)); } }
public void Delete() { context.RunTest(repository => { var queries = new EventQueries(repository, new FakeEntryLinkFactory(), userContext, new InMemoryImagePersister()); queries.Delete(Db.ReleaseEvent.Id); }); }
public EventController(EventQueries queries, ReleaseEventService service, IEnumTranslations enumTranslations, IEntryLinkFactory entryLinkFactory, IAggregatedEntryImageUrlFactory thumbPersister) { this.queries = queries; this.service = service; this.enumTranslations = enumTranslations; this.entryLinkFactory = entryLinkFactory; this.thumbPersister = thumbPersister; }
private ReleaseEventForEditContract Update(ReleaseEventForEditContract contract) { return(context.RunTest(repository => { var queries = new EventQueries(repository, entryLinkFactory, userContext, imageStore, userIconFactory, enumTranslations, mailer); var updated = queries.Update(contract, null); return queries.GetEventForEdit(updated.Id); })); }
private ReleaseEventForEditContract Update(ReleaseEventForEditContract contract) { return(context.RunTest(repository => { var queries = new EventQueries(repository, entryLinkFactory, userContext, imageStore, userIconFactory, enumTranslations, mailer, new FollowedArtistNotifier(new FakeEntryLinkFactory(), new FakeUserMessageMailer(), new EnumTranslations(), new EntrySubTypeNameFactory())); var updated = queries.Update(contract, null); return queries.GetEventForEdit(updated.Id); })); }
public ExtController(IEntryUrlParser entryUrlParser, IEntryImagePersisterOld entryThumbPersister, AlbumService albumService, ArtistService artistService, EventQueries eventQueries, SongQueries songService, TagQueries tagQueries) { this.entryUrlParser = entryUrlParser; this.entryThumbPersister = entryThumbPersister; this.albumService = albumService; this.artistService = artistService; this.eventQueries = eventQueries; this.songService = songService; this.tagQueries = tagQueries; }
public SearchController(OtherService services, ArtistService artistService, AlbumService albumService, SongService songService, SongListQueries songListQueries, TagQueries tagQueries, EventQueries eventQueries, EntryQueries entryQueries, IUserPermissionContext permissionContext) { this.services = services; this.artistService = artistService; this.albumService = albumService; this.songService = songService; this.songListQueries = songListQueries; this.tagQueries = tagQueries; this.eventQueries = eventQueries; this.entryQueries = entryQueries; this.permissionContext = permissionContext; }
public SearchController(OtherService services, ArtistService artistService, AlbumService albumService, SongService songService, SongListQueries songListQueries, TagQueries tagQueries, EventQueries eventQueries, EntryQueries entryQueries, IUserPermissionContext permissionContext) { _services = services; _artistService = artistService; _albumService = albumService; _songService = songService; _songListQueries = songListQueries; _tagQueries = tagQueries; _eventQueries = eventQueries; _entryQueries = entryQueries; _permissionContext = permissionContext; }
public void SetUp() { series = CreateEntry.EventSeries("M3"); existingEvent = new ReleaseEvent(string.Empty, null, series, 2013, "Spring"); repository = new FakeEventRepository(); repository.Save(series); repository.Save(existingEvent); album = CreateEntry.Album(name: "Day's Footsteps"); album.OriginalReleaseEventName = "M3 2013 Spring"; repository.Save(album); var user = CreateEntry.User(); repository.Save(user); queries = new EventQueries(repository, new FakeEntryLinkFactory(), new FakePermissionContext(user)); }
public void SetUp() { series = CreateEntry.EventSeries("M3"); existingEvent = new ReleaseEvent(string.Empty, null, series, 2013, "Spring", null, false); repository = new FakeEventRepository(); repository.Save(series); repository.Save(existingEvent); album = CreateEntry.Album(name: "Day's Footsteps"); album.OriginalReleaseEvent = existingEvent; repository.Save(album); user = CreateEntry.User(group: UserGroupId.Trusted); repository.Save(user); permissionContext = new FakePermissionContext(user); queries = new EventQueries(repository, new FakeEntryLinkFactory(), permissionContext, new InMemoryImagePersister()); }
public ExtController( IEntryUrlParser entryUrlParser, IAggregatedEntryImageUrlFactory entryThumbPersister, AlbumService albumService, ArtistService artistService, EventQueries eventQueries, SongQueries songService, TagQueries tagQueries, PVHelper pvHelper) { _entryUrlParser = entryUrlParser; _entryThumbPersister = entryThumbPersister; _albumService = albumService; _artistService = artistService; _eventQueries = eventQueries; _songService = songService; _tagQueries = tagQueries; _pvHelper = pvHelper; }
public void SetUp() { series = CreateEntry.EventSeries("M3"); existingEvent = CreateEntry.SeriesEvent(series, 2013, "Spring"); series.AllEvents.Add(existingEvent); repository = new FakeEventRepository(); repository.Save(series); repository.Save(existingEvent); repository.SaveNames(series); repository.SaveNames(existingEvent); album = CreateEntry.Album(name: "Day's Footsteps"); album.OriginalReleaseEvent = existingEvent; repository.Save(album); user = CreateEntry.User(group: UserGroupId.Trusted); repository.Save(user); permissionContext = new FakePermissionContext(user); queries = new EventQueries(repository, new FakeEntryLinkFactory(), permissionContext, new InMemoryImagePersister(), new FakeUserIconFactory(), new EnumTranslations(), mailer); }
public void MoveToTrash() { userContext.GrantPermission(PermissionToken.MoveToTrash); context.RunTest(repository => { var id = Db.ReleaseEvent.Id; var queries = new EventQueries(repository, entryLinkFactory, userContext, imageStore, userIconFactory, enumTranslations, mailer); queries.MoveToTrash(id, "Deleted"); var query = repository.HandleQuery(ctx => { return(new { EventFromDb = ctx.Get(id), TrashedEntry = ctx.Query <TrashedEntry>().FirstOrDefault(e => e.EntryType == EntryType.ReleaseEvent && e.EntryId == id) }); }); Assert.IsNull(query.EventFromDb, "Release event was deleted"); Assert.IsNotNull(query.TrashedEntry, "Trashed entry was created"); Assert.AreEqual("Deleted", query.TrashedEntry.Notes, "TrashedEntry.Notes"); }); }
public EventController(EventQueries queries, ReleaseEventService service) { this.queries = queries; this.service = service; }
public ReleaseEventApiController(EventQueries queries, IAggregatedEntryImageUrlFactory thumbPersister) { _queries = queries; _thumbPersister = thumbPersister; }
public EventController(EventQueries queries) { _queries = queries; }
public ReleaseEventApiController(EventQueries queries, IEventRepository repository, IAggregatedEntryImageUrlFactory thumbPersister) { this.queries = queries; this.repository = repository; this.thumbPersister = thumbPersister; }
public ReleaseEventApiController(EventQueries queries, IEventRepository repository, IEntryThumbPersister thumbPersister) { this.queries = queries; this.repository = repository; this.thumbPersister = thumbPersister; }
public ReleaseEventSeriesApiController(EventQueries queries) { this.queries = queries; }
public ImportEventController(EventQueries query, ICommandProcessor processor, IExtractEventMetadataService eventProvider) : base(processor) { _query = query; _eventProvider = eventProvider; }