Example #1
0
 protected void pagerList_PageChanged(object sender, EventArgs e)
 {
     Wuqi.Webdiyer.AspNetPager pager = (Wuqi.Webdiyer.AspNetPager)sender;
     pageIndex = pager.CurrentPageIndex;
     pageSize  = pager.PageSize;
     BindData();
 }
Example #2
0
        public WebPager(Wuqi.Webdiyer.AspNetPager Pager)
        {
            _Pager = Pager;
            _Pager.SubmitButtonText  = "GO";
            _Pager.CustomInfoClass   = "CustomInfo";
            _Pager.CssClass          = "Pager";
            _Pager.SubmitButtonClass = "PagerBtn";
            //_Pager.InputBoxClass = "PagerInput";
            _Pager.CurrentPageButtonClass = "CurrentPage";
            _Pager.ShowCustomInfoSection  = Wuqi.Webdiyer.ShowCustomInfoSection.Left;
            //_Pager.ShowInputBox = Wuqi.Webdiyer.ShowInputBox.Never;
            _Pager.AlwaysShow = true;
            _Pager.UrlPaging  = true;

            string mypage = Text.RegexClass.ChkInt(HttpContext.Current.Request.QueryString["page"]);

            if (mypage != "0")
            {
                _CurrentPageIndex = Convert.ToInt32(mypage);
            }
            else
            {
                _CurrentPageIndex = _Pager.CurrentPageIndex;
            }

            if (_where == null)
            {
                _where = "";
            }
        }
Example #3
0
 /// <summary>
 /// Bind Pager CustomInfoHtml
 /// </summary>
 /// Copyright (c)
 /// 创 建 人:王好([email protected])
 /// 创建日期:2012年2月1日
 /// 修 改 人:王好
 /// 修改日期:
 /// 版 本:
 /// <param name="aspNetPager"></param>
 public new void BindPagerCustomInfoHTML(Wuqi.Webdiyer.AspNetPager aspNetPager)
 {
     base.BindPagerCustomInfoHTML(aspNetPager);
     //    aspNetPager.CustomInfoHTML += "记录总数:<font color=\"blue\"><b>" + aspNetPager.RecordCount.ToString() + "</b></font>";
     //    aspNetPager.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + aspNetPager.PageCount.ToString() + "</b></font>";
     //    aspNetPager.CustomInfoHTML += " 当前页:<font color=\"red\"><b>" + aspNetPager.CurrentPageIndex.ToString() + "</b></font>";
 }
Example #4
0
        /// <summary>
        /// 初始化设置分页控件和分页信息类

        /// </summary>
        /// <param name="aspNetPager">分页控件</param>
        /// <param name="pager">分页信息类</param>
        /// <param name="pagerSize">页数</param>
        public static void InitPageControl(Wuqi.Webdiyer.AspNetPager aspNetPager, DataPage page, int pagerSize, bool isUseDefault)
        {
            //对控件的基本设置
            if (isUseDefault)
            {
                aspNetPager.AlwaysShow      = false;
                aspNetPager.FirstPageText   = " 首 页 ";
                aspNetPager.NextPageText    = " 下一页 ";
                aspNetPager.LastPageText    = "末 页 ";
                aspNetPager.PrevPageText    = "上一页 ";
                aspNetPager.CustomInfoClass = "PageCustomInfo";
                //aspNetPager.PageIndexBoxClass = "PageInputBox";
                aspNetPager.CustomInfoTextAlign    = System.Web.UI.WebControls.HorizontalAlign.Left;
                aspNetPager.CustomInfoSectionWidth = new System.Web.UI.WebControls.Unit("40%");
                aspNetPager.SubmitButtonClass      = "PageInputButton";
                aspNetPager.SubmitButtonText       = "";
                //aspNetPager.ShowPageIndexBox = Wuqi.Webdiyer.ShowPageIndexBox.Never;
            }
            if (page.PageSize != pagerSize)
            {
                page.PageSize = pagerSize;
            }
            if (page.PageIndex != aspNetPager.CurrentPageIndex)
            {
                page.PageIndex = aspNetPager.CurrentPageIndex;
            }
            if (aspNetPager.PageSize != page.PageSize)
            {
                aspNetPager.PageSize = page.PageSize;
            }
        }
Example #5
0
 public static void pagerbind(Wuqi.Webdiyer.AspNetPager AspNetPager1, int allcount, int pagecount)
 {
     AspNetPager1.RecordCount     = allcount;
     AspNetPager1.CustomInfoHTML  = "记录总数:<font color=\"blue\"><b>" + AspNetPager1.RecordCount.ToString() + "</b></font>";
     AspNetPager1.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + AspNetPager1.PageCount.ToString() + "</b></font>";
     AspNetPager1.CustomInfoHTML += " 当前页:<font color=\"red\"><b>" + AspNetPager1.CurrentPageIndex.ToString() + "</b></font>";
 }
