当前位置: 首页>>代码示例>>C#>>正文


C# List.AsQueryable方法代码示例

本文整理汇总了C#中Common.List.AsQueryable方法的典型用法代码示例。如果您正苦于以下问题:C# List.AsQueryable方法的具体用法?C# List.AsQueryable怎么用?C# List.AsQueryable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common.List的用法示例。


在下文中一共展示了List.AsQueryable方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Index

        //
        // GET: /Xueya/
        public ActionResult Index(int? p)
        {
            Pager pager = new Pager();
            pager.table = "CMSXueya";
            pager.strwhere = "1=1";
            pager.PageSize = 30;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "XueyaId";
            pager.FiledOrder = "XueyaId Desc";
            pager = CMSService.SelectAll("Xueya", pager);

            List<XueyaDto> list = new List<XueyaDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                XueyaDto dto = XueyaMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
              //  ViewBag.CustomerId = id;
            //ViewBag.CustomerName = MyService.CustomerIdToName("CustomerId=" + id);

            return View(pager.Entity);
        }
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:31,代码来源:XueyaJianceController.cs

示例2: Daizhen

        public ActionResult Daizhen(int? p)
        {
            Pager pager = new Pager();
            pager.table = "CMSCustomer";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "CustomerId";
            pager.FiledOrder = "CustomerId Desc";
            pager.strwhere = pager.strwhere + " and CustomerTizhi='0'";

            pager = CMSService.SelectAll("Customer", pager);
            List<CustomerDto> list = new List<CustomerDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CustomerDto dto = CustomerMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;

            return View(pager.Entity);
        }
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:28,代码来源:CustomerController.cs

示例3: GetBbsBoards

 /// <summary>
 /// 获取论坛板块列表 CategoryModel
 /// </summary>
 /// <param name="cid"></param>
 /// <returns></returns>
 public IQueryable<BbsBoardModel> GetBbsBoards(int cid)
 {
     IQueryable<CategoryModel> list = GetSubCategoryList(cid);
     List<BbsBoardModel> boardlist = new List<BbsBoardModel>();
     foreach (CategoryModel c in list)
     {
         boardlist.Add(GetBbsBoard(c));
     }
     return boardlist.AsQueryable();
 }
开发者ID:91mvc,项目名称:YQCMS,代码行数:15,代码来源:BbsServiceImpl.cs

