Esempio n. 1
0
        public List <MusicItem> GetMusicItems(MusicSearchParameters p)
        {
            SetSqlFormat("select * from {0}", xmConsts.MusicItems);
            if (p.InUsbList.HasValue)
            {
                AddSqlText(string.Format("inner join {0} usb on usb.ItemId = {1}.Id", xmConsts.UserUsbList, xmConsts.MusicItems));
            }

            if (p.InPlayList.HasValue)
            {
                AddSqlText(string.Format("inner join {0} pls on pls.ItemId = {1}.Id", xmConsts.UserPlayList, xmConsts.MusicItems));
            }

            ClearParameters();
            if (!string.IsNullOrEmpty(p.SearchText))
            {
                StartORGroup();
                AddORLikeField("Artist", p.SearchText, LikeSelectionStyle.CheckBoth);
                AddORLikeField("FileName", p.SearchText, LikeSelectionStyle.CheckBoth);
                AddORLikeField("FullFileName", p.SearchText, LikeSelectionStyle.CheckBoth);
                AddORLikeField("Title", p.SearchText, LikeSelectionStyle.CheckBoth);
                EndORGroup();
            }
            if (p.InUsbList.HasValue)
            {
                AddSqlWhereField("usb.UserId", GlobalAppData.CurrentUser.Id);
            }
            if (p.InPlayList.HasValue)
            {
                AddSqlWhereField("pls.UserId", GlobalAppData.CurrentUser.Id);
            }
            var lst = new List <MusicItem>();

            FillList(lst, typeof(MusicItem));
            return(lst);
        }
Esempio n. 2
0
 public void ClearData(MusicSearchParameters musicSearchParameters)
 {
     SetSqlFormat("delete from {0}", xmConsts.MusicItems);
     ExecuteSql();
 }