コード例 #1
0
        public ActionResult GetCourses(int pageNumber, int pageSize, string name)
        {
            CourseBll       courseBll = new CourseBll();
            PagingObject    paging    = new PagingObject(pageNumber, pageSize);
            var             courses   = courseBll.GetPagingCourseByIdOrName(paging, name);
            SelectPageModel model     = new SelectPageModel();
            List <Dictionary <string, object> > listDic = new List <Dictionary <string, object> >();

            foreach (var item in courses)
            {
                var option = new Dictionary <string, object>()
                {
                    { "name", item.value },
                    { "id", item.key }
                };
                listDic.Add(option);
            }
            model.list     = listDic;
            model.totalRow = paging.TotalCount;
            return(Json(new { Data = model }));
        }
コード例 #2
0
        public ActionResult GetAudioAndVideo(string name, int pageNumber = 1, int pageSize = 10)
        {
            ResourceBll     resourceBll = new ResourceBll();
            PagingObject    paging      = new PagingObject(pageNumber, pageSize);
            var             list        = resourceBll.GetAudioAndVideo(paging, name);
            SelectPageModel model       = new SelectPageModel();
            List <Dictionary <string, object> > listDic = new List <Dictionary <string, object> >();

            foreach (var item in list)
            {
                var mediaType = CustomEnumHelper.Parse(typeof(MediaResourceTypeEnum), item.Ymr_MediaType);
                var option    = new Dictionary <string, object>()
                {
                    { "name", "(" + mediaType + ")" + item.Ymr_Name },
                    { "id", item.Ymr_Id }
                };
                listDic.Add(option);
            }
            model.list     = listDic;
            model.totalRow = paging.TotalCount;
            return(Json(new { Data = model }));
        }
コード例 #3
0
        public ActionResult GetParentNode(int?pageNumber, int?pageSize, string name, int?level, string searchValue)
        {
            SelectPageModel model = new SelectPageModel();
            List <Dictionary <string, object> > listDic = new List <Dictionary <string, object> >();
            KnowledgeBll knowledgeBll = new KnowledgeBll();

            if (!string.IsNullOrEmpty(searchValue))
            {
                var entity = knowledgeBll.Get(searchValue._ToInt32());
                if (entity != null)
                {
                    var option = new Dictionary <string, object>()
                    {
                        { "name", entity.Ykl_Name },
                        { "id", entity.Ykl_Id }
                    };
                    listDic.Add(option);
                    model.list = listDic;
                }
                return(Json(new { Data = model }));
            }

            PagingObject paging = new PagingObject(pageNumber.Value, pageSize.Value);
            var          list   = knowledgeBll.GetKnowledgeParentNode(paging, level.Value, name);

            foreach (var item in list)
            {
                var option = new Dictionary <string, object>()
                {
                    { "name", item.Ykl_Name },
                    { "id", item.Ykl_Id }
                };
                listDic.Add(option);
            }
            model.list     = listDic;
            model.totalRow = paging.TotalCount;
            return(Json(new { Data = model }));
        }
コード例 #4
0
        public ActionResult GetSchool(int pageNumber, int pageSize, string name)
        {
            SchoolBll       schoolBll = new SchoolBll();
            PagingObject    paging    = new PagingObject(pageNumber, pageSize);
            var             schools   = schoolBll.GetSchoolByIdOrName(paging, name);
            SelectPageModel model     = new SelectPageModel();
            List <Dictionary <string, object> > listDic = new List <Dictionary <string, object> >();

            foreach (var item in schools)
            {
                var option = new Dictionary <string, object>()
                {
                    { "name", item.value },
                    { "id", item.key }
                };
                listDic.Add(option);
            }
            model.list     = listDic;
            model.totalRow = paging.TotalCount;
            return(Json(new { Data = model }));
            //var schools = schoolBll.GetSchoolByIdOrName(paging,perName).ToDictionary(k => k.key, v => v.value);
            //var result = OptionFactory.CreateOptions(schools);
            //return Select2(result, JsonRequestBehavior.AllowGet);
        }