示例4: GetEditorPage

        public static Pager GetEditorPage(Pager pager, string strwhere, string table)
        {
            SqlParameter[] arParms = new SqlParameter[9];
            //@tbname   --要分页显示的表名
            arParms[0] = new SqlParameter("@tbname", SqlDbType.NVarChar, 30);
            arParms[0].Value = table;

            // @FieldKey --用于定位记录的主键(惟一键)字段,可以是逗号分隔的多个字段
            arParms[1] = new SqlParameter("@FieldKey", SqlDbType.NVarChar, 40);
            arParms[1].Value = "EditorId";

            //@PageCurrent --要显示的页码
            arParms[2] = new SqlParameter("@PageCurrent", SqlDbType.Int);
            arParms[2].Value = pager.PageNo + 1;

            // @PageSize --每页的大小(记录数)
            arParms[3] = new SqlParameter("@PageSize", SqlDbType.Int);
            arParms[3].Value = pager.PageSize;

            //@FieldShow  --以逗号分隔的要显示的字段列表,如果不指定,则显示所有字段
            arParms[4] = new SqlParameter("@FieldShow", SqlDbType.NVarChar, 500);
            arParms[4].Value = "*";

            //@FieldOrder --以逗号分隔的排序字段列表,可以指定在字段后面指定DESC/ASC用于指定排序顺序

            arParms[5] = new SqlParameter("@FieldOrder", SqlDbType.NVarChar, 500);
            arParms[5].Value = "EditorId desc";

            //@Where   --查询条件
            arParms[6] = new SqlParameter("@Where", SqlDbType.VarChar, 8000);
            arParms[6].Value = strwhere;

            //@PageCount --总页数
            arParms[7] = new SqlParameter("@PageCount", SqlDbType.Int);
            arParms[7].Direction = ParameterDirection.Output;

            //@RecordCount --总记录数
            arParms[8] = new SqlParameter("@RecordCount", SqlDbType.Int);
            arParms[8].Direction = ParameterDirection.Output;
            SqlConnection myconn = new SqlConnection(CommonDal.ConnectionString);
            try
            {
            EditorDto editorDto = null;
            List<EditorDto> list = new List<EditorDto>();
            DataTable dt = null;
            DataSet ds = SqlHelper.ExecuteDataset(myconn, CommandType.StoredProcedure, "sp_AspNetPageView", arParms);
            dt = ds.Tables[0];
            foreach (DataRow dr in dt.Rows)
            {
                editorDto = EditorDal.getDataRowToEditorDto(dr);
                list.Add(editorDto);
            }

            var totalItems = (int)arParms[8].Value;

            pager.Amount = totalItems;
            pager.Entity = list.AsQueryable();
            pager.PageCount = (int)arParms[7].Value;

            return pager;
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {

                myconn.Close();
                myconn.Dispose();
            }
        }
开发者ID:jorzen2010,项目名称:HealthCrm,代码行数:72,代码来源:EditorDal.cs

示例5: Index

        // 显示用户列表页
        public ActionResult Index(int? p, int? roleId)
        {
            int RoleId = roleId ?? 0;
            Pager pager = new Pager();
            pager.table = "CMSUser";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "UserId";
            pager.FiledOrder = "UserId Desc";
            if (RoleId > 0)
            {

                pager.strwhere = pager.strwhere + " and charindex('" + RoleId + "',UserRoles)>0";

            }

            pager = CMSService.SelectAll("User", pager);

            List<UserDto> list = new List<UserDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                UserDto dto = UserMapping.getDTO(dr);
                dto.UserRoles = MyService.RolesIdToRolesName(dto.UserRoles);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewData["Roles"] = MyService.GetRolesList("1=1");

            return View(pager.Entity);
        }
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:38,代码来源:UserController.cs

示例6: Index

        // Category列表
        public ActionResult Index(int? p, int id, string CategoryParentName)
        {
            Pager pager = new Pager();
            pager.table = "CMSCategory";
            pager.strwhere = "CategoryParentId="+id;
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "CategoryId";
            pager.FiledOrder = "CategoryId Desc";
            pager = CMSService.SelectAll("Category", pager);

            List<CategoryDto> list = new List<CategoryDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CategoryDto dto = CategoryMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewBag.CategoryParentName = CategoryParentName;
            ViewBag.CategoryParentId = id;
            return View(pager.Entity);
        }
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:29,代码来源:CategoryController.cs

示例7: Index

        //
        // GET: /Role/
        public ActionResult Index(int? p)
        {
            Pager pager = new Pager();
            pager.table = "CMSRole";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "RoleId";
            pager.FiledOrder = "RoleId Desc";
            pager = CMSService.SelectAll("Role", pager);

            List<RoleDto> list = new List<RoleDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                RoleDto dto = RoleMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;

            return View(pager.Entity);
        }
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:29,代码来源:RoleController.cs

示例8: GetAlbums

 /// <summary>
 /// 获取指定分类下所有相册信息
 /// </summary>
 public IQueryable<AlbumModel> GetAlbums(int cid,int count=0)
 {
     IQueryable<blog_varticle> varticles;
     if(cid==0)
         varticles = GetArticles(4, 0, count);
     else
         varticles = GetArticles(4, GetCategoryIds(cid), count);
     varticles = varticles.OrderBy(m => m.catepath);
     List<AlbumModel> lst = new List<AlbumModel>();
     foreach (blog_varticle varticle in varticles)
     {
         lst.Add(GetAlbum(varticle));
     }
     return lst.AsQueryable();
 }
开发者ID:menghuantianya,项目名称:MVCDemo,代码行数:18,代码来源:AlbumServiceImpl.cs

示例9: Index

        //
        // GET: /Customer/
        public ActionResult Index(int? p, string  category,string guidang)
        {
            string Category = category ?? "全部";
            string Guidang = guidang ?? "0";
            Pager pager = new Pager();
            pager.table = "CMSCustomer";
            pager.strwhere = "1=1";
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "CustomerId";
            pager.FiledOrder = "CustomerId Desc";

            if (Category !="全部")
            {

                pager.strwhere = pager.strwhere + " and charindex('" + Category + "',CustomerTizhi)>0";

            }
            if (Guidang != "0")
            {

                pager.strwhere = pager.strwhere + " and charindex('" + Guidang + "',CustomerGuidang)>0";

            }
            pager = CMSService.SelectAll("Customer", pager);
            List<CustomerDto> list = new List<CustomerDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                CustomerDto dto = CustomerMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewData["Category"] = MyService.GetCategoryList("CategoryParentId=20");
            ViewData["Guidang"] = MyService.GetCategoryList("CategoryParentId=30");

            return View(pager.Entity);
        }
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:45,代码来源:CustomerController.cs

示例10: List

        //
        // GET: /Liangbiao/Details/5
        public ActionResult List(int?p,int id)
        {
            Pager pager = new Pager();
            pager.table = "CMSTizhi";
            pager.strwhere = "TizhiCustomerId="+id;
            pager.PageSize = 10;
            pager.PageNo = p ?? 1;
            pager.FieldKey = "TizhiId";
            pager.FiledOrder = "TizhiId Desc";
            pager = CMSService.SelectAll("Tizhi", pager);

            List<TizhiDto> list = new List<TizhiDto>();
            foreach (DataRow dr in pager.EntityDataTable.Rows)
            {
                TizhiDto dto = TizhiMapping.getDTO(dr);
                list.Add(dto);

            }
            pager.Entity = list.AsQueryable();

            ViewBag.PageNo = p ?? 1;
            ViewBag.PageCount = pager.PageCount;
            ViewBag.RecordCount = pager.Amount;
            ViewBag.Message = pager.Amount;
            ViewBag.CustomerId = id;
            ViewBag.CustomerName = MyService.CustomerIdToName("CustomerId=" + id);

            return View(pager.Entity);
        }
开发者ID:jorzen2010,项目名称:SkyWebCMS,代码行数:31,代码来源:TizhiController.cs

示例11: GetNewArticleQuery

        /// <summary>
        /// 记录结果处理
        /// </summary>
        private IQueryable<ArtilceWithDecorate> GetNewArticleQuery(IQueryable<blog_varticle> d, out string jsonSummaryImg)
        {
            configinfo.DecorateImgCount = WebUtils.GetDecorateCount(WebUtils.GetCurrentTheme());
            List<ArtilceWithDecorate> list = new List<ArtilceWithDecorate>();
            string str = "[";
            string img = "";
            int tmpKey = 0;
            Random ran = new Random();

            string themepath = WebUtils.GetCurrentTheme() == "" ? "/Content/" : "/Themes/" + WebUtils.GetCurrentTheme() + "/Content/";

            foreach (blog_varticle a in d)
            {
               //提取summary中第一张图
                img = Utils.GetImg(a.summary);
                //提取内容中的第一张图
                //if (img == "")
                //    img = Utils.GetImg(a.content);
                if (img == "" && configinfo.DecorateImgCount > 0)
                {
                    int RandKey = ran.Next(1001, 1000 + configinfo.DecorateImgCount);
                    if (RandKey == tmpKey)
                        RandKey++;
                    RandKey = RandKey > 1000 + configinfo.DecorateImgCount ? 1001 : RandKey;
                    tmpKey = RandKey;

                    img = themepath+"image/decorate/" + RandKey.ToString() + ".jpg";
                }
                if (img != "")
                    str += "{\"id\":\"" + a.id.ToString() + "\",\"img\":\"" + img + "\"},";

                list.Add(
                    new ArtilceWithDecorate
                    {
                        id=a.id,
                        title=a.title,
                        cateid=a.cateid,
                        typeid=a.typeid,
                        createdate=a.createdate,
                        viewcount=a.viewcount,
                        subcount=a.subcount,
                        catepath = myService.GetCategoryPathUrl(a.catepath),
                        rename=a.rename,
                        url=a.url,
                        istop=a.istop,
                        iscommend=a.iscommend,
                        Decorate=img,
                        summary = Utils.ClearImgs(a.summary).Trim() == "" ? Utils.CutString(Utils.RemoveHtml(a.content), 0, configinfo.MaxSummaryCharCount) + "..." : Utils.ClearImgs(a.summary),
                        FullSummary = a.summary.Trim() == "" ? Utils.CutString(Utils.RemoveHtml(a.content), 0, configinfo.MaxSummaryCharCount) + "..." : a.summary.Trim()
                    });
            }
            jsonSummaryImg = "var summaryimgs=" + str.Trim(',') + "];";
            return list.AsQueryable<ArtilceWithDecorate>();
        }
开发者ID:menghuantianya,项目名称:MVCDemo,代码行数:57,代码来源:HomeController.cs


注:本文中的Common.List.AsQueryable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。