博客
关于我
强烈建议你试试无所不能的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

    你可能感兴趣的文章
    Master选举原理
    查看>>
    [ JAVA编程 ] double类型计算精度丢失问题及解决方法
    查看>>
    小别离
    查看>>
    微信小程序-发起 HTTPS 请求
    查看>>
    WPF动画设置1(转)
    查看>>
    基于node/mongo的App Docker化测试环境搭建
    查看>>
    秒杀9种排序算法(JavaScript版)
    查看>>
    struts.convention.classes.reload配置为true,tomcat启动报错
    查看>>
    MySQL的并行复制多线程复制MTS(Multi-Threaded Slaves)
    查看>>
    好玩的-记最近玩的几个经典ipad ios游戏
    查看>>
    PyQt5--EventSender
    查看>>
    Sql Server 中由数字转换为指定长度的字符串
    查看>>
    Java 多态 虚方法
    查看>>
    万能的SQLHelper帮助类
    查看>>
    tmux的简单快捷键
    查看>>
    [Swift]LeetCode922.按奇偶排序数组 II | Sort Array By Parity II
    查看>>
    Html5 离线页面缓存
    查看>>
    《绿色·精简·性感·迷你版》易语言,小到不可想象
    查看>>
    Android打包key密码丢失找回
    查看>>
    VC6.0调试技巧(一)(转)
    查看>>