Example #6
0
        public void InitBindData(Control c, Wuqi.Webdiyer.AspNetPager aspnet, string tbname, string tbcolumn, string sqlwhere)
        {
            aspnet.RecordCount = GetRows(tbname, sqlwhere);
            if (aspnet.RecordCount > 0)
            {
                string contype = c.GetType().ToString();

                DataSet ds = GetList(aspnet.PageSize, aspnet.CurrentPageIndex, sqlwhere, tbname, tbcolumn);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (contype.IndexOf("GridView") != -1)
                    {
                        GridView gv = (GridView)c;
                        gv.DataSource = ds;
                        gv.DataBind();
                    }
                    else if (contype.IndexOf("Repeater") != -1)
                    {
                        Repeater rep = (Repeater)c;
                        rep.DataSource = ds;
                        rep.DataBind();
                    }
                    else if (contype.IndexOf("DataList") != -1)
                    {
                        DataList dl = (DataList)c;
                        dl.DataSource = ds;
                        dl.DataBind();
                    }
                }

                c.Visible = true;
            }
            else
            {
                string contype = c.GetType().ToString();
                if (contype.IndexOf("GridView") != -1)
                {
                    GridView gv = (GridView)c;
                    gv.DataSource = null;
                    gv.DataBind();
                }
                else if (contype.IndexOf("Repeater") != -1)
                {
                    Repeater rep = (Repeater)c;
                    rep.DataSource = null;
                    rep.DataBind();
                }
                else if (contype.IndexOf("DataList") != -1)
                {
                    DataList dl = (DataList)c;
                    dl.DataSource = null;
                    dl.DataBind();
                }
                c.Visible = false;
            }
        }
Example #7
0
        /// <summary>
        /// 依据取回的记录设置分页控件

        /// </summary>
        /// <param name="aspNetPager">分页控件</param>
        /// <param name="pager">分页信息类</param>
        public static void SetPageControl(Wuqi.Webdiyer.AspNetPager aspNetPager, int recordCount, int pageIndex)
        {
            if (aspNetPager.RecordCount != recordCount)
            {
                aspNetPager.RecordCount = recordCount;
            }
            if (aspNetPager.CurrentPageIndex != pageIndex)
            {
                aspNetPager.CurrentPageIndex = pageIndex;
            }
            //aspNetPager.CustomInfoText = "";
        }
Example #8
0
        //#region Repeater控件分页帮定
        ///// <summary #region GridView控件分页帮定
        /// <summary>
        /// GridView控件分页帮定
        /// </summary>
        /// <param name="anpager">AspNetPager分页控件</param>
        /// <param name="strTableName">表名</param>
        /// <param name="strPrimaryKey">表的唯一主建名</param>
        /// <param name="strQuaryCondition">查询Where条件,不含Where</param>
        /// <param name="strOrderCondition">需要排序的字段名</param>
        /// <param name="rptControl">GridView控件</param>
        public void GridViewPagerBindbyRowNumber(Wuqi.Webdiyer.AspNetPager anpager, string strTableName, string strPrimaryKey, string OrgCode, string PositionName, string OrgName, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl)
        {
            string  strsel  = "";
            DataSet dstTemp = new DataSet();

            if (OrgCode != "")
            {
                strsel       = "select * from (select row_number() over (order by " + strOrderCondition + ") as rowno,p.*,o.orgName,case p.IsForbid when 1 then  '是' else '否'end as Forbid from " + strTableName + " and   p.OrgCode like @OrgCode and p.PositionName like @PositionName and o.orgName like @orgName) as result Where (rowno Between " + (anpager.CurrentPageIndex - 1) * anpager.PageSize + " and " + anpager.CurrentPageIndex * anpager.PageSize + ")";
                PositionName = "%" + PositionName + "%";
                OrgName      = "%" + OrgName + "%";
                OrgCode      = "%" + OrgCode + "%";
                SqlParameter[] parameters = { new SqlParameter("@OrgCode", OrgCode), new SqlParameter("@PositionName", PositionName), new SqlParameter("@orgName", OrgName) };
                parameters[0].Value = OrgCode;
                parameters[1].Value = PositionName;
                parameters[2].Value = OrgName;

                anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle("Select Count(*) From " + strTableName + " and  p.OrgCode like @OrgCode and p.PositionName like @PositionName and o.orgName like @orgName ", parameters));
                dstTemp             = DbHelperSQL.Query(strsel, parameters);
            }
            else
            {
                strsel       = "select * from (select row_number() over (order by " + strOrderCondition + ") as rowno,p.*,o.orgName,case p.IsForbid when 1 then  '否' else '是'end as Forbid from " + strTableName + " and    p.PositionName like @PositionName and  o.orgName like @orgName) as result Where (rowno Between " + (anpager.CurrentPageIndex - 1) * anpager.PageSize + " and " + anpager.CurrentPageIndex * anpager.PageSize + ")";
                PositionName = "%" + PositionName + "%";
                OrgName      = "%" + OrgName + "%";
                SqlParameter[] parameters = { new SqlParameter("@PositionName", PositionName), new SqlParameter("@orgName", OrgName) };
                parameters[0].Value = PositionName;
                parameters[1].Value = OrgName;
                anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle("Select Count(*) From " + strTableName + " and   p.PositionName like @PositionName and o.orgName like @orgName", parameters));
                dstTemp             = DbHelperSQL.Query(strsel, parameters);
            }



            if (dstTemp.Tables[0].Rows.Count == 0)
            {
                //DataRow dr = dstTemp.Tables[0].NewRow();
                //dstTemp.Tables[0].Rows.Add(dr);
                grvControl.DataSource = null;
                grvControl.DataBind();
            }
            else
            {
                grvControl.DataSource = dstTemp.Tables[0];
                grvControl.DataBind();
            }


            //动态设置用户自定义文本内容
            anpager.CustomInfoHTML  = "共有<font color=\"blue\"><b>" + anpager.RecordCount.ToString() + "</b></font>条记录";
            anpager.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + anpager.PageCount.ToString() + "</b></font>页";
            anpager.CustomInfoHTML += " 当前页:第<font color=\"red\"><b>" + anpager.CurrentPageIndex.ToString() + "</b></font>页";
        }
