예제 #1
0
        /// <summary>
        /// 模拟数据库分页
        /// </summary>
        /// <returns></returns>
        private DataTable GetPagedDataTable()
        {
            whut.xljk.BLL.ArticleBLL bll = new whut.xljk.BLL.ArticleBLL();
            int pageIndex = Grid1.PageIndex;
            int pageSize  = Grid1.PageSize;

            string sortField     = Grid1.SortField;
            string sortDirection = Grid1.SortDirection;

            DataTable table2 = bll.GetAllList("").Tables[0];

            DataView view2 = table2.DefaultView;

            view2.Sort = String.Format("{0} {1}", sortField, sortDirection);

            DataTable table = view2.ToTable();

            DataTable paged = table.Clone();

            int rowbegin = pageIndex * pageSize;
            int rowend   = (pageIndex + 1) * pageSize;

            if (rowend > table.Rows.Count)
            {
                rowend = table.Rows.Count;
            }

            for (int i = rowbegin; i < rowend; i++)
            {
                paged.ImportRow(table.Rows[i]);
            }

            return(paged);
        }
예제 #2
0
        /// <summary>
        /// [ISingleGridPage]删除表格数据
        /// </summary>
        public void DeleteSelectedRows()
        {
            whut.xljk.BLL.ArticleBLL bll = new whut.xljk.BLL.ArticleBLL();

            foreach (int n in Grid.SelectedRowIndexArray)
            {
                object[] keys = Grid1.DataKeys[n];
                String   id   = keys[0].ToString();
                if (id == "0001")
                {
                    Alert.ShowInTop("中心概况的新闻不允许删除!");
                }
                else
                {
                    bll.Delete(id);
                }
            }
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            Alert.ShowInTop("删除选中的 " + Grid1.SelectedRowIndexArray.Length + " 项纪录!");
        }
예제 #3
0
 /// <summary>
 /// 返回总项数
 /// </summary>
 /// <returns></returns>
 private int GetTotalCount()
 {
     whut.xljk.BLL.ArticleBLL bll = new whut.xljk.BLL.ArticleBLL();
     bll.GetAllList("");
     return(bll.GetAllList("").Tables[0].Rows.Count);
 }
예제 #4
0
        public List <T_Article> GetListByColumn(int pageIndex, int pageSize, string columnId, out int total)
        {
            ArticleBLL article = new ArticleBLL();

            return(article.DataTableToList(dal.GetListByColumn(pageIndex, pageSize, columnId, out total)));
        }