博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
查询数据(后台到前台传递数据,显示数据)
阅读量:5113 次
发布时间:2019-06-13

本文共 5880 字,大约阅读时间需要 19 分钟。

前台相关代码:

头部导入代码:

*@@model IDictionary
@{ var fuid = ViewContext.RouteData.Values["id"].GetString(); var list = (PagedList
)Model["list"]; var spaceTeam = (IQueryable
)Model["spaceteam"]; ViewBag.Title = "空间好友表"; ViewBag.ItemMenu = "Home"; Layout = "~/Areas/PersonalSpace/Views/Shared/master/_LayoutIndex.cshtml"; string ViewMode = Request["view"]; string Durl = ViewBag.Durl; if (string.IsNullOrEmpty(ViewMode)) { ViewMode = "list"; } string cId = ""; if (!string.IsNullOrWhiteSpace(Request["cid"])) { cId = Request["cid"]; } string order = Request["order"]; if (string.IsNullOrEmpty(order)) { order = "0"; } string strUserId = ViewBag.UserId; string loginUserId = LoginBLL.GetCurrentUserFid(); ViewData["UserId"] = strUserId;}

 

使用循环调用相关代码:

 

@using (Html.BeginForm())    {        
@*
*@
好友名称:
  
utList = bb.FindALL().Where(temp => temp.FId == fTypeId).ToList(); UserInfo utList = new UserInfo(); // string FUserImgSmall = && utList.Count > 0 --------------- /@friend.FFriendId if (utList != null) {
  • @if (friend.FFriendId != null) { string ImageUrl = String.IsNullOrEmpty(utList.FUserImgSmall) ? "/Images/uploadimg_default.jpg" : utList.FUserImgSmall;
    好友图片
    } else {
    好友图片 }
  • } } } }
    @* *@ @{ foreach (var friend in list) {@*
    *@ var fTypeId = friend.FFriendId; var userId = LoginBLL.GetCurrentUserFid(); using (SpaceFriendBLL bll = new SpaceFriendBLL()) { UserInfoBLL bb = new UserInfoBLL(); // List
    @friend.FFriendName @friend.FTeamId @if (friend.FType != null && (friend.FType.Trim() == "1" || friend.FType.Trim() == "2")) { } else {
    分组   
    } 解除好友关系
    @Html.Pager(list, new PagerOptions { NumericPagerItemCount = 3, ShowMorePagerItems = true, ShowFirstLast = false, PageIndexParameterName = "page", CurrentPagerItemWrapperFormatString = "
    {0}", NumericPagerItemWrapperFormatString = "
    {0}", AlwaysShowFirstLastPageNumber = true }, "PersonalSpace_default", null)
    }

     

     

     

     

     

     

     

    查询数据的后台代码:

    [HttpGet]        [SupportFilter(FCode = "PersonalSpace_SpaceFriend_List")]//判断页面是否有权限,FCode 调用枚举,没有的自己补,格式为:Areas_Controller_Action,例如:Heart_AgrBaseArea_Add        public ActionResult List(string cid, string keyword, string Durl,string pid, int page = 1, int pageSize = 20) //, string keyword        {            IsAuthorityButton("PersonalSpace_SpaceFriend_List");            IDictionary
    dic = new Dictionary
    (); using (UserInfoBLL ubll = new UserInfoBLL()) { // if (ui.FUserTypeId == "6daf56c8571e451ca017aaeb47e70a22")//ui.FRoleId f5450e699b414c9a8dfd3ebf9022d7a1 // SpaceFriend sf = new SpaceFriend(); // string FFriendId = sf.FFriendId; IQueryable
    ui = ubll.FindALL().Where(x => x.FRoleId == pid); // if (ui.FRoleId.Contains("f5450e699b414c9a8dfd3ebf9022d7a1")) if (ui.Equals("f5450e699b414c9a8dfd3ebf9022d7a1")) { // Durl = "/CompanySpace/SpaceFriend/List"; Durl = "personal/Home/Home/Index"; //personal/Home/Home/Index /CompanySpace/Home/Index } else { // Durl = "/Personal/Space/SpaceFriend/List"; //personal/Home/Home/Index /CompanySpace/Home/Index Durl = "/Personal/Home/Home/Index"; } ViewBag.Durl = Durl; } // var pageList = list.Skip((page - 1) * pageSize).Take(pageSize).ToList(); // var pageList2 = new PagedList
    (pageList, page, pageSize, pageList.Count()); var result = bll.GetSelSpaceFriends(CurrentUser.FId, cid, keyword).AsQueryable
    ().ToPagedList(page, 5);//, keyword // ViewBag.did = did; using (SpaceTeamBLL teambll = new SpaceTeamBLL()) { dic.Add("list", result); using (SpaceTeamBLL teambl = new SpaceTeamBLL()) { IQueryable
    team = teambll.FindALL().Where(x => x.FUserId == CurrentUser.FId); dic.Add("spaceteam", team); } return PartialView(dic);// View(dic); } }

     

    转载于:https://www.cnblogs.com/softmans/p/3303158.html

    你可能感兴趣的文章
    [洛谷P2698] [USACO12MAR]花盆Flowerpot
    查看>>
    骑士共存问题
    查看>>
    对于没有复现onWindowFocusChange方法的Activity子类,插入一个onWindowFocusChange方法
    查看>>
    ITIL(IT Infrastructure Library)介绍系列1(IT服务管理实践综述):
    查看>>
    【HLSDK系列】HL引擎入门篇
    查看>>
    计算机基础初识
    查看>>
    一个请求过程用同一个数据库连接对象在多线程下的问题
    查看>>
    mysql配置主从复制和常见问题
    查看>>
    Flex 弹性布局
    查看>>
    [笔记]何为Linux及其文件系统(五)
    查看>>
    C# MD5 加密
    查看>>
    Groovy轻松入门——通过与Java的比较,迅速掌握Groovy (更新于2008.10.18)
    查看>>
    spring mvc 异常统一处理
    查看>>
    230. Kth Smallest Element in a BST
    查看>>
    154. Find Minimum in Rotated Sorted Array II
    查看>>
    POJ 1928 The Peanuts
    查看>>
    Instant Radiosity实现
    查看>>
    (转)C# Aop简单扫盲及ORM实体类属性拦截示例
    查看>>
    C#基础之字符串Stirng特性详解
    查看>>
    [网络流24题] 餐巾
    查看>>