Пример #1
0
        /// <summary>
        ///显示待审核的项目列表信息
        /// </summary>
        /// <param name="pageindex"></param>
        protected void ShowListInfo(int pageindex, string status)
        {
            try
            {
                DataTable DT        = new DataTable();
                string    date      = TB_ordertime.Value.ToString();
                string    sqlWhere1 = " DELFLAG = 0  and PDEL=0";

                if (null != status && status.Equals("0"))
                {
                    sqlWhere1 = sqlWhere1 + " AND Status=" + status;
                }
                else
                {
                    sqlWhere1 = sqlWhere1 + " AND (Status=1 or Status=2 or Status=3)";
                }
                if (!date.Equals(""))
                {
                    sqlWhere1 = sqlWhere1 + " AND datas='" + Convert.ToDateTime(date).ToString("yyyyMMdd") + "'";
                }
                if (!TB_CarName.Text.ToString().Equals(""))
                {
                    sqlWhere1 = sqlWhere1 + " AND CarName like '%" + TB_CarName.Text.ToString() + "%'";
                }
                string allTiaoshu    = dtrowsHidden.Value.ToString();//获取到所有的条数
                int    alltiaoshuInt = int.Parse(allTiaoshu);
                DT        = pageControl.GetList_FenYe_NewID(sqlWhere1, pageindex, GridView1.PageSize, alltiaoshuInt, "vProject_Apply_OrderCar", " datas " + DropDownList1.SelectedValue + ",CarName asc,hours asc").Tables[0];
                pageindex = pageControl.pageindex(pageindex, GridView1.PageSize, alltiaoshuInt);//获取当前要显示的页码数【如果最后一页的最后一条记录被删除后,还能正常显示】
                if (DT.Rows.Count > 0)
                {
                    //当获取到的数据集不为空的时候,显示在GridView1中

                    GridView1.Visible     = true;
                    GridView1.DataSource  = DT;                   //指定GridView1的数据是DT
                    pageindexHidden.Value = pageindex.ToString(); //给隐藏的页码变量赋值,给下面的分页控件提供数据
                    GridView1.DataBind();                         //将上面指定的信息绑定到GridView1上
                    Button_check.Enabled = true;
                    tag.Text             = "";

                    pageControl.SetSelectPage(pageindex, int.Parse(dtrowsHidden.Value.ToString()), DropDownList2, GridView1.PageSize, FirstPage, NextPage, PreviousPage, LastPage, Label_showInfo); //加载通用组件里面的分页函数
                    notice.Text             = "";
                    pageControlShow.Visible = true;                                                                                                                                                 //如果记录集不为空,则显示分页控件
                }
                else
                {
                    GridView1.Visible       = false;
                    notice.Text             = "*没有符合条件的结果!";
                    pageControlShow.Visible = false;//如果记录集为空,则不显示分页控件
                    Button_check.Enabled    = false;
                    if (alltiaoshuInt > 0)
                    {
                        ShowListInfo(pageindex - 1, status);
                    }
                }
            }
            catch
            {
            }
        }