public FavoriteLiveSongList(SetSong setSong)
        {
            LiveSong = new SetSong();
            FavoriteLiveShows = new List<Show>();
            HighestRatedShows = new List<Show>();

            LiveSong = setSong;
        }
        public FavoriteLiveSongList(SetSong setSong, int highestRank, List<Show> highestRankedShows)
        {
            LiveSong = setSong;
            HighestRating = highestRank;
            HighestRatedShows = highestRankedShows;

            FavoriteLiveShows = new List<Show>();
        }
        public FavoriteLiveSongList()
        {
            LiveSong = new SetSong();
            FavoriteLiveShows = new List<Show>();

            HighestRating = 0;
            HighestRatedShows = new List<Show>();
        }
        private void MoveSongUp(Guid g, SetSong song, Set set)
        {
            if (song.Order != 1)
            {
                var songBefore = (SetSong)setSongService.GetSetSong(set.SetSongs.Where(x => x.Order == song.Order - 1).First().SetSongId);

                song.Order--;
                songBefore.Order++;
            }
        }
        private void MoveSongDown(Guid g, SetSong song, Set set)
        {
            if (song.Order != set.SetSongs.OrderBy(x => x.Order).Last().Order)
            {
                var songAfter = (SetSong)setSongService.GetSetSong(set.SetSongs.Where(x => x.Order == song.Order + 1).First().SetSongId);

                song.Order++;
                songAfter.Order--;
            }
        }
        private void RemoveSong(Guid g, SetSong song, Set set)
        {
            song.Deleted     = true;
            song.DeletedDate = DateTime.Now;

            setSongService.Delete(song);

            var songList = set.SetSongs.Where(x => x.SetSongId != song.SetSongId).OrderBy(x => x.Order);

            short?order = 1;

            foreach (var s in songList)
            {
                s.Order = order;
                order++;
            }
        }
        private FavoriteLiveSongList GetAnalysisPart(SetSong setSong)
        {
            var songService = new SongService(Ioc.GetInstance<ISongRepository>());

            return GetAnalysisPart((Song)songService.GetSong(setSong.SongId.Value));
        }
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            ResetPanels();

            TopicService   tourService    = new TopicService(Ioc.GetInstance <ITopicRepository>());
            SongService    songService    = new SongService(Ioc.GetInstance <ISongRepository>());
            SetService     setService     = new SetService(Ioc.GetInstance <ISetRepository>());
            SetSongService setSongService = new SetSongService(Ioc.GetInstance <ISetSongRepository>());

            bool success         = false;
            bool compiledSuccess = true;

            if (string.IsNullOrEmpty(hdnId.Value))
            {
                Bind();
                return;
            }

            var set = (Set)setService.GetSet(new Guid(hdnId.Value));

            if (set == null)
            {
                Bind();
                return;
            }

            if (lstSongs.Items.Count <= 0)
            {
                Bind();
                return;
            }

            using (IUnitOfWork uow = TheCore.Infrastructure.UnitOfWork.Begin())
            {
                foreach (ListItem item in lstSongs.Items)
                {
                    if (!item.Selected)
                    {
                        continue;
                    }

                    var song = songService.GetSong(new Guid(item.Value));

                    if (song == null)
                    {
                        continue;
                    }

                    short?order = 1;

                    if (set.SetSongs.Count > 0)
                    {
                        order = set.SetSongs.OrderBy(x => x.Order).Last().Order;
                        order++;
                    }

                    SetSong setSong = new SetSong()
                    {
                        Album       = song.Album,
                        CreatedDate = DateTime.UtcNow,
                        SetSongId   = Guid.NewGuid(),
                        SongId      = song.SongId,
                        SongName    = song.SongName,
                        Order       = order,
                        Set         = set,
                        SetId       = set.SetId,
                        Segue       = chkSegue.Checked
                    };

                    setSongService.Save(setSong, out success);

                    compiledSuccess = compiledSuccess && success;
                }

                if (compiledSuccess)
                {
                    uow.Commit();
                    phSuccess.Visible = true;
                    phError.Visible   = false;
                }
                else
                {
                    phError.Visible   = true;
                    phSuccess.Visible = false;
                }
            }

            Bind();
        }