Example #9
0
 protected void FetchCurpage(string keyword, Wuqi.Webdiyer.AspNetPager anpObj)
 {
     if (Request.QueryString[keyword] != null && CheckInput.CheckDigit(Request.QueryString[keyword].Trim()))
     {
         int curPage = int.Parse(Request.QueryString[keyword].ToString());
         anpObj.RecordCount      = curPage * anpObj.PageSize;
         anpObj.CurrentPageIndex = curPage;
     }
     else
     {
         anpObj.CurrentPageIndex = 1;
     }
 }
        //#region Repeater控件分页帮定
        ///// <summary #region GridView控件分页帮定
        /// <summary>
        /// GridView控件分页帮定
        /// </summary>
        /// <param name="anpager">AspNetPager分页控件</param>
        /// <param name="strTableName">表名</param>
        /// <param name="strPrimaryKey">表的唯一主建名</param>
        /// <param name="strQuaryCondition">查询Where条件,不含Where</param>
        /// <param name="strOrderCondition">需要排序的字段名</param>
        /// <param name="rptControl">GridView控件</param>
        public static void GridViewPagerBind(Wuqi.Webdiyer.AspNetPager anpager, string strTableName, string strPrimaryKey, string strQuaryCondition, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@pageindex", SqlDbType.Int),
                new SqlParameter("@pagesize", SqlDbType.Int),
                new SqlParameter("@docount", SqlDbType.Bit),
                new SqlParameter("@strwhere", SqlDbType.NVarChar, 1000),
                new SqlParameter("@tablenm", SqlDbType.NVarChar, 100),
                new SqlParameter("@tbmainid", SqlDbType.NVarChar, 100),
                new SqlParameter("@strorder", SqlDbType.NVarChar, 100),
            };

            parameters[0].Value = anpager.CurrentPageIndex;
            parameters[1].Value = anpager.PageSize;
            parameters[2].Value = false;
            parameters[3].Value = strQuaryCondition;
            parameters[4].Value = strTableName;
            parameters[5].Value = strPrimaryKey;
            parameters[6].Value = strOrderCondition;

            if (strQuaryCondition == "")
            {
                anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle("Select Count(*) From " + strTableName));
            }
            else
            {
                anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle("Select Count(*) From " + strTableName + " Where " + strQuaryCondition));
            }
            DataSet dstTemp = DbHelperSQL.DRunProcedure("P_ControlPager", parameters, "NewTableName");

            if (dstTemp.Tables[0].Rows.Count == 0)
            {
                //DataRow dr = dstTemp.Tables[0].NewRow();
                //dstTemp.Tables[0].Rows.Add(dr);
                grvControl.DataSource = null;
                grvControl.DataBind();
            }
            else
            {
                grvControl.DataSource = dstTemp.Tables["NewTableName"];
                grvControl.DataBind();
            }


            //动态设置用户自定义文本内容
            anpager.CustomInfoHTML  = "共有<font color=\"blue\"><b>" + anpager.RecordCount.ToString() + "</b></font>条记录";
            anpager.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + anpager.PageCount.ToString() + "</b></font>页";
            anpager.CustomInfoHTML += " 当前页:第<font color=\"red\"><b>" + anpager.CurrentPageIndex.ToString() + "</b></font>页";
        }
        /// <summary>
        /// Note: this method is only suitable for single table queries, multi table query please refer to this code to expand!
        /// Call a query, all data in a table, only need to specify the table name: ControlHelper.BindData2Repeater(rptModuleList, pager, "Sys_Menu")
        /// Call two, query a table according to the conditions, the need for additional table name is specified, the conditions and parameters: ControlHelper.BindData2Repeater(rptModuleList, pager, "Sys_Menu", where, ps)
        /// Call three, query a table according to the conditions, the need for additional table name is specified, and parameters, the sort field, ID field: ControlHelper.BindData2Repeater(rptModuleList, pager, "Sys_Menu", where, ps, "OrderNo Desc", "BizID")
        /// </summary>
        /// <param name="rpt"></param>
        /// <param name="pager"></param>
        /// <param name="tableName"></param>
        /// <param name="where"></param>
        /// <param name="ps"></param>
        /// <param name="sortField"></param>
        /// <param name="idField"></param>
        public static void BindData2Repeater(Repeater rpt, Wuqi.Webdiyer.AspNetPager pager, string tableName, string where = "", IList <System.Data.SqlClient.SqlParameter> ps = null, string sortField = "ID", string idField = "ID", string tempSql = null)
        {
            if (where.Length == 0)
            {
                where = "1=1";
            }
            if (ps == null)
            {
                ps = new List <System.Data.SqlClient.SqlParameter>();
            }

            if (pager == null)
            {
                string sql = string.Format(@"select * from {0} where {1} order by {3};", tableName, where, idField, sortField);

                DataSet ds = SqlHelper.ExecuteDataset(WebConfigHelper.DefaultConnectionString, CommandType.Text, sql, ps.ToArray());
                rpt.DataSource = ds.Tables[0];
                rpt.DataBind();
            }
            else
            {
                int numFrom = Math.Max(pager.CurrentPageIndex - 1, 0) * pager.PageSize + 1;
                int numTo   = pager.CurrentPageIndex * pager.PageSize;

                string sql = string.Format(@"
select count(1) from {0} where {1};
with _T_ (_S_N_,_ID_) as 
(  
    select ROW_NUMBER() OVER(ORDER BY {3}),{2} from {0} where {1} 
)  
select * from _T_ left join {0} t0 on _T_._ID_ = t0.{2}
where _T_._S_N_ BETWEEN {4} AND {5} order by {3};"
                                           , tableName, where, idField, sortField, numFrom, numTo);

                DataSet ds = SqlHelper.ExecuteDataset(WebConfigHelper.DefaultConnectionString, CommandType.Text, tempSql + sql, ps.ToArray());
                pager.RecordCount = (int)ds.Tables[0].Rows[0][0];
                rpt.DataSource    = ds.Tables[1];
                rpt.DataBind();

                if (pager.RecordCount == 0)
                {
                    pager.CustomInfoHTML = "<font color='red'><b>%CurrentPageIndex%</b></font>/%PageCount%&nbsp;&nbsp;" + "Total:%RecordCount%";
                }
                else
                {
                    pager.CustomInfoHTML = "<font color='red'><b>%CurrentPageIndex%</b></font>/%PageCount%&nbsp;&nbsp;Total:%RecordCount%(%StartRecordIndex%~%EndRecordIndex%)";
                }
            }
        }
        //#region Repeater控件分页帮定
        ///// <summary #region GridView控件分页帮定
        /// <summary>
        /// GridView控件分页帮定
        /// </summary>
        /// <param name="anpager">AspNetPager分页控件</param>
        /// <param name="strQuaryCondition">查询Where条件,不含Where</param>
        /// <param name="strOrderCondition">需要排序的字段名</param>
        /// <param name="rptControl">GridView控件</param>
        public void GridViewPagerBindbyRowNumber(Wuqi.Webdiyer.AspNetPager anpager, string strCollCode, string strCollName, string strWhere, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl)
        {
            StringBuilder strSql  = new StringBuilder();
            DataSet       dstTemp = new DataSet();

            strSql.Append("select * from (select row_number() over (order by " + strOrderCondition + ") as rowno,*  from VSYS_Colliery where CollCode like @CollCode and CollName like @CollName ");
            strSql.Append(strWhere);
            strSql.Append(" ) as result Where (rowno Between " + ((anpager.CurrentPageIndex - 1) * anpager.PageSize + 1) + " and " + anpager.CurrentPageIndex * anpager.PageSize + ")");

            strCollCode = "%" + strCollCode + "%";
            strCollName = "%" + strCollName + "%";

            SqlParameter[] parameters = { new SqlParameter("@CollCode", strCollCode), new SqlParameter("@CollName", strCollName) };
            parameters[0].Value = strCollCode;
            parameters[1].Value = strCollName;



            StringBuilder strb = new StringBuilder();

            strb.Append("Select Count(*) From  VSYS_Colliery where CollCode like @CollCode and CollName like @CollName  ");
            strb.Append(strWhere);

            anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle(strb.ToString(), parameters));
            dstTemp             = DbHelperSQL.Query(strSql.ToString(), parameters);



            if (dstTemp.Tables[0].Rows.Count == 0)
            {
                grvControl.DataSource = null;
                grvControl.DataBind();
            }
            else
            {
                grvControl.DataSource = dstTemp.Tables[0];
                grvControl.DataBind();
            }


            //动态设置用户自定义文本内容
            anpager.CustomInfoHTML  = "共有<font color=\"blue\"><b>" + anpager.RecordCount.ToString() + "</b></font>条记录";
            anpager.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + anpager.PageCount.ToString() + "</b></font>页";
            anpager.CustomInfoHTML += " 当前页:第<font color=\"red\"><b>" + anpager.CurrentPageIndex.ToString() + "</b></font>页";
        }
