using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IDAL;
using Model;
using Helper;
using System.Text.RegularExpressions;
using System.Data;
using System.Data.SqlClient;
using Helper.DBUtil;
namespace DAL
{
    /// <summary>
    /// 共享曲库(敬请期待)
    /// </summary>
    public class SharedWesing : IMusic
    {
        public List<Music> Search(string word, int page, int num)
        {
            List<Music> list = new List<Music>();
            string sql = @"select ShareId as Id,Title as Name,Singer as Artist,Album='全民k歌',Source='SharedWesing' 
from Wesing
                        where Title like @word or Singer like @word 
                        order by Id asc";
            DataTable dt = SqlHelper.Quary(sql,
            new SqlParameter("@word", "%" + word + "%")
            );
            return Music.TableToModel(dt);
        }

        public List<Music> SearchCollection(string id)
        {
            List<Music> list = new List<Music>();
            string sql = @"select Id,Name,Artist,Album,Source='Shared' from Shared where [Group]=@id";
            DataTable dt = SqlHelper.Quary(sql, new SqlParameter("@id", id));
            return Music.TableToModel(dt);
        }

        public bool GetData(Music m)
        {
            Wesing dal = new Wesing();
            return dal.GetData(m);
        }

        public void GetLrc(Music m)
        {
            Wesing dal = new Wesing();
            dal.GetLrc(m);
        }
    }
}