コード例 #1
0
 void ShowInit(string sql)
 {
     try
     {
         DataSet ds = new DataSet();
         string where = "b_sort=" + int.Parse(Request.Params["Flow"]);
         Tunnel.BLL.Tunnel_menber bm = new Tunnel.BLL.Tunnel_menber();
         ul.UsbnLogin = bm.GetModel(ul.LoginID);
         if ("search".Equals(sql))
         {
             if (DropDownList2.SelectedValue != "")
             {
                 where += " and b_state=" + DropDownList2.SelectedValue;
             }
             if (TextBox1.Text.Trim() != "")
             {
                 where += " and b_time>='" + TextBox1.Text + "'";
             }
             if (TextBox2.Text.Trim() != "")
             {
                 where += " and b_time<='" + TextBox2.Text + "'";
             }
             if (TextBox4.Text.Trim() != "")
             {
                 where += " and b_title like '%" + TextBox4.Text + "%'";
             }
             if (ul.JiaoSe(ul.LoginID) != "系统管理员")
             {
                 where += " and b_user="******" order by b_state asc,b_time desc";
             ds     = tb.GetList(where);
             //对用于分页的类的引用
         }
         else
         {
             if (ul.JiaoSe(ul.LoginID) != "系统管理员")
             {
                 where = "b_user="******" order by b_state asc,b_time desc";
             ds     = tb.GetList(where);
         }
         PagedDataSource pds = new PagedDataSource();
         pds.DataSource  = ds.Tables[0].DefaultView;//设置数据源(DataTable类型)
         pds.AllowPaging = true;
         //每页显示的行数
         //pds.PageSize = 12;
         AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
         pds.CurrentPageIndex     = AspNetPager1.CurrentPageIndex - 1;
         pds.PageSize             = AspNetPager1.PageSize;
         Repeater1.DataSource     = pds;
         Repeater1.DataBind();
     }
     catch
     {
         Tunnel.Common.Message.back("不正确的ID"); return;
     }
 }
コード例 #2
0
ファイル: Document_In.aspx.cs プロジェクト: 262734254/OA
    public void PageBind(string where)
    {
        PageBase pb = new PageBase();

        pb.TblName       = "Tunnel_bumf";
        pb.FldName       = "b_id";
        pb.ProcedureName = "pagination";
        pb.PageSize      = pageSize;
        if (cuttentPage == 0)
        {
            cuttentPage = pb.PageIndex;
        }
        pb.PageIndex = cuttentPage;
        pb.StrWhere  = where;
        if (!string.IsNullOrEmpty(where))
        {
            pb.StrWhere += " and b_state=3 and b_sort in(select f_id from tunnel_flow where f_sort=18)";
        }
        else
        {
            pb.StrWhere += " b_state=3 and b_sort in(select f_id from tunnel_flow where f_sort=18)";
        }
        int count = 0;

        pb.DoCount = 1;
        rbll.GetList(pb, ref count); //获取总条数

        pb.DoCount = 0;
        if (delState == true && pageSize == count)
        {
            cuttentPage  = cuttentPage - 1;
            pb.PageIndex = cuttentPage;
        }
        List <Tunnel.Model.Tunnel_bumf> modelList = new List <Tunnel.Model.Tunnel_bumf>();

        modelList = rbll.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;
        }
    }
コード例 #3
0
    void ShowInit(string sql)
    {
        DataSet ds = new DataSet();

        string where = "";
        string userlist = "0";

        Tunnel.BLL.Tunnel_menber bm = new Tunnel.BLL.Tunnel_menber();
        ul.UsbnLogin = bm.GetModel(ul.LoginID);
        if (Tunnel.BLL.Permission.IfHasPrimision(ul.LoginID.ToString(), "流程审核", "我的工作", false))
        {
            DataSet dss = new DataSet();
            if (ul.JiaoSe(ul.LoginID) != "系统管理员")
            {
                dss = bm.GetList("m_bum=" + ul.UsbnLogin.m_bum);

                foreach (DataRow dr in dss.Tables[0].Rows)
                {
                    userlist += dr["m_id"].ToString() + ",";
                }
                if (userlist.Length > 0)
                {
                    userlist = userlist.Substring(0, userlist.Length - 1);
                }
            }
            else
            {
                userlist = "0";
            }
        }
        else
        {
            userlist = "0";
        }
        if ("search".Equals(sql))
        {
            if (TextBox1.Text.Trim() != "")
            {
                where += " and b_time>='" + TextBox1.Text + "'";
            }
            if (TextBox2.Text.Trim() != "")
            {
                where += " and b_time<='" + TextBox2.Text + "'";
            }
            if (TextBox3.Text.Trim() != "")
            {
                try
                {
                    where += " and b_id=" + int.Parse(TextBox3.Text.Trim());
                }
                catch
                {
                    Tunnel.Common.Message.back("请输入正确的文号");
                }
            }
            if (TextBox4.Text.Trim() != "")
            {
                where += " and b_title like '%" + TextBox4.Text + "%'";
            }
        }
        else
        {
            where = "";
        }
        string sWhere = "";

        if (ul.JiaoSe(ul.LoginID) != "系统管理员")
        {
            sWhere = "select DISTINCT bf.b_id,bf.b_title,bf.b_sort,bf.b_time,bf.b_file,bf.b_state,bf.b_user,bf.b_suser,bf.b_stype from tunnel_bumf bf left join tunnel_exam em on bf.b_id=em.e_gid left join tunnel_step ep on em.e_nextbid=ep.s_id where (((CHARINDEX('" + ul.LoginID + ",', ep.s_zid)>=1 or ep.s_zid ='" + ul.LoginID + "') or (CHARINDEX('" + ul.LoginID + ",', em.e_nextbuser) >= 1 or em.e_nextbuser ='******')) " + where + " and bf.b_state>0) or (b_user in(" + userlist + ") or b_suser="******") order by bf.b_state asc,bf.b_time desc";
            ds     = Tunnel.Data.DbHelperSQL.Query(sWhere);
        }
        else
        {
            ds = tb.GetList("b_state>0 " + where + " order by b_state asc,b_time desc");
        }
        PagedDataSource pds = new PagedDataSource();

        pds.DataSource  = ds.Tables[0].DefaultView;//设置数据源(DataTable类型)
        pds.AllowPaging = true;
        //每页显示的行数
        //pds.PageSize = 12;
        AspNetPager1.RecordCount = ds.Tables[0].Rows.Count;
        pds.CurrentPageIndex     = AspNetPager1.CurrentPageIndex - 1;
        pds.PageSize             = AspNetPager1.PageSize;
        Repeater1.DataSource     = pds;
        Repeater1.DataBind();
    }