コード例 #1
0
ファイル: VoteList.aspx.cs プロジェクト: 262734254/OA
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void PageBind()
    {
        PageBase pb = new PageBase();

        pb.TblName       = "Tunnel_Vote";
        pb.FldName       = "vote_Id";
        pb.ProcedureName = "pagination";
        pb.PageSize      = pageSize;
        if (cuttentPage == 0)
        {
            cuttentPage = pb.PageIndex;
        }
        pb.PageIndex = cuttentPage;
        Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin();
        if (ul.LoginID == 1)
        {
            pb.StrWhere = "";
        }
        else
        {
            Tunnel.BLL.Tunnel_menber   tm  = new Tunnel.BLL.Tunnel_menber();
            Tunnel.Model.Tunnel_menber tmm = new Tunnel_menber();
            tmm = tm.GetModel(Convert.ToInt64(ul.LoginID));
            if (!string.IsNullOrEmpty(Convert.ToString(tmm.m_bum)))
            {
                pb.StrWhere = "(vote_bumGroup like '%" + tmm.m_bum + "%' or vote_bumgroup = '|' or vote_bumgroup ='') and (getdate()>vote_startDate and getdate()<vote_endDate) and vote_state=0";
            }
            else
            {
                pb.StrWhere = "(vote_bumGroup like '%adfadfadfadfadfa%' or vote_bumgroup = '|' or vote_bumgroup ='') and (getdate()>vote_startDate and getdate()<vote_endDate) and vote_state=0";
            }
        }
        int count = 0;
        List <Tunnel.Model.Tunnel_Vote> modelList = new List <Tunnel.Model.Tunnel_Vote>();

        modelList  = tbll.GetList(pb, ref count); //获取分页结果
        pb.DoCount = 1;
        tbll.GetList(pb, ref count);              //获取总条数


        //数据绑定
        Repeater1.DataSource = modelList;
        Repeater1.DataBind();

        //数据分页
        MTCPager1.PageSize    = pageSize;
        MTCPager1.RecordCount = count;
        MTCPager1.PageIndex   = cuttentPage;
        if (count <= pb.PageSize)
        {
            MTCPager1.Visible = false;
        }
        else
        {
            MTCPager1.Visible = true;
        }
    }
コード例 #2
0
    /// <summary>
    /// 页面数据绑定
    /// </summary>
    public void PageBind()
    {
        PageBase pb = new PageBase();

        pb.TblName       = "Tunnel_Vote";
        pb.FldName       = "vote_Id";
        pb.ProcedureName = "pagination";
        pb.PageSize      = pageSize;
        if (cuttentPage == 0)
        {
            cuttentPage = pb.PageIndex;
        }
        pb.PageIndex = cuttentPage;
        Tunnel.BLL.UserLogin ul = new Tunnel.BLL.UserLogin();
        if (ul.LoginID == 1)
        {
            pb.StrWhere = "";
        }
        else
        {
            pb.StrWhere = "vote_userId = " + ul.LoginID + "";
        }
        int count = 0;
        List <Tunnel.Model.Tunnel_Vote> modelList = new List <Tunnel.Model.Tunnel_Vote>();

        modelList  = tbll.GetList(pb, ref count); //获取分页结果
        pb.DoCount = 1;
        tbll.GetList(pb, ref count);              //获取总条数


        //数据绑定
        Repeater1.DataSource = modelList;
        Repeater1.DataBind();

        //数据分页
        MTCPager1.PageSize    = pageSize;
        MTCPager1.RecordCount = count;
        MTCPager1.PageIndex   = cuttentPage;
        if (count <= pb.PageSize)
        {
            MTCPager1.Visible = false;
        }
        else
        {
            MTCPager1.Visible = true;
        }
    }