Пример #1
0
        public string MusicUpLoad()
        {
            try
            {
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; //获取传统context
                HttpRequestBase request = context.Request;                                       //定义传统request对象
                                                                                                 //string resultUrl = Upload(request.Files[0], "Music");
                SongList s = new SongList()
                {
                    WYID   = "",
                    S_Name = request.Form["sname"].ToString(),
                    S_Type = 1,
                    //先上传文件 在添加到歌手表
                    S_Url   = uri + Upload(request.Files[0], "Music"),
                    S_Cover = uri + Upload(request.Files[1], "MusicCover"),

                    //添加到数据库  这里直接接收返回的歌手id
                    S_Singer       = SongListService.AddSinger(UserInfoService.SelUserInfoByID(int.Parse(request.Form["uid"].ToString()))),
                    S_PlayCount    = 0,
                    S_CollectCount = 0,
                    S_UpTime       = DateTime.Now,
                    S_Lyric        = "",
                    S_Album        = 0
                };
                if (SongListService.AddSongList(s))
                {
                    return("添加成功");
                }
                return("添加失败");
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }
Пример #2
0
 public string AddCollectCount(int id)
 {
     if (SongListService.AddCount(id, 2))
     {
         return("成功");
     }
     else
     {
         return("失败");
     }
 }
Пример #3
0
        public Dictionary <string, object> SelSongMenuByID(int id)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            var m = SongMenuService.SelSongMenuByID(id);

            if (m != null)
            {
                string   songID      = m.GetType().GetProperty("M_SongId").GetValue(m).ToString();
                string[] songMenuNum = songID?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var      song        = SongListService.SelSongListByMenu(songMenuNum);
                dic.Add("songMenuInfo", m);
                dic.Add("songInfo", song);
            }
            return(dic);
        }
Пример #4
0
        public object GetAlbumByID(int id)
        {
            Dictionary <string, object> dic = new Dictionary <string, object>();
            var albun = AlbumService.GetAlbumByID(id);

            if (albun != null)
            {
                string   songID      = albun.GetType().GetProperty("A_Song").GetValue(albun).ToString();
                string[] songMenuNum = songID?.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                var      song        = SongListService.SelSongListByMenu(songMenuNum);
                dic.Add("AlbumInfo", albun);
                dic.Add("SongList", song);
            }
            return(dic);
        }
Пример #5
0
        public MainWindowViewModel(MediaElement mediaElement)
        {
            Songs.SongTags = new List <string>();
            //Songs.PlayingSong = new Song();
            //Songs.SongList = new List<Song>();
            Songs.SelectedTags = new List <string>();
            //Songs.PlayingSongs = new List<Song>();


            //ControlService = new ControlService();
            //TagsSelectService = new TagsSelectService();
            TitleBarService   = new TitleBarService();
            SongListService   = new SongListService(mediaElement);
            VisibilityService = new VisibilityService();
            //PlayService = new PlayService();
        }
Пример #6
0
        public object Top8(int id)
        {
            int top = 10;

            if (id == 1)
            {
                //热门推荐
                var list = SongListService.SelHotTop(top);
                return(list);
            }
            else if (id == 2)
            {
                //歌单
                var list = SongListService.SelSongListTop(top);
                return(list);
            }
            return(null);
        }
Пример #7
0
        public string AddSongList([FromBody] object json)
        {
            bool f = true;
            //解析json信息
            JArray jar = (JArray)JsonConvert.DeserializeObject(json.ToString());

            for (int i = 0; i < jar.Count; i++)
            {
                JObject  j = JObject.Parse(jar[i].ToString());
                SongList s = new SongList()
                {
                    WYID   = j["S_Id"].ToString(),
                    S_Name = j["S_Name"].ToString(),
                    S_Type = 1,
                    //添加到数据库  这里直接接收返回的歌手id
                    S_Singer       = SongListService.AddSinger(j["S_Singer"].ToString()),
                    S_Url          = j["S_Url"].ToString(),
                    S_Cover        = j["S_Cover"].ToString(),
                    S_PlayCount    = 0,
                    S_CollectCount = 0,
                    S_UpTime       = DateTime.Now,
                    S_Lyric        = "",
                    S_Album        = 0,
                };
                if (!SongListService.AddSongList(s))
                {
                    f = false;
                }
            }
            if (f)
            {
                return("添加成功");
            }
            else
            {
                return("添加失败");
            }
        }
Пример #8
0
 public object SelSongInfoByID(int id)
 {
     return(SongListService.SelSongbyID(id));
 }
Пример #9
0
 public object SelSongListALL(int top = 30, int page = 0)
 {
     return(SongListService.SelSongListALL(top, page));
 }
Пример #10
0
 public object SelSongListByType(int id, int top = 30, int page = 0)
 {
     return(SongListService.SelSongListByTypeID(id, top, page));
 }
Пример #11
0
 public object SelSongListByName(string name, int top = 30, int page = 0)
 {
     return(SongListService.SelSongListByName(name, top, page));
 }
Пример #12
0
 public Dictionary <string, object> SelRecentSong(int id, int length = 20)
 {
     return(SongListService.SelRecentSong(id, length));
 }