Example #13
0
        /// <summary>
        /// 依据取回的记录设置分页控件

        /// </summary>
        /// <param name="aspNetPager">分页控件</param>
        /// <param name="pager">分页信息类</param>
        public static void SetPageControl(Wuqi.Webdiyer.AspNetPager aspNetPager, DataPage page, bool isText)
        {
            if (aspNetPager.RecordCount != page.RecordCount)
            {
                aspNetPager.RecordCount = page.RecordCount;
            }
            if (aspNetPager.CurrentPageIndex != page.PageIndex)
            {
                aspNetPager.CurrentPageIndex = page.PageIndex;
            }
            if (isText == true)
            {
                aspNetPager.CustomInfoText        = "记录总数:<b>" + aspNetPager.RecordCount.ToString() + "</b>";
                aspNetPager.CustomInfoText       += " 总页数:<b>" + aspNetPager.PageCount.ToString() + "</b>";
                aspNetPager.CustomInfoText       += " 当前页:<font color=\"red\"><b>" + page.PageIndex.ToString() + "</b></font>";
                aspNetPager.ShowCustomInfoSection = Wuqi.Webdiyer.ShowCustomInfoSection.Left;
            }
        }
        /// <summary>
        /// 根据分页获得数据列表
        /// </summary>
        public static void GridViewPagerBindByRowNum(Wuqi.Webdiyer.AspNetPager anpager, string strTableName, string strWhere, string strOrder, System.Web.UI.WebControls.GridView grvControl)
        {
            int iCount = Convert.ToInt32(DbHelperSQL.GetSingle("select count(0) from " + strTableName + " where " + strWhere));

            anpager.RecordCount = iCount;
            int    iRow1  = (anpager.CurrentPageIndex - 1) * anpager.PageSize + 1;
            int    iRow2  = anpager.CurrentPageIndex * anpager.PageSize;
            string strSql = "select * from "
                            + "(select row_number() over(order by " + strOrder + ") RowNo,* from " + strTableName
                            + " where " + strWhere + ") as result where RowNo>=" + iRow1 + " and RowNo <=" + iRow2;
            DataSet ds = DbHelperSQL.Query(strSql);

            grvControl.DataSource = ds;
            grvControl.DataBind();
            //动态设置用户自定义文本内容
            anpager.CustomInfoHTML  = "共有<font color=\"blue\"><b>" + anpager.RecordCount.ToString() + "</b></font>条记录";
            anpager.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + anpager.PageCount.ToString() + "</b></font>页";
            anpager.CustomInfoHTML += " 当前页:第<font color=\"red\"><b>" + anpager.CurrentPageIndex.ToString() + "</b></font>页";
        }
        /// <summary>
        /// Note: this method is only suitable for single table queries, multi table query please refer to this code to expand!
        /// Call a query, all data in a table, only need to specify the table name: ControlHelper.BindData2Repeater(rptModuleList, pager, "Sys_Menu")
        /// Call two, query a table according to the conditions, the need for additional table name is specified, the conditions and parameters: ControlHelper.BindData2Repeater(rptModuleList, pager, "Sys_Menu", where, ps)
        /// Call three, query a table according to the conditions, the need for additional table name is specified, and parameters, the sort field, ID field: ControlHelper.BindData2Repeater(rptModuleList, pager, "Sys_Menu", where, ps, "OrderNo Desc", "BizID")
        /// </summary>
        /// <param name="rpt"></param>
        /// <param name="pager"></param>
        /// <param name="tableName"></param>
        /// <param name="where"></param>
        /// <param name="ps"></param>
        /// <param name="sortField"></param>
        /// <param name="idField"></param>
        public static void BindData3Repeater(Repeater rpt, Wuqi.Webdiyer.AspNetPager pager, string tableName, string where, IList <System.Data.SqlClient.SqlParameter> ps, string sortField, string queryFld)
        {
            string  sqlCount    = string.Format("select count(1) from {0} where {1}", tableName, where);
            int     recordCount = int.Parse(SqlHelper.ExecuteScalar(WebConfigHelper.DefaultConnectionString, CommandType.Text, sqlCount, ps.ToArray()).ToString());
            string  sql         = SqlSplit.GetPageSql(tableName, sortField, queryFld, pager.PageSize, pager.CurrentPageIndex, recordCount, true, where);
            DataSet ds          = SqlHelper.ExecuteDataset(WebConfigHelper.DefaultConnectionString, CommandType.Text, sql, ps.ToArray());

            pager.RecordCount = recordCount;
            rpt.DataSource    = ds.Tables[0];
            rpt.DataBind();

            if (pager.RecordCount == 0)
            {
                pager.CustomInfoHTML = "<font color='red'><b>%CurrentPageIndex%</b></font>/%PageCount%&nbsp;&nbsp;Total:%RecordCount%";
            }
            else
            {
                pager.CustomInfoHTML = "<font color='red'><b>%CurrentPageIndex%</b></font>/%PageCount%&nbsp;&nbsp;Total:%RecordCount%(%StartRecordIndex%~%EndRecordIndex%)";
            }
        }
