Ejemplo n.º 1
0
        /// <summary>
        /// 模拟数据库分页
        /// </summary>
        /// <returns></returns>
        private DataTable GetPagedDataTable()
        {
            whut.xljk.BLL.FileBLL bll = new whut.xljk.BLL.FileBLL();
            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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// [ISingleGridPage]删除表格数据
        /// </summary>
        public void DeleteSelectedRows()
        {
            whut.xljk.BLL.FileBLL bll = new whut.xljk.BLL.FileBLL();

            foreach (int n in Grid.SelectedRowIndexArray)
            {
                object[] keys = Grid1.DataKeys[n];
                String   id   = keys[0].ToString();
                bll.deleteFile(id);
            }
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
            Alert.ShowInTop("删除选中的 " + Grid1.SelectedRowIndexArray.Length + " 项纪录!");
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 返回总项数
 /// </summary>
 /// <returns></returns>
 private int GetTotalCount()
 {
     whut.xljk.BLL.FileBLL bll = new whut.xljk.BLL.FileBLL();
     bll.GetAllList();
     return(bll.GetAllList().Tables[0].Rows.Count);
 }