コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
 public EventController(EventQueries queries, ReleaseEventService service, AlbumService albumService, IEnumTranslations enumTranslations)
 {
     this.queries          = queries;
     this.service          = service;
     this.albumService     = albumService;
     this.enumTranslations = enumTranslations;
 }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
        public void Delete()
        {
            context.RunTest(repository => {
                var queries = new EventQueries(repository, new FakeEntryLinkFactory(), userContext, new InMemoryImagePersister());

                queries.Delete(Db.ReleaseEvent.Id);
            });
        }
コード例 #6
0
 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;
 }
コード例 #7
0
        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);
            }));
        }
コード例 #8
0
        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);
            }));
        }
コード例 #9
0
 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;
 }
コード例 #10
0
 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;
 }
コード例 #11
0
ファイル: SearchController.cs プロジェクト: Pyther99/vocadb
 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;
 }
コード例 #12
0
		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));

		}
コード例 #13
0
ファイル: EventQueriesTests.cs プロジェクト: lordofire/vocadb
        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));
        }
コード例 #14
0
        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());
        }
コード例 #15
0
 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;
 }
コード例 #16
0
ファイル: EventQueriesTests.cs プロジェクト: Shyany/vocadb
        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);
        }
コード例 #17
0
        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");
            });
        }
コード例 #18
0
 public EventController(EventQueries queries, ReleaseEventService service)
 {
     this.queries = queries;
     this.service = service;
 }
コード例 #19
0
 public ReleaseEventApiController(EventQueries queries, IAggregatedEntryImageUrlFactory thumbPersister)
 {
     _queries        = queries;
     _thumbPersister = thumbPersister;
 }
コード例 #20
0
 public EventController(EventQueries queries)
 {
     _queries = queries;
 }
コード例 #21
0
 public ReleaseEventApiController(EventQueries queries, IEventRepository repository, IAggregatedEntryImageUrlFactory thumbPersister)
 {
     this.queries        = queries;
     this.repository     = repository;
     this.thumbPersister = thumbPersister;
 }
コード例 #22
0
 public ReleaseEventApiController(EventQueries queries, IEventRepository repository, IEntryThumbPersister thumbPersister)
 {
     this.queries        = queries;
     this.repository     = repository;
     this.thumbPersister = thumbPersister;
 }
コード例 #23
0
 public ReleaseEventSeriesApiController(EventQueries queries)
 {
     this.queries = queries;
 }
コード例 #24
0
 public EventController(EventQueries queries, ReleaseEventService service)
 {
     this.queries = queries;
     this.service = service;
 }
コード例 #25
0
 public ImportEventController(EventQueries query, ICommandProcessor processor, IExtractEventMetadataService eventProvider)
     : base(processor)
 {
     _query         = query;
     _eventProvider = eventProvider;
 }