Example #16
0
        /// <summary>
        /// 使用分页技术绑定DataGrid
        /// </summary>
        /// <param name="CommandText">待执行的SQL语句</param>
        /// <param name="Pager">分页控件</param>
        /// <param name="dg_ToPager">待分页的DataGrid</param>
        public void Get_RecordSet_Pager(string CommandText, Wuqi.Webdiyer.AspNetPager Pager, DataGrid dg_ToPager, string strCon_Name)
        {
            DataSet ds = new DataSet();

            Database  db  = DatabaseFactory.CreateDatabase(strCon_Name);
            DbCommand cmd = db.GetStoredProcCommand("sp_PageView");

            db.AddInParameter(cmd, "@sql", DbType.String, CommandText);
            db.AddInParameter(cmd, "@PageCurrent", DbType.Int32, Pager.CurrentPageIndex);
            db.AddInParameter(cmd, "@PageSize", DbType.Int32, Pager.PageSize);
            ds = db.ExecuteDataSet(cmd);

            dg_ToPager.DataSource = ds.Tables[2].DefaultView;
            dg_ToPager.DataBind();

            Pager.RecordCount     = Convert.ToInt32(ds.Tables[1].Rows[0]["RecordCount"]);
            Pager.CustomInfoText  = "记录总数:<font color=\"blue\"><b>" + Pager.RecordCount.ToString() + "</b></font>";
            Pager.CustomInfoText += "总页数:<font color=\"blue\"><b>" + Pager.PageCount.ToString() + "</b></font>";
            Pager.CustomInfoText += "当前页:<font color=\"red\"><b>" + Pager.CurrentPageIndex.ToString() + "</b></font>";
        }
