Example #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_TextResource> GetTextList(PagingObject paging, int grade, int textType, string nameOrKey)
        {
            List <Yw_TextResource> textList = new List <Yw_TextResource>();

            if (!string.IsNullOrEmpty(nameOrKey))
            {
                if (nameOrKey.IsNumberic() && nameOrKey.Length >= 5)
                {
                    textList = TextResourceRepository.GetPagingTextList(paging, nameOrKey._ToInt32(), grade, textType, false, 1);
                }
                else
                {
                    var resourceIds = ResourceIndexRepository.GetResourceIndexIds(paging, grade, 0, textType, nameOrKey, ResourceTypeEnum.文本资源);
                    Dictionary <int, int> orderDic = resourceIds.ToOrderDic();
                    textList = TextResourceRepository.GetTextListByIds(resourceIds).ToList();
                    textList = textList.OrderBy(x => orderDic[x.Ytr_Id]).ToList();
                }
            }
            else
            {
                textList = TextResourceRepository.GetPagingTextList(paging, nameOrKey._ToInt32(), grade, textType, false, 1);
            }
            return(textList);
        }
Example #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);
        }
Example #3
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> GetImgList(PagingObject paging, int grade, string nameOrKey)
        {
            List <Yw_MediaResource> mediaList = new List <Yw_MediaResource>();

            if (!string.IsNullOrEmpty(nameOrKey))
            {
                if (nameOrKey.IsNumberic() && nameOrKey.Length >= 5)
                {
                    mediaList = MediaObjectRepository.GetPagingImgList(paging, grade, nameOrKey._ToInt32());
                }
                else
                {
                    var resourceIds = ResourceIndexRepository.GetResourceIndexIds(paging, grade, (int)MediaResourceTypeEnum.图片, 0, nameOrKey, ResourceTypeEnum.多媒体资源);
                    Dictionary <int, int> orderDic = resourceIds.ToOrderDic();
                    mediaList = MediaResourceRepository.GetMediaListByIds(resourceIds).ToList();
                    mediaList = mediaList.OrderBy(x => orderDic[x.Ymr_Id]).ToList();
                }
            }
            else
            {
                mediaList = MediaObjectRepository.GetPagingImgList(paging, grade, nameOrKey._ToInt32());
            }
            return(mediaList);
        }
Example #4
0
        public List <Yw_TextResource> GetPagingTextResource(PagingObject paging, int id, string nameOrkey, int grade, int textType)
        {
            List <Yw_TextResource> textList = new List <Yw_TextResource>();

            if (id > 0)
            {
                textList = TextResourceRepository.GetPagingTextList(paging, id, grade, textType, true, 0);
            }
            else
            {
                if (!string.IsNullOrEmpty(nameOrkey))
                {
                    var textIds = ResourceIndexRepository.GetResourceIndexIds(paging, grade, 0, textType, nameOrkey, ResourceTypeEnum.文本资源);
                    Dictionary <int, int> orderDic = textIds.ToOrderDic();
                    textList = TextResourceRepository.GetTextListByIds(textIds);
                    textList = textList.OrderBy(x => orderDic[x.Ytr_Id]).ToList();
                }
                else
                {
                    textList = TextResourceRepository.GetPagingTextList(paging, id, grade, textType, false, 0);
                }
            }
            return(textList);
        }