コード例 #1
0
        public void rptSongs_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var setSongService = new SetSongService(Ioc.GetInstance <ISetSongRepository>());

            var setSong = setSongService.GetSetSong(new Guid(e.CommandArgument.ToString()));

            if (e.CommandName.ToLower() == "fix")
            {
                txtSongName.Text        = setSong.SongName;
                hdnSetSongIdToFix.Value = setSong.SetSongId.ToString();
            }
            else if (e.CommandName.ToLower() == "delete")
            {
                ///TEST THIS SECTION
                var songService = new SongService(Ioc.GetInstance <ISongRepository>());
                var song        = songService.GetSong(setSong.SongId.Value);

                using (IUnitOfWork uow = UnitOfWork.Begin())
                {
                    setSongService.Delete(setSong);

                    if (song != null)
                    {
                        songService.Delete(song);
                    }

                    uow.Commit();
                }

                var setsongs = setSongService.GetAllSetSongs().Where(x => x.SongName.Contains(txtSearchSongName.Text));

                rptSongs.DataSource = setsongs;
                rptSongs.DataBind();
            }
        }
コード例 #2
0
        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++;
            }
        }