Example #17
0
        public AdminPager(Wuqi.Webdiyer.AspNetPager Pager)
        {
            string img1 = File.Function.GetRelativePath("Admin/Images/first.gif");
            string img2 = File.Function.GetRelativePath("Admin/Images/last.gif");
            string img3 = File.Function.GetRelativePath("Admin/Images/next.gif");
            string img4 = File.Function.GetRelativePath("Admin/Images/prev.gif");

            _Pager = Pager;
            _Pager.FirstPageText = "<span class=btnLink title='首页'><img src='" + img1 + "' /></span>";
            _Pager.LastPageText  = "<span class=btnLink title='尾页'><img src='" + img2 + "' /></span>";
            _Pager.NextPageText  = "<span class=btnLink title='下一页'><img src='" + img3 + "' /></span>";
            _Pager.NumericButtonTextFormatString = "<span class=Pager>{0}</span>";
            _Pager.PrevPageText      = "<span class=btnLink title='上一页'><img src='" + img4 + "' /></span>";
            _Pager.SubmitButtonText  = "GO";
            _Pager.CustomInfoClass   = "CustomInfo";
            _Pager.CssClass          = "Pager";
            _Pager.SubmitButtonClass = "PagerBtn";
            //_Pager.InputBoxClass = "PagerInput";
            _Pager.CurrentPageButtonClass = "CurrentPage";
            _Pager.ShowCustomInfoSection  = Wuqi.Webdiyer.ShowCustomInfoSection.Left;
            //_Pager.ShowInputBox = Wuqi.Webdiyer.ShowInputBox.Always;
            _Pager.AlwaysShow = true;
            _Pager.UrlPaging  = false;

            string mypage = Text.RegexClass.ChkInt(HttpContext.Current.Request.QueryString["page"]);

            if (mypage != "0")
            {
                _CurrentPageIndex = Convert.ToInt32(mypage);
            }
            else
            {
                _CurrentPageIndex = _Pager.CurrentPageIndex;
            }

            if (_where == null)
            {
                _where = "";
            }
        }
