Ejemplo n.º 1
0
    public void BindList()
    {
        StringBuilder str = new StringBuilder();

        this.TotalRecords = ActivityBLL.Count_Activities(this.Term, this.UserName, this.Month, this.Year, this.Order, this.PageSize, this.AddedFilter);
        if (this.TotalRecords == 0)
        {
            str.Append("<div class=\"bx_msg\">");
            str.Append("<h4>" + NoRecordFoundText + "</h4>");
            str.Append("</div>");
            lst.InnerHtml = str.ToString();
            return;
        }

        List <UserActivity_Struct> _list = ActivityBLL.Load_Activities(this.Term, this.UserName, this.Month, this.Year, this.Order, this.PageSize, this.AddedFilter, this.isCache, 1);

        if (_list.Count > 0)
        {
            int          i   = 0;
            ActivityItem act = new ActivityItem();
            act.LeftWidth        = this._leftwidth; // profile layout style
            act.RightWidth       = this._rightwidth;
            act.Width            = 50;              // profile thumb height
            act.Height           = 50;
            act.isHoverEffect    = true;
            act.ShowProfileThumb = true; // show user profile thumb on right side.
            if (this.Page.User.Identity.IsAuthenticated)
            {
                act.LoggedInUserName = this.Page.User.Identity.Name;
            }
            for (i = 0; i <= _list.Count - 1; i++)
            {
                string _puser = _list[i].PosterUserName;
                if (_puser == "")
                {
                    _puser = _list[i].UserName;
                }

                PostUrl = UrlConfig.Prepare_User_Profile_Url(_puser, "activity", this.isAdmin) + "?id=" + _list[i].ActivityID;
                // generate list
                str.Append(act.Process(_list[i]));
                str.Append("<div class=\"clear\"></div>"); // clear floating items
            }
            str.Append("<div class=\"clear\"></div>");     // clear floating items
            // store comment flags
            int TotalPages = 1;
            if (this.TotalRecords >= this.PageSize)
            {
                TotalPages = (int)Math.Ceiling((double)TotalRecords / this.PageSize);
            }
            str.Append("<span style=\"display:none;\" id=\"cmt_tcmts\">" + this.TotalRecords + "</span>\n"); // store total pages info in <span>
            str.Append("<span style=\"display:none;\" id=\"cmt_tpages\">" + TotalPages + "</span>\n");       // store total pages info in <span>
            str.Append("<span style=\"display:none;\" id=\"cmt_psize\">" + PageSize + "</span>\n");          // store page size infor in <span>
            str.Append("<span style=\"display:none;\" id=\"cmt_pnum\">1</span>\n");                          // current page number
            str.Append("<div id=\"cmt_load_cnt\"></div>\n");                                                 // load more activity container
            str.Append("<div id=\"cmt_loading\"></div>\n");                                                  // show loading progres
            if (TotalPages > 1)
            {
                str.Append("<div id=\"actldmore\" class=\"item_pad_4 bx_br_both actmore\" style=\"padding:5px 0px;\">\n");
                str.Append("<a href=\"#\" class=\"bold actldmore\" title=\"load more activities\"><i class=\"icon-chevron-down icon-white\"></i> Load more...</a>\n");
                str.Append("</div>\n");
            }
        }
        else
        {
            str.Append("<div class=\"bx_msg\">");
            str.Append("<h4>" + this.NoRecordFoundText + "</h4>");
            str.Append("</div>");
        }
        lst.InnerHtml = str.ToString();
    }