コード例 #1
0
        public void Save()
        {
            Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase();

            if (_artist.ArtistId == 0)
            {
                //ADD ARTIST
                IRepository <IArtist>    artist        = new ArtistRepository(db);
                IRepositoryBLL <IArtist> artistRepoBll = new ArtistRepositoryBLL(artist);
                _artist = artistRepoBll.Add(_artist);

                //ADD ARTIST CONTACT
                IRepository <IArtistContact>    contact1   = new ArtistContactRepository(db);
                IRepositoryBLL <IArtistContact> contactBll = new ArtistContactRepositoryBLL(contact1);
                _artistContact.ArtistId = _artist.ArtistId;
                _artistContact          = contactBll.Add(_artistContact);

                //ADD DISCOGRAPHY
                IRepository <IDiscography>    disco    = new DiscographyRepository(db);
                IRepositoryBLL <IDiscography> discoBll = new DiscographyRepositoryBLL(disco);
                _discography.ArtistId = _artist.ArtistId;
                _discography          = discoBll.Add(_discography);
            }

            if (_album.AlbumId == 0)
            {
                //ADD ALBUM
                IRepository <IAlbum>    album1   = new AlbumRepository(db);
                IRepositoryBLL <IAlbum> albumBll = new AlbumRepositoryBLL(album1);
                _album.ArtistId = _artist.ArtistId;
                _album          = albumBll.Add(_album);
            }

            //ADD SONGS
            IRepository <ISong>    song1   = new SongRepository(db);
            IRepositoryBLL <ISong> songBll = new SongRepositoryBLL(song1);

            foreach (Song item in _songs)
            {
                item.AlbumId = _album.AlbumId;
                songBll.Add(item);
            }
        }
コード例 #2
0
        private IBattl GetBattlNotPlayedThisWeek()
        {
            IBattl     battl = new Battl();
            IDataQuery query = new DataQuery();

            DateTime date       = DateTime.Now;
            int      daysRange  = 6;
            int      dayWeek    = (int)date.DayOfWeek;
            DateTime lastMonday = date.AddDays(-daysRange);
            DateTime lastSunday = date;

            IRepositoryBLL <ISong> repo = new SongRepositoryBLL(new SongRepository(_dataBase));
            ISongBLL songBLL            = new SongBLL(repo);

            ISong fisrtSong  = songBLL.GetRandomSong(0);
            ISong secondSong = songBLL.GetRandomSong(fisrtSong.SongId);

            battl.FirstSongId  = fisrtSong.SongId;
            battl.SecondSongId = secondSong.SongId;

            return(battl);
        }
コード例 #3
0
        public IBattl CreateTestBattl(DateTime date)
        {
            DateTime lastBattlTime = date;


            IRepositoryBLL <ISong> repo = new SongRepositoryBLL(new SongRepository(_dataBase));
            ISongBLL songBLL            = new SongBLL(repo);
            ISong    fisrtSong          = songBLL.GetRandomSong(0);
            ISong    secondSong         = songBLL.GetRandomSong(fisrtSong.SongId);

            IBattl battl = new Battl();

            battl.FirstSongId  = fisrtSong.SongId;
            battl.SecondSongId = secondSong.SongId;
            battl.BattlDate    = lastBattlTime.AddHours(1);
            battl.StartTime    = battl.BattlDate.AddMinutes(5);
            battl.EndTime      = battl.StartTime.AddMinutes(5);

            battl = _battlRepository.Add(battl);

            return(battl);
        }
コード例 #4
0
        public void Save()
        {
            Database db = Microsoft.Practices.EnterpriseLibrary.Data.DatabaseFactory.CreateDatabase();

            if (_artist.ArtistId == 0)
            {
                //ADD ARTIST
                IRepository<IArtist> artist = new ArtistRepository(db);
                IRepositoryBLL<IArtist> artistRepoBll = new ArtistRepositoryBLL(artist);
                _artist = artistRepoBll.Add(_artist);

                //ADD ARTIST CONTACT
                IRepository<IArtistContact> contact1 = new ArtistContactRepository(db);
                IRepositoryBLL<IArtistContact> contactBll = new ArtistContactRepositoryBLL(contact1);
                _artistContact.ArtistId = _artist.ArtistId;
                _artistContact = contactBll.Add(_artistContact);

                //ADD DISCOGRAPHY
                IRepository<IDiscography> disco = new DiscographyRepository(db);
                IRepositoryBLL<IDiscography> discoBll = new DiscographyRepositoryBLL(disco);
                _discography.ArtistId = _artist.ArtistId;
                _discography = discoBll.Add(_discography);
            }

            if (_album.AlbumId == 0)
            {
                //ADD ALBUM
                IRepository<IAlbum> album1 = new AlbumRepository(db);
                IRepositoryBLL<IAlbum> albumBll = new AlbumRepositoryBLL(album1);
                _album.ArtistId = _artist.ArtistId;
                _album = albumBll.Add(_album);
            }

            //ADD SONGS
            IRepository<ISong> song1 = new SongRepository(db);
            IRepositoryBLL<ISong> songBll = new SongRepositoryBLL(song1);
            foreach (Song item in _songs)
            {
                item.AlbumId = _album.AlbumId;
                songBll.Add(item);
            }
        }
コード例 #5
0
ファイル: BattlBLL.cs プロジェクト: iondrimba/musicbattl
        private IBattl GetBattlNotPlayedThisWeek()
        {
            IBattl battl = new Battl();
            IDataQuery query = new DataQuery();

            DateTime date = DateTime.Now;
            int daysRange = 6;
            int dayWeek = (int)date.DayOfWeek;
            DateTime lastMonday = date.AddDays(-daysRange);
            DateTime lastSunday = date;

            IRepositoryBLL<ISong> repo = new SongRepositoryBLL(new SongRepository(_dataBase));
            ISongBLL songBLL = new SongBLL(repo);

            ISong fisrtSong = songBLL.GetRandomSong(0);
            ISong secondSong = songBLL.GetRandomSong(fisrtSong.SongId);

            battl.FirstSongId = fisrtSong.SongId;
            battl.SecondSongId = secondSong.SongId;

            return battl;
        }
コード例 #6
0
ファイル: BattlBLL.cs プロジェクト: iondrimba/musicbattl
        public IBattl CreateTestBattl(DateTime date)
        {
            DateTime lastBattlTime = date;

            IRepositoryBLL<ISong> repo = new SongRepositoryBLL(new SongRepository(_dataBase));
            ISongBLL songBLL = new SongBLL(repo);
            ISong fisrtSong = songBLL.GetRandomSong(0);
            ISong secondSong = songBLL.GetRandomSong(fisrtSong.SongId);

            IBattl battl = new Battl();
            battl.FirstSongId = fisrtSong.SongId;
            battl.SecondSongId = secondSong.SongId;
            battl.BattlDate = lastBattlTime.AddHours(1);
            battl.StartTime = battl.BattlDate.AddMinutes(5);
            battl.EndTime = battl.StartTime.AddMinutes(5);

            battl = _battlRepository.Add(battl);

            return battl;
        }