Esempio n. 1
0
        /// <summary>
        /// 分页显示BBSItem
        /// </summary>
        /// <param name="id">BBS ID</param>
        /// <param name="page">Page ID</param>
        public void toListBBSItemsInAdminPageByPager(int id, int page)
        {
            BBSItemListViewData BBSItemVD = ListBBSItemsByBBSID(id);

            HttpContext.Session["CurrentBBSID"] = id;

            int count = 0;

            count = BBSItemVD.BBSItemInfo.Count();

            BBSItemListViewData ItemsOfPerPage = new BBSItemListViewData();

            ItemsOfPerPage.BBSID = BBSItemVD.BBSID;

            ItemsOfPerPage.BBSItemInfo = BBSItemVD.BBSItemInfo.Skip(10 * (page - 1)).Take(10).ToList();

            UrlManager urlManager = new DefaultUrlManager(count, 10);
            Pager pager = new Pager(urlManager);
            ItemsOfPerPage.PagerString = pager.PagerString;

            RenderView("ListBBSItemsInAdminPage", ItemsOfPerPage);
        }
Esempio n. 2
0
        /// <summary>
        /// 根据ItemId, 获取该Item的内容及回复等信息,并分页显示
        /// </summary>
        /// <param name="id"></param>
        /// <param name="page"></param>
        public void toShowItemDetailInAdminPageByPager(int id, int page)
        {
            BBSItemListViewData BBSILVD = GetItemDetailInfoByID(id);
            BBSItemListViewData replyPerPage = new BBSItemListViewData();

            try
            {
                BBSILVD = GetItemDetailInfoByID(id);

                // 根据BBSItem的ID取出该条BBSItem的内容
                BBSILVD.BBSItem = (from bi in CQGJ.BBSItem where bi.ItemID == id select bi).First();

                // 查看次数加1
                BBSILVD.BBSItem.ViewCount = BBSILVD.BBSItem.ViewCount + 1;

                CQGJ.SaveChanges();

                // 计算回复条数
                int count = 0;

                count = BBSILVD.BBSItemInfo.Count();

                replyPerPage.TopicItemInfo = new BBSItemInfo { TopicBBSItem = BBSILVD.TopicItemInfo.TopicBBSItem, Author = GetUserInfoByID((int)BBSILVD.TopicItemInfo.TopicBBSItem.UserReference.EntityKey.EntityKeyValues[0].Value) };
                replyPerPage.BBSItemInfo = new List<BBSItemInfo>();

                replyPerPage.BBSItemInfo = BBSILVD.BBSItemInfo.Skip(10 * (page - 1)).Take(10).ToList();

                replyPerPage.BBSID = BBSILVD.BBSID;

                UrlManager urlManager = new DefaultUrlManager(count, 10);
                Pager pager = new Pager(urlManager);
                replyPerPage.PagerString = pager.PagerString;

            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            RenderView("ShowItemDetailInAdminPage", replyPerPage);
        }
Esempio n. 3
0
        /// <summary>
        /// 显示上一个帖子
        /// </summary>
        /// <param name="id">本帖ID</param>
        public void ShowPreItemDetail(int id)
        {
            BBSItemListViewData BBSLVD = new BBSItemListViewData();

            int bbsId = GetCurrentBBSID();

            try
            {
                List<BBSItem> items = (from bi in CQGJ.BBSItem where bi.ParentID == -1 && bi.BBS.BBSID == bbsId select bi).ToList();
                BBSItem nextItem = new BBSItem();

                for (int i = 0; i < items.Count; i++)
                {
                    if (items[i].ItemID == id)
                    {
                        if (i != 0)
                        {
                            nextItem = items[i - 1];

                            break;
                        }
                        else
                        {
                            nextItem = items[i];

                            break;
                        }

                    }
                }

                BBSLVD = GetItemDetailInfoByID(nextItem.ItemID);
            }
            catch (Exception ex)
            {
                Response.Write("这是第一个帖子" + ex.Message);
            }

            RedirectToAction("ShowItemDetailByPager/" + BBSLVD.TopicItemInfo.TopicBBSItem.ItemID + "/1");
        }
Esempio n. 4
0
        /// <summary>
        /// 根据用户ID分页列出他的所有发帖
        /// </summary>
        /// <param name="id">Passport数据库中的用户ID</param>
        /// <param name="page"></param>
        public void toListBBSItemsByUserIDAndPager(int id, int page)
        {
            BBSItemListViewData UserBBSItems = ListBBSItemsByUserID(id);

            UserBBSItems.BBSID = GetCurrentBBSID();

            int count = 0;

            count = UserBBSItems.BBSItemInfo.Count();

            BBSItemListViewData ItemsOfPerPage = new BBSItemListViewData();

            ItemsOfPerPage.BBSID = UserBBSItems.BBSID;

            ItemsOfPerPage.BBSItemInfo = UserBBSItems.BBSItemInfo.Skip(10 * (page - 1)).Take(10).ToList();

            UrlManager urlManager = new DefaultUrlManager(count, 10);
            Pager pager = new Pager(urlManager);
            ItemsOfPerPage.PagerString = pager.PagerString;

            RenderView("ListBBSItemsByUserIDPage", ItemsOfPerPage);
        }
Esempio n. 5
0
        /// <summary>
        /// 取出与该BBS Topic相关的信息,包括发起人的内容,以及回帖的内容等
        /// </summary>
        /// <param name="id">该BBS Item的ID</param>
        public void ShowItemDetail(int id)
        {
            BBSItemListViewData BBSItemViewData = new BBSItemListViewData();

            try
            {
                BBSItemViewData = GetItemDetailInfoByID(id);

                // 根据BBSItem的ID取出该条BBSItem的内容
                BBSItemViewData.BBSItem = (from bi in CQGJ.BBSItem where bi.ItemID == id select bi).First();

                // 该BBSItem所属的BBS
                int bbsId = (int)BBSItemViewData.BBSItem.BBSReference.EntityKey.EntityKeyValues[0].Value;
                BBSItemViewData.BBSInfo = (from b in CQGJ.BBS where b.BBSID == bbsId select b).First();

                // 设置此BBSItem所属的BBS
                HttpContext.Session["currentBBSID"] = bbsId;

                // 查看次数加1
                BBSItemViewData.BBSItem.ViewCount = BBSItemViewData.BBSItem.ViewCount + 1;

                CQGJ.SaveChanges();

                try
                {
                    // 根据ParentID取出对该条BBSItem的回帖内容
                    //BBSItemViewData.BBSItemsList = (from bj in CQGJ.BBSItem where bj.ParentID == id select bj).ToList();

                    BBSItemViewData.BBSID = (int)BBSItemViewData.BBSItem.BBSReference.EntityKey.EntityKeyValues[0].Value;

                    RenderView("ShowItemDetail", BBSItemViewData);

                }
                catch (ArgumentNullException)
                {
                    Response.Write("没有回帖");
                    //strError = "没有回帖";
                }

            }
            catch (ArgumentNullException)
            {
                Response.Write("该帖已被删除");
                //strError = "该帖已被删除";
            }

            //RenderView("ShowItemDetail", BBSItemViewData);
        }
Esempio n. 6
0
        /// <summary>
        /// 分页显示回帖信息
        /// </summary>
        /// <param name="id"></param>
        public void ShowItemDetailByPager(int id, int page)
        {
            BBSItemListViewData BBSILVD = new BBSItemListViewData();
            BBSItemListViewData replyPerPage = new BBSItemListViewData();

            try
            {
                BBSILVD = GetItemDetailInfoByID(id);

                // 根据BBSItem的ID取出该条BBSItem的内容
                BBSILVD.BBSItem = (from bi in CQGJ.BBSItem where bi.ItemID == id select bi).First();

                // 查看次数加1
                BBSILVD.BBSItem.ViewCount = BBSILVD.BBSItem.ViewCount + 1;

                CQGJ.SaveChanges();

                // 计算回复条数
                int count = 0;
                count = BBSILVD.BBSItemInfo.Count();

                // 分页中发起帖的信息
                replyPerPage.TopicItemInfo = new BBSItemInfo { TopicBBSItem = BBSILVD.TopicItemInfo.TopicBBSItem, Author=BBSILVD.TopicItemInfo.Author };

                // 定义回复帖信息列表
                replyPerPage.BBSItemInfo = new List<BBSItemInfo>();

                // 设置每页的BBSItem和信息,即Item的条数等信息
                replyPerPage.BBSItemInfo = BBSILVD.BBSItemInfo.Skip(6 * (page - 1)).Take(6).ToList();

                // 该BBSItem所属的BBS的信息, replyPerPage.BBSID 简要标明该BBSItem所属BBS的ID
                // replyPerPage.BBSInfo 为该BBSItem所属BBS的详细信息
                replyPerPage.BBSID = BBSILVD.BBSID;
                replyPerPage.BBSInfo = GetBBSByBBSID(BBSILVD.BBSID).BBS;

                // 设置分页信息
                UrlManager urlManager = new DefaultUrlManager(count, 6);
                Pager pager = new Pager(urlManager);
                replyPerPage.PagerString = pager.PagerString;

            }
            catch(Exception ex)
            {
                Response.Write(ex.Message);
            }

            RenderView("ShowItemDetail", replyPerPage);
        }
Esempio n. 7
0
        /// <summary>
        /// 根据用户ID获取其所有发帖
        /// </summary>
        /// <param name="id">Passport数据库中的用户ID</param>
        /// <returns>用户发帖信息</returns>
        public BBSItemListViewData ListBBSItemsByUserID(int id)
        {
            // 将Passport数据库中的用户ID转化为CQGJ数据库中的用户ID
            int userId = ToUserID(id);

            // 定义BBSItemViewData用来保存ID为id用户所发出的帖子列表
            BBSItemListViewData BBSItemViewData = new BBSItemListViewData();

            BBSItemViewData.UserID = userId;

            int bbsId = GetCurrentBBSID();

            try
            {
                // 根据用户ID以及ParentID=-1来取出该用户所发的帖子, 并以列表的方式保存. b 为临时变量
                var b = from bi in CQGJ.BBSItem where bi.User.UserID == userId && bi.ParentID == -1 && bi.BBS.BBSID == bbsId select bi;

                BBSItemViewData.BBSItemInfo = new List<BBSItemInfo>();
                foreach (var temp in b)
                {
                    // 初使化信息参数
                    BBSItemInfo tempInfo = new BBSItemInfo();
                    tempInfo.LastReply = new BBSItem();
                    tempInfo.TopicBBSItem = new BBSItem();

                    // 填充BBSItem信息
                    tempInfo.TopicBBSItem = temp;           // 发起帖

                    var tempLastReply = from bi in CQGJ.BBSItem where bi.ParentID == temp.ItemID orderby bi.SubmitTime descending select bi;
                    if (tempLastReply.Count() > 0)
                    {
                        tempInfo.LastReply = tempLastReply.First();         // 最新回复帖
                    }

                    BBSItemViewData.BBSItemInfo.Add(tempInfo);

                }

                return BBSItemViewData;
            }
            catch (ArgumentNullException)
            {
                return null;
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 显示下一个帖子
        /// </summary>
        /// <param name="id">本帖ID</param>
        public ActionResult NextItem(int id)
        {
            BBSItemListViewData BBSLVD = new BBSItemListViewData();
            int nextItemID = 0;
            int bbsId = GetCurrentBBSID();

            try
            {
                List<BBSItem> items = (from bi in CQGJ.BBSItem where bi.ParentID == -1 && bi.BBS.BBSID == bbsId select bi).ToList();
                BBSItem nextItem = new BBSItem();

                for (int i = 0; i < items.Count; i++)
                {
                    if (items[i].ItemID == id)
                    {
                        if (i != items.Count - 1)
                        {
                            nextItem = items[i + 1];
                            break;
                        }
                        else
                        {
                            nextItem = items[i];
                            break;
                        }
                    }
                }
                nextItemID = nextItem.ItemID;
                //BBSLVD = GetItemDetailInfoByID(nextItemID);
            }
            catch (Exception ex)
            {
                Response.Write("这是最后一个帖子" + ex.Message);
            }
            return RedirectToAction("item/" + nextItemID + "/1");
        }
Esempio n. 9
0
        /// <summary>
        /// 根据BBS论坛ID以前ParentID=-1来取出该BBS论坛的所有Topic
        /// </summary>
        /// <param name="id">该论坛的ID</param>
        public BBSItemListViewData ListBBSItemsByBBSID(int id)
        {
            // 定义BBSItemViewData用来保存BBS Topic的列表
            BBSItemListViewData BBSItemViewData = new BBSItemListViewData();

            BBSItemViewData.BBSID = id;

            try
            {
                // 获取该BBS的相关信息
                BBSItemViewData.BBSInfo = (from b in CQGJ.BBS where b.BBSID == id select b).First();

                // 根据BBS论坛ID以前ParentID=-1来取出该BBS论坛的所有Topic, 并以列表的方式保存
                var a = from bi in CQGJ.BBSItem
                        where bi.BBS.BBSID == id && bi.ParentID == -1
                        select bi;

                BBSItemViewData.BBSItemInfo = new List<BBSItemInfo>();
                foreach (var temp in a)
                {
                    // 初使化信息参数
                    BBSItemInfo tempInfo = new BBSItemInfo();
                    tempInfo.LastReply = new BBSItem();
                    tempInfo.TopicBBSItem = new BBSItem();

                    // 填充BBSItem信息
                    tempInfo.TopicBBSItem = temp;           // 发起帖

                    var tempLastReply = from bi in CQGJ.BBSItem where bi.ParentID == temp.ItemID orderby bi.SubmitTime descending select bi;
                    if (tempLastReply.Count() > 0)
                    {
                        tempInfo.LastReply = tempLastReply.First();         // 最新回复帖
                    }

                    BBSItemViewData.BBSItemInfo.Add(tempInfo);

                }

                return BBSItemViewData;
            }
            catch (ArgumentNullException)
            {
                return null;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 根据BBS论坛ID以前ParentID=-1来分页显示BBS论坛的所有Topic
        /// </summary>
        /// <param name="id">该论坛的ID</param>
        public void ListBBSItemsByPage(int id, int page)
        {
            // 定义BBSItemViewData用来保存BBS Topic的列表
            BBSItemListViewData BBSItemViewData = new BBSItemListViewData();

            BBSItemViewData.BBSID = id;

            HttpContext.Session["CurrentBBSID"] = id;

            // count 保存item的总条数
            int count = 0;

            try
            {
                // 获取该BBS的相关信息
                BBSItemViewData.BBSInfo = (from b in CQGJ.BBS where b.BBSID == id select b).FirstOrDefault();
                // 获取当前用户信息
                BBSItemViewData.User = (CQGJ.passport.User)HttpContext.Session["userobject"];
                // 根据BBS论坛ID以前ParentID=-1来取出该BBS论坛的所有Topic, 并以列表的方式保存
                var a = from bi in CQGJ.BBSItem
                        where bi.BBS.BBSID == id && bi.ParentID == -1
                        select bi;

                // item的总条数
                count = a.Count();

                BBSItemViewData.BBSItemInfo = new List<BBSItemInfo>();
                foreach (var temp in a)
                {
                    // 初使化信息参数
                    BBSItemInfo tempInfo = new BBSItemInfo();
                    tempInfo.LastReply = new BBSItem();
                    tempInfo.TopicBBSItem = new BBSItem();

                    // 填充BBSItem信息
                    tempInfo.TopicBBSItem = temp;           // 发起帖

                    var tempLastReply = from bi in CQGJ.BBSItem where bi.ParentID == temp.ItemID orderby bi.SubmitTime descending select bi;
                    if (tempLastReply.Count() > 0)
                    {
                        tempInfo.LastReply = tempLastReply.First();         // 最新回复帖
                    }

                    BBSItemViewData.BBSItemInfo.Add(tempInfo);

                }

                List<BBSItemInfo> itemList = new List<BBSItemInfo>();

                foreach (var b in BBSItemViewData.BBSItemInfo)
                {

                    BBSItem topic = b.TopicBBSItem;
                    BBSItem lastReply = b.LastReply;

                    BBSItemInfo info = new BBSItemInfo { LastReply = lastReply, TopicBBSItem = topic };

                    itemList.Add(info);

                }

                BBSItemViewData.BBSItemInfo.Clear();

                BBSItemViewData.BBSItemInfo = itemList.Skip(10 * (page - 1)).Take(10).ToList();

                // 定义分页信息
                UrlManager urlManager = new DefaultUrlManager(count, 10);
                Pager pager = new Pager(urlManager);
                BBSItemViewData.PagerString = pager.PagerString;

            }
            catch (ArgumentNullException)
            {
                Response.Write("该班级还没有人发贴!");
            }

            RenderView("ListBBSItems", BBSItemViewData);
        }
Esempio n. 11
0
        /// <summary>
        /// 根据BBS论坛ID以前ParentID=-1来取出该BBS论坛的所有Topic
        /// </summary>
        /// <param name="id">该论坛的ID</param>
        public void ListBBSItems(int id)
        {
            // 定义BBSItemViewData用来保存BBS Topic的列表
            BBSItemListViewData BBSItemViewData = new BBSItemListViewData();

            BBSItemViewData.BBSID = id;

            HttpContext.Session["CurrentBBSID"] = id;

            try
            {
                BBSItemViewData.BBSInfo = (from b in CQGJ.BBS where b.BBSID == id select b).First();
                BBSItemViewData.User = (CQGJ.passport.User)HttpContext.Session["userobject"];
                // 根据BBS论坛ID以前ParentID=-1来取出该BBS论坛的所有Topic, 并以列表的方式保存
                var a = from bi in CQGJ.BBSItem
                        where bi.BBS.BBSID == id && bi.ParentID == -1
                        select bi;

                BBSItemViewData.BBSItemInfo = new List<BBSItemInfo>();
                foreach (var temp in a)
                {
                    // 初使化信息参数
                    BBSItemInfo tempInfo = new BBSItemInfo();
                    tempInfo.LastReply = new BBSItem();
                    tempInfo.TopicBBSItem = new BBSItem();

                    // 填充BBSItem信息
                    tempInfo.TopicBBSItem = temp;           // 发起帖

                    var tempLastReply = from bi in CQGJ.BBSItem where bi.ParentID == temp.ItemID orderby bi.SubmitTime descending select bi;
                    if (tempLastReply.Count() > 0)
                    {
                        tempInfo.LastReply = tempLastReply.First();         // 最新回复帖
                    }

                    BBSItemViewData.BBSItemInfo.Add(tempInfo);

                }

                RenderView("ListBBSItems", BBSItemViewData);
            }
            catch (ArgumentNullException)
            {
                Response.Write("该班级还没有人发贴!");
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 根据班级ID获取BBSItemListViewData信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public BBSItemListViewData ListBBSItemByUserClassID(int id)
        {
            BBSItemListViewData bbsItemViewData = new BBSItemListViewData();
            try
            {
                int bbsId = (from bbs in CQGJ.BBS where bbs.Classes.ClassID == id select bbs.BBSID).First();

                bbsItemViewData = ListBBSItemsByBBSID(bbsId);

                return bbsItemViewData;

            }
            catch (ArgumentNullException)
            {
                return null;            // 错误处理

            }
        }
Esempio n. 13
0
        /// <summary>
        /// 根据班级ID分页显示BBSItem
        /// </summary>
        /// <param name="id"></param>
        public ActionResult toListBBSItemsByClassIDAndPager(int id, int page)
        {
            BBSItemListViewData ItemsViewData = ListBBSItemByUserClassID(id);
            //HttpContext.Session["CurrentBBSID"] = id;
            int count = 0;
            count = ItemsViewData.BBSItemInfo.Count();
            BBSItemListViewData ItemsOfPerPage = new BBSItemListViewData();
            ItemsOfPerPage.BBSID = ItemsViewData.BBSID;
            ItemsOfPerPage.BBSItemInfo = ItemsViewData.BBSItemInfo.Skip(10 * (page - 1)).Take(10).ToList();

            UrlManager urlManager = new DefaultUrlManager(count, 10);
            Pager pager = new Pager(urlManager);
            ItemsOfPerPage.PagerString = pager.PagerString;

            return View("BBSItemsOfClassInAdminPage", ItemsOfPerPage);
        }
Esempio n. 14
0
        /// <summary>
        /// 根据BBS标题关键字获取BBSItem
        /// </summary>
        /// <param name="id"></param>
        /// <param name="title"></param>        
        /// <returns></returns>
        public BBSItemListViewData GetBBSItemsByTitle(int id, string title)
        {
            BBSItemListViewData ItemListVD = new BBSItemListViewData();

            ItemListVD.BBSID = id;

            ItemListVD.BBSInfo = (from b in CQGJ.BBS where b.BBSID == id select b).First();

            ItemListVD.BBSItemInfo = new List<BBSItemInfo>();

            var searchedItems = from bi in CQGJ.BBSItem where bi.BBS.BBSID == id && bi.ParentID == -1 && bi.Subject.Contains(title) select bi;

            foreach (var a in searchedItems)
            {
                BBSItemInfo temp = new BBSItemInfo();
                temp.TopicBBSItem = new BBSItem();
                temp.TopicBBSItem = a;

                ItemListVD.BBSItemInfo.Add(temp);
            }

            return ItemListVD;
        }
Esempio n. 15
0
        /// <summary>
        /// 分页显示公共论坛的item
        /// </summary>
        /// <param name="id">PublicBBS id</param>
        /// <param name="page">分页页码</param>
        public void ListPublicBBSByPage(int id, int page)
        {
            int nbrOfPerPage = 10;
            int count = 0;

            HttpContext.Session["CurrentBBSID"] = id;

            BBSItemListViewData BBSItems = ListBBSItemsByBBSID(id);

            // 设置游客信息
            if (HttpContext.Session["userobject"] == null)
            {
                BBSItems.User = new CQGJ.passport.User { UserID = -1, Username = "******" };
                HttpContext.Session["userobject"] = BBSItems.User;
            }

            count = BBSItems.BBSItemInfo.Count();

            BBSItemListViewData perPage = new BBSItemListViewData();

            perPage.BBSItemInfo = BBSItems.BBSItemInfo.Skip(nbrOfPerPage * (page - 1)).Take(nbrOfPerPage).ToList();

            perPage.BBSID = BBSItems.BBSID;
            perPage.BBSInfo = BBSItems.BBSInfo;
            perPage.User = BBSItems.User;

            UrlManager urlManager = new DefaultUrlManager(count);
            Pager pager = new Pager(urlManager);
            perPage.PagerString = pager.PagerString;

            RenderView("ListPublicBBS", perPage);
        }
Esempio n. 16
0
        /// <summary>
        /// 获取Item的内容及回复等信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public BBSItemListViewData GetItemDetailInfoByID(int id)
        {
            BBSItemListViewData BBSItemViewData = new BBSItemListViewData();

            try
            {
                // 根据BBSItem的ID取出该条BBSItem的内容
                //BBSItemViewData.BBSItem = (from bi in CQGJ.BBSItem where bi.ItemID == id select bi).First();

                // 获取发起帖的内容
                BBSItemViewData.TopicItemInfo = new BBSItemInfo { TopicBBSItem = (from bi in CQGJ.BBSItem where bi.ItemID == id select bi).First()};
                // 获取发起帖作者的信息
                BBSItemViewData.TopicItemInfo.Author = GetUserInfoByID((int)BBSItemViewData.TopicItemInfo.TopicBBSItem.UserReference.EntityKey.EntityKeyValues[0].Value);

                try
                {
                    // 根据ParentID取出对该条BBSItem的回帖内容
                    BBSItemViewData.BBSItemsList = (from bj in CQGJ.BBSItem where bj.ParentID == id select bj).ToList();

                    // 获取该条BBS所属的BBS的ID
                    BBSItemViewData.BBSID = (int)BBSItemViewData.TopicItemInfo.TopicBBSItem.BBSReference.EntityKey.EntityKeyValues[0].Value;

                    // 获取回帖信息及回帖作者信息
                    BBSItemViewData.BBSItemInfo = new List<BBSItemInfo>();
                    foreach (BBSItem bi in BBSItemViewData.BBSItemsList)
                    {
                        BBSItemInfo tempInfo = new BBSItemInfo { TopicBBSItem = bi, Author = GetUserInfoByID((int)bi.UserReference.EntityKey.EntityKeyValues[0].Value) };

                        BBSItemViewData.BBSItemInfo.Add(tempInfo);
                    }

                }
                catch (ArgumentNullException)
                {
                    Response.Write("没有回帖");
                }

            }
            catch (ArgumentNullException)
            {
                Response.Write("该帖已被删除");
            }
            catch(Exception ex)
            {
                Response.Write(ex.Message);
            }

            return BBSItemViewData;
        }
Esempio n. 17
0
        /// <summary>
        /// 根据用户ID分页列出他的所有发帖
        /// </summary>
        /// <param name="id">Passport数据库中的用户ID</param>
        /// <param name="page"></param>
        public ActionResult MyItems(int id, int page)
        {
            BBSItemListViewData UserBBSItems = ListBBSItemsByUserID(id);
            UserBBSItems.BBSID = GetCurrentBBSID();
            int count = 0;
            count = UserBBSItems.BBSItemInfo.Count();
            BBSItemListViewData ItemsOfPerPage = new BBSItemListViewData();
            ItemsOfPerPage.BBSID = UserBBSItems.BBSID;
            ItemsOfPerPage.BBSItemInfo = UserBBSItems.BBSItemInfo.Skip(10 * (page - 1)).Take(10).ToList();

            UrlManager urlManager = new DefaultUrlManager(count, 10);
            Pager pager = new Pager(urlManager);
            ItemsOfPerPage.PagerString = pager.PagerString;
            return View("MyItems", ItemsOfPerPage);
        }