Ejemplo n.º 1
0
        /// <summary>
        /// 列表数据绑定
        /// </summary>
        /// <param name="pageIndex"></param>
        private void BindGridView(int pageIndex)
        {
            string sqlWhere = " b.CompanyType !=" + SystemSet._ARCHIVE;

            if (!String.IsNullOrWhiteSpace(txtLoginName.Text.Trim()))
            {
                sqlWhere += " And a.LoginName like '%" + txtLoginName.Text.Trim() + "%' ";
            }
            if (!String.IsNullOrWhiteSpace(txtUserName.Text.Trim()))
            {
                sqlWhere += " And a.UserName like '%" + txtUserName.Text.Trim() + "%' ";
            }
            if (!String.IsNullOrWhiteSpace(txtCompanyName.Text.Trim()))
            {
                sqlWhere += " And b.CompanyName like '%" + txtCompanyName.Text.Trim() + "%' ";
            }
            if (!String.IsNullOrWhiteSpace(txtGcmc.Text.Trim()))
            {
                sqlWhere += " And d.gcmc like '%" + txtGcmc.Text.Trim() + "%' ";
            }
            if (!String.IsNullOrWhiteSpace(txtGcdd.Text.Trim()))
            {
                sqlWhere += " And d.gcdd like '%" + txtGcdd.Text.Trim() + "%' ";
            }
            if (ddlUserType.SelectedValue != "0")
            {
                sqlWhere += " And lower(a.UserType)='" + ddlUserType.SelectedValue.Trim().ToLower() + "' ";
            }

            if (PublicModel.isSuperAdmin())  //超级管理员
            {
                sqlWhere += " And b.Area_Code like '" + Common.Session.GetSession("OLD_AREA_CODE") + "%' ";
            }
            else if (PublicModel.isArchiveUser())   //馆里用户
            {
                sqlWhere += " And b.Area_Code like '" + Common.Session.GetSession("AREA_CODE") + "%' ";
            }

            if (ViewState["CurrentPageIndex"] == null && Common.ConvertEx.ToInt(DNTRequest.GetQueryString("PageIndex")) > 0)
            {
                pageIndex = Common.ConvertEx.ToInt(DNTRequest.GetQueryString("PageIndex"));
                ViewState["CurrentPageIndex"] = pageIndex;
            }
            else
            {
                pageIndex = ConvertEx.ToInt(ViewState["CurrentPageIndex"]);
            }

            DataTable dt = userBLL.GetCompanyUserList(sqlWhere, pageSize, pageIndex, out itemCount);

            AspNetPager.AlwaysShow = true;
            AspNetPager.PageSize   = pageSize;

            AspNetPager.RecordCount      = itemCount;
            AspNetPager.CurrentPageIndex = pageIndex;

            rpData.DataSource = dt;
            rpData.DataBind();
        }