Example #18
0
        //#region Repeater控件分页帮定
        ///// <summary #region GridView控件分页帮定
        /// <summary>
        /// GridView控件分页帮定
        /// </summary>
        /// <param name="anpager">AspNetPager分页控件</param>
        /// <param name="strTableName">表名</param>
        /// <param name="strPrimaryKey">表的唯一主建名</param>
        /// <param name="strQuaryCondition">查询Where条件,不含Where</param>
        /// <param name="strOrderCondition">需要排序的字段名</param>
        /// <param name="rptControl">GridView控件</param>
        public void GridViewPagerBindbyRowNumber(Wuqi.Webdiyer.AspNetPager anpager, string strTableName, string strPrimaryKey, string strQuaryCondition, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl)
        {
            string strsel = "";

            if (strQuaryCondition == "")
            {
                strsel = "select * from (select row_number() over (order by " + strOrderCondition + ") as rowno,SYS_Operator.* from " + strTableName + ") as result Where (rowno Between " + ((anpager.CurrentPageIndex - 1) * anpager.PageSize + 1) + " and " + anpager.CurrentPageIndex * anpager.PageSize + ")";

                anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle("Select Count(*) From " + strTableName));
            }
            else
            {
                strsel = "select * from (select row_number() over (order by " + strOrderCondition + ") as rowno,SYS_Operator.* from " + strTableName + " where " + strQuaryCondition + ") as result Where (rowno Between " + ((anpager.CurrentPageIndex - 1) * anpager.PageSize + 1) + " and " + anpager.CurrentPageIndex * anpager.PageSize + ")";
                anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle("Select Count(*) From " + strTableName + " Where " + strQuaryCondition));
            }
            DataSet dstTemp = DbHelperSQL.Query(strsel);

            if (dstTemp.Tables[0].Rows.Count == 0)
            {
                //DataRow dr = dstTemp.Tables[0].NewRow();
                //dstTemp.Tables[0].Rows.Add(dr);
                grvControl.DataSource = null;
                grvControl.DataBind();
            }
            else
            {
                grvControl.DataSource = dstTemp.Tables[0];
                grvControl.DataBind();
            }


            //动态设置用户自定义文本内容
            anpager.CustomInfoHTML  = "共有<font color=\"blue\"><b>" + anpager.RecordCount.ToString() + "</b></font>条记录";
            anpager.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + anpager.PageCount.ToString() + "</b></font>页";
            anpager.CustomInfoHTML += " 当前页:第<font color=\"red\"><b>" + anpager.CurrentPageIndex.ToString() + "</b></font>页";
        }
        public static void InitPager(Wuqi.Webdiyer.AspNetPager pager)
        {
            if (pager == null)
            {
                return;
            }
            pager.AlwaysShow = true;

            //Gets or sets the page index invalid user input (negative or non digital) in the client to display error information.
            pager.InvalidPageIndexErrorMessage = "Input error! It's a number!";
            //Gets or sets the page index is out of range (user input is larger than the maximum page index or less than the minimum page index) in the client to display the error message.
            pager.PageIndexOutOfRangeErrorMessage = string.Format("Input error! It's between 1 and {0}", pager.PageCount);

            pager.FirstPageText = "首页";
            pager.PrevPageText  = "上一页";
            pager.NextPageText  = "下一页";
            pager.LastPageText  = "末页";
            pager.PageSize      = 10;
            //pager.CssClass = "pages";

            pager.CurrentPageButtonClass = "cpb";
            pager.ShowCustomInfoSection  = Wuqi.Webdiyer.ShowCustomInfoSection.Left;
            pager.LayoutType             = Wuqi.Webdiyer.LayoutType.Table;
        }
 public void GridViewPagerBindbyRowNumber(Wuqi.Webdiyer.AspNetPager anpager, string strTableName, string strPrimaryKey, string OrgCode, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl)
 {
     dal.GridViewPagerBindbyRowNumber(anpager, strTableName, strPrimaryKey, OrgCode, strOrderCondition, grvControl);
 }