Example #9
0
 public LiveSongDateMangler()
 {
     ShowDate = DateTime.MinValue;
     LiveSong = null;
 }
        private void MoveSongDown(Guid g, SetSong song, Set set)
        {
            if (song.Order != set.SetSongs.OrderBy(x => x.Order).Last().Order)
            {
                var songAfter = (SetSong)setSongService.GetSetSong(set.SetSongs.Where(x => x.Order == song.Order + 1).First().SetSongId);

                song.Order++;
                songAfter.Order--;
            }
        }
        public void btnSubmit_Click(object sender, EventArgs e)
        {
            ResetPanels();

            TopicService tourService = new TopicService(Ioc.GetInstance<ITopicRepository>());
            SongService songService = new SongService(Ioc.GetInstance<ISongRepository>());
            SetService setService = new SetService(Ioc.GetInstance<ISetRepository>());
            SetSongService setSongService = new SetSongService(Ioc.GetInstance<ISetSongRepository>());

            bool success = false;
            bool compiledSuccess = true;

            if (string.IsNullOrEmpty(hdnId.Value))
            {
                Bind();
                return;
            }

            var set = (Set)setService.GetSet(new Guid(hdnId.Value));

            if (set == null)
            {
                Bind();
                return;
            }

            if (lstSongs.Items.Count <= 0)
            {
                Bind();
                return;
            }

            using (IUnitOfWork uow = TheCore.Infrastructure.UnitOfWork.Begin())
            {

                foreach (ListItem item in lstSongs.Items)
                {
                    if (!item.Selected) { continue; }

                    var song = songService.GetSong(new Guid(item.Value));

                    if (song == null) { continue; }

                    short? order = 1;

                    if (set.SetSongs.Count > 0)
                    {
                        order = set.SetSongs.OrderBy(x => x.Order).Last().Order;
                        order++;
                    }

                    SetSong setSong = new SetSong()
                        {
                            Album = song.Album,
                            CreatedDate = DateTime.UtcNow,
                            SetSongId = Guid.NewGuid(),
                            SongId = song.SongId,
                            SongName = song.SongName,
                            Order = order,
                            Set = set,
                            SetId = set.SetId,
                            Segue = chkSegue.Checked
                        };

                    setSongService.Save(setSong, out success);

                    compiledSuccess = compiledSuccess && success;
                }

                if (compiledSuccess)
                {
                    uow.Commit();
                    phSuccess.Visible = true;
                    phError.Visible = false;
                }
                else
                {
                    phError.Visible = true;
                    phSuccess.Visible = false;
                }
            }
            
            Bind();
        }
        private void RemoveSong(Guid g, SetSong song, Set set)
        {
            song.Deleted = true;
            song.DeletedDate = DateTime.Now;

            setSongService.Delete(song);

            var songList = set.SetSongs.Where(x => x.SetSongId != song.SetSongId).OrderBy(x => x.Order);

            short? order = 1;

            foreach (var s in songList)
            {
                s.Order = order;
                order++;
            }
        }
        private void MoveSongUp(Guid g, SetSong song, Set set)
        {
            if (song.Order != 1)
            {
                var songBefore = (SetSong)setSongService.GetSetSong(set.SetSongs.Where(x => x.Order == song.Order - 1).First().SetSongId);

                song.Order--;
                songBefore.Order++;
            }
        }
 public LiveSongDateMangler()
 {
     ShowDate = DateTime.MinValue;
     LiveSong = null;
 }
 public FavoriteLiveSongList(SetSong setSong, List<Show> shows)
 {
     LiveSong = setSong;
     FavoriteLiveShows = shows;
     HighestRatedShows = new List<Show>();
 }
 public void AddFavorite(SetSong song, Show show)
 {
     LiveSong = song;
     FavoriteLiveShows.Add(show);
 }
 public void AddFavoriteSongPair(FavoriteVersion fave, SetSong setSong, Show show)
 {
     SongList.Add(new FavoriteSetSong { Favorite = fave,  LiveSong = setSong, LiveShow = show });
 }