Пример #1
0
        private void PageGo(object sender, EventArgs e)
        {
            int inputPageNo = 0;

            if (!int.TryParse(tbPage.Text, out inputPageNo))
            {
                tbPage.Clear();
                return;
            }
            if (inputPageNo < 1 || inputPageNo > pageCount)
            {
                tbPage.Clear();
                return;
            }
            if (inputPageNo == pageNo)
            {
                return;
            }

            pageNo = inputPageNo;

            if (PageChanged != null)
            {
                PageChanged(sender, e);
                return;
            }

            IPageSplit iPage = GetIPageSplitObj();

            if (iPage != null)
            {
                iPage.PageGo(inputPageNo);
            }
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PageSelector&lt;EntityType&gt;"/> class.
        /// </summary>
        /// <param name="gateway">The gateway.</param>
        /// <param name="ps">The ps.</param>
        public PageSelector(Gateway gateway, IPageSplit ps)
        {
            Check.Require(gateway != null, "gateway could not be null.");
            Check.Require(ps != null, "ps could not be null.");

            this.gateway = gateway;
            this.ps      = ps;
        }
Пример #3
0
        private void DbHelperReadSecondPage(object val)
        {
            IPageSplit ps = gateway.DbHelper.SelectPageSplit("Orders", new string[] { "*" }, "OrderID > @OrderID", "OrderID desc", "OrderID", new object[] { 10 });

            ps.PageSize = 100;
            DataSet ds = ps.GetPage(2);

            ds = null;
            ps = null;
        }
Пример #4
0
        private object DbHelperReadFirstPage()
        {
            IPageSplit ps = gateway.DbHelper.SelectPageSplit("Orders", new string[] { "*" }, "OrderID > @OrderID", "OrderID desc", "OrderID", new object[] { 10 });

            ps.PageSize = 100;
            DataSet ds = ps.GetPage(1);

            ds = null;
            ps = null;
            return(null);
        }
Пример #5
0
        private void btfirst_Click(object sender, EventArgs e)
        {
            pageNo = 1;
            if (PageChanged != null)
            {
                PageChanged(sender, e);
                DataBind();
                return;
            }

            IPageSplit iPage = GetIPageSplitObj();

            if (iPage != null)
            {
                iPage.MoveFirst();
            }
        }
Пример #6
0
        public static DataSet FindList(string fields, string tablename, string keyId, string order, string expression, int PageSize, int PageIndex, out int RowCount)
        {
            string SelectSql = string.Format("SELECT {0} from {1}", fields, tablename);

            if (expression != null && expression != string.Empty)
            {
                SelectSql = SelectSql + " WHERE " + expression;
            }
            SelectSql += order;
            Gateway    gateway   = Gateway.Default;
            IPageSplit PageSplit = gateway.Db.GetPageSplit(SelectSql, keyId, null);

            PageSplit.PageSize = PageSize;
            RowCount           = PageSplit.GetRowCount();
            DataSet ds = PageSplit.GetPage(PageIndex);

            return(ds);
        }
Пример #7
0
        /// <summary>
        /// <para>Creates an <see cref="IPageSplit"/> for a SQL page splitable select query.</para>
        /// </summary>
        /// <param name="selectStatement"><para>The text of the basic select query for all rows.</para></param>
        /// <param name="keyColumn"><para>The sigle main DEFAULT_KEY of the query.</para></param>
        /// <param name="paramValues"><para>The param values of the query.</para></param>
        /// <returns><para>The <see cref="IPageSplit"/> for the SQL query.</para></returns>
        public IPageSplit GetPageSplit(string selectStatement, string keyColumn, object[] paramValues)
        {
            IPageSplit ps = dbProvider.CreatePageSplit(this, selectStatement, keyColumn, paramValues);

            return(ps);
        }