Example #21
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="pager">当前分页控件</param>
 public AspNetPagerClass(Wuqi.Webdiyer.AspNetPager pager)
 {
     this.Pager = pager;
 }
Example #22
0
        //#region Repeater控件分页帮定
        ///// <summary #region GridView控件分页帮定
        /// <summary>
        /// GridView控件分页帮定
        /// </summary>
        /// <param name="anpager">AspNetPager分页控件</param>
        /// <param name="strQuaryCondition">查询Where条件,不含Where</param>
        /// <param name="strOrderCondition">需要排序的字段名</param>
        /// <param name="rptControl">GridView控件</param>
        public void GridViewPagerBindbyRowNumber(Wuqi.Webdiyer.AspNetPager anpager, string strWhere, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl, int startyear, int endyear)
        {
            StringBuilder sbReceiveTable = new StringBuilder();

            DataSet dstTemp = new DataSet();

            #region 根据时间获取要查询的短信表
            for (int i = startyear; i <= endyear; i++)
            {
                sbReceiveTable.Append("'Sys_ReceiveMessage" + i + "',");
            }
            sbReceiveTable.Remove(sbReceiveTable.Length - 1, 1);
            string strselectTable = "select name from sysobjects where type='u' and name in(" + sbReceiveTable + ")";

            DataSet dsReceiveTable = DbHelperSQL.DQuery(strselectTable);

            StringBuilder sbsql = new StringBuilder();

            sbsql.Append("select RMID,PhoneNumber,MContent,ReceiveDate from (");

            for (int i = 0; i < dsReceiveTable.Tables[0].Rows.Count; i++)
            {
                sbsql.Append("select * from " + dsReceiveTable.Tables[0].Rows[i][0].ToString() + " union");
            }

            sbsql.Remove(sbsql.Length - 6, 6);
            sbsql.Append(") as RM");
            #endregion

            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from (select row_number() over (order by " + strOrderCondition + ") as rowno,*  from (" + sbsql.ToString() + ") as VT_ReceiveMessage");
            strSql.Append(strWhere);
            strSql.Append(" ) as result Where (rowno Between " + ((anpager.CurrentPageIndex - 1) * anpager.PageSize + 1) + " and " + anpager.CurrentPageIndex * anpager.PageSize + ")");

            StringBuilder strb = new StringBuilder();

            strb.Append("Select Count(*) From (" + sbsql.ToString() + ") as VT_ReceiveMessage");
            strb.Append(strWhere);

            anpager.RecordCount = Convert.ToInt32(DbHelperSQL.GetSingle(strb.ToString()));
            dstTemp             = DbHelperSQL.Query(strSql.ToString());



            if (dstTemp.Tables[0].Rows.Count == 0)
            {
                grvControl.DataSource = null;
                grvControl.DataBind();
            }
            else
            {
                grvControl.DataSource = dstTemp.Tables[0];
                grvControl.DataBind();
            }


            //动态设置用户自定义文本内容
            anpager.CustomInfoHTML  = "共有<font color=\"blue\"><b>" + anpager.RecordCount.ToString() + "</b></font>条记录";
            anpager.CustomInfoHTML += " 总页数:<font color=\"blue\"><b>" + anpager.PageCount.ToString() + "</b></font>页";
            anpager.CustomInfoHTML += " 当前页:第<font color=\"red\"><b>" + anpager.CurrentPageIndex.ToString() + "</b></font>页";
        }
 public void GridViewPagerBindbyRowNumber(Wuqi.Webdiyer.AspNetPager anpager, string strWhere, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl, int startyear, int endyear)
 {
     dal.GridViewPagerBindbyRowNumber(anpager, strWhere, strOrderCondition, grvControl, startyear, endyear);
 }
Example #24
0
 public void GridViewPagerBindbyRowNumber(Wuqi.Webdiyer.AspNetPager anpager, string strCollCode, string strCollName, string strWhere, string strOrderCondition, System.Web.UI.WebControls.GridView grvControl)
 {
     dal.GridViewPagerBindbyRowNumber(anpager, strCollCode, strCollName, strWhere, strOrderCondition, grvControl);
 }