示例#1
0
    public int ShowMutualFriends(int UserCode, int FriendCode)
    {
        UsersDataContext dc = new UsersDataContext();

        ConcatUrl = "&Keyword=" + Keyword;
        int ResultCount = 0;

        int SkipCount = PageSize * (PageNo - 1);

        System.Data.Linq.ISingleResult <spGetMutualFriendsResult> ItemList;
        int LoggedUserCode = Convert.ToInt32(Session["UserCode"]);

        ItemList = dc.spGetMutualFriends(UserCode, FriendCode);

        ResultCount = dc.vUserFriends.Where(p => p.UserCode.Equals(UserCode)).Skip(SkipCount).Count();

        rptItems.DataSource = ItemList;
        rptItems.DataBind();

        if (rptItems.Items.Count > 0)
        {
            string Message = "";
            if (rptItems.Items.Count >= 500)
            {
                Message = " بیشتر از 500 " + " نتیجه برای <b>" + Keyword + " پیدا شد </b> ";
            }
            else
            {
                Message = ResultCount + " نتیجه برای <b>" + Keyword + " پیدا شد </b>";
            }

            //msgBox.Text = Message;
            Page.Title        = "دوستان مشترک:" + " سفحه " + PageNo;
            lblPageTitle.Text = "دوستان مشترک";


            int PageCount = ResultCount / PageSize;
            if (ResultCount % PageSize > 0)
            {
                PageCount++;
            }
            pgrToolbar.PageNo    = PageNo;
            pgrToolbar.PageCount = PageCount;
            pgrToolbar.ConcatUrl = ConcatUrl;
            pgrToolbar.PageBind();
        }
        else
        {
            //msgBox.Text = " No results found for <b>" + Keyword + "</b>";
        }
        return(ResultCount);
    }