예제 #1
0
        protected void LoadData()
        {
            if (ContentType == null)
            {
                Utils.ShowMessage(lblMsg, "Dữ liệu cung cấp chưa đúng. Bạn kiểm tra lại");
                return;
            }

            litType.Text = ContentType.ContentTypeName;

            List <DM.Content> lst = TNHelper.GetContentsByType(ContentType.Id);
            int totalRow          = 0;

            if (lst != null)
            {
                totalRow = lst.Count;
                lst      = lst.OrderByDescending(p => p.Id)
                           .Skip((PageIndex - 1) * PageSize)
                           .Take(PageSize).ToList();
            }

            if (lst != null)
            {
                rptList.DataSource = lst;
                rptList.DataBind();
            }

            pagerList.ItemCount = totalRow;
            pagerList.Visible   = (pagerList.PageCount > 1);

            if (totalRow == 0)
            {
                Utils.ShowMessage(lblMsg, "Không tìm thấy dữ liệu thông báo.");
            }
        }
        protected void LoadData()
        {
            List <DM.Content> lst = TNHelper.GetContentsByType(ContentTypeId);

            if (lst != null)
            {
                lst = lst.Where(p => p.Active)
                      .OrderByDescending(p => p.Id)
                      .ToList();
            }

            if (lst != null && lst.Count > 0)
            {
                rptList.DataSource = lst;
                rptList.DataBind();
            }
            else
            {
                Utils.ShowMessage(lblMsg, "Không tìm thấy dữ liệu");
            }
        }
예제 #3
0
        protected void LoadData()
        {
            string strId = Page.RouteData.Values["id"] as string;
            int    id    = 0;

            int.TryParse(strId, out id);

            DM.Content content = TNHelper.GetContentObject(id);
            if (content != null)
            {
                litTitle.Text   = content.ContentTitle;
                litContent.Text = content.ContentText;

                if (content.ContentType != null)
                {
                    List <DM.Content> lst = TNHelper.GetContentsByType(content.ContentType.Id);
                    if (lst != null && lst.Count > 0)
                    {
                        lst = lst.Where(p => p.Active && p.Id < content.Id)
                              .OrderByDescending(p => p.Id)
                              .Take(10)
                              .ToList();
                    }

                    if (lst != null && lst.Count > 0)
                    {
                        rptList.DataSource = lst;
                        rptList.DataBind();
                    }
                }
            }
            else
            {
                Utils.ShowMessage(lblMsg, "Không tìm thấy dữ liệu yêu cầu");
            }
        }