Exemple #1
0
        /// <summary>
        /// 资源组关联多媒体列表
        /// </summary>
        /// <param name="paging"></param>
        /// <param name="grade"></param>
        /// <param name="mediaType"></param>
        /// <param name="nameOrKey"></param>
        /// <returns></returns>
        public List <Yw_MediaResource> GetMediaList(PagingObject paging, int grade, int mediaType, string nameOrKey)
        {
            List <Yw_MediaResource> mediaList = new List <Yw_MediaResource>();

            if (!string.IsNullOrEmpty(nameOrKey))
            {
                if (nameOrKey.IsNumberic() && nameOrKey.Length >= 5)
                {
                    mediaList = MediaResourceRepository.GetMediaListForGroup(paging, nameOrKey._ToInt32(), grade, mediaType);
                }
                else
                {
                    var resourceIds = ResourceIndexRepository.GetMediaIndexIds(paging, grade, mediaType, nameOrKey);
                    Dictionary <int, int> orderDic = resourceIds.ToOrderDic();
                    mediaList = MediaResourceRepository.GetMediaListByIds(resourceIds).ToList();
                    mediaList = mediaList.OrderBy(x => orderDic[x.Ymr_Id]).ToList();
                }
            }
            else
            {
                mediaList = MediaResourceRepository.GetMediaListForGroup(paging, nameOrKey._ToInt32(), grade, mediaType);
            }
            return(mediaList);
        }
Exemple #2
0
        public List <Yw_MediaResource> GetPagingMediaResource(PagingObject paging, int id, string nameOrkey, int grade, int mediaType)
        {
            List <Yw_MediaResource> mediaList = new List <Yw_MediaResource>();

            if (id > 0)
            {
                mediaList = MediaResourceRepository.GetPagingMediaList(paging, id, grade, mediaType, true, 0);
            }
            else
            {
                if (!string.IsNullOrEmpty(nameOrkey))
                {
                    var mediaIds = ResourceIndexRepository.GetResourceIndexIds(paging, grade, mediaType, 0, nameOrkey, ResourceTypeEnum.多媒体资源);
                    Dictionary <int, int> orderDic = mediaIds.ToOrderDic();
                    mediaList = MediaResourceRepository.GetMediaListByIds(mediaIds);
                    mediaList = mediaList.OrderBy(x => orderDic[x.Ymr_Id]).ToList();
                }
                else
                {
                    mediaList = MediaResourceRepository.GetPagingMediaList(paging, id, grade, mediaType, false, 0);
                }
            }
            return(mediaList);
        }