Example #1
0
    private void DataPlay(int PageNo)
    {
        //得到当前模块对应的role
        HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
        DataTable dt_mudel = Hyoa_mudel.Getmudel(this.txtmudelid.Value);
        string ls_role = "Rolegwk";
        if (dt_mudel.Rows.Count > 0)
            ls_role = dt_mudel.Rows[0]["hy_roleid"].ToString();

        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole(ls_role, this.Session["hyuid"].ToString()))
        {
            this.isrole.Value = "1";
            this.tdnewdoc.Visible = true;
            this.tddeldoc.Visible = true;
        }
        else
        {
            this.isrole.Value = "0";
            this.tdnewdoc.Visible = false;
            this.tddeldoc.Visible = false;
        }

        //如果id等于空,则返回按钮隐藏
        if (this.txtid.Value== "")
        {
            this.btnreturnback.Visible = false;
        }

        //得到当前页号
        this.curpage.Text = PageNo.ToString();
        HyoaClass.Hyoa_gwk_class Hyoa_gwk_class = new HyoaClass.Hyoa_gwk_class();

        DataTable dt;
        if (this.txtid.Value == "")
        {
            dt = Hyoa_gwk_class.GetFirstlevClasss_type(this.txttype.Value);
        }
        else
        {
            dt = Hyoa_gwk_class.GetSubClasss_type(this.txtid.Value,this.txttype.Value);
        }

        DataTable tempTable = dt.Clone();
        for (int i = (PageNo - 1) * System.Int32.Parse(PageSize.Text); i < PageNo * System.Int32.Parse(PageSize.Text); i++)
        {
            if (i > dt.Rows.Count - 1)
                break;

            DataRow dr = tempTable.NewRow();
            for (int j = 0; j < dt.Columns.Count; j++)
            {
                dr[dt.Columns[j].ColumnName] = dt.Rows[i][j];
            }
            tempTable.Rows.Add(dr);
        }

        int TotalRecord = dt.Rows.Count;
        this.sumts.Text = TotalRecord.ToString();
        this.sumts2.Text = TotalRecord.ToString();
        this.ShowTotalRecord.Text = TotalRecord.ToString();
        //计算及显示总页数
        int TotalPage;
        if (TotalRecord < System.Int32.Parse(PageSize.Text))
        {
            TotalPage = 1;
        }
        else
        {
            if (TotalRecord % System.Int32.Parse(PageSize.Text) != 0)
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text) + 1;

            }
            else
            {
                TotalPage = TotalRecord / System.Int32.Parse(PageSize.Text);

            }
        }
        this.ShowTotalPage.Text = TotalPage.ToString();
        this.rptlist.DataSource = tempTable;
        this.rptlist.DataBind();
        dt.Clear();
    }
    //得到下一级部门的信息
    private void GetNextDept(string pis_Id, string pis_name, string ls_string, string ls_type)
    {
        //循环二级部门
        HyoaClass.Hyoa_gwk_class Hyoa_gwk_class = new HyoaClass.Hyoa_gwk_class();
        DataTable dtclass = Hyoa_gwk_class.GetSubClasss_type(pis_Id, ls_type);
        if (dtclass.Rows.Count > 0)
        {
            for (var i = 0; i < dtclass.Rows.Count; i++)
            {
                //判断是否有三级部门
                if (Hyoa_gwk_class.isHaveSubClass_type(dtclass.Rows[i]["id"].ToString(), ls_type) == true)
                {
                    //存在三级部门
                    Response.Write("<dd class=\"folderClose\">");
                    //if (ls_string != "")
                    //{
                    //    if (ls_string == dtclass.Rows[i]["id"].ToString())
                    //    {
                    //        Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" checked=\"checked\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> ");
                    //        Response.Write(dtclass.Rows[i]["hy_name"].ToString());
                    //    }
                    //    else
                    //    {
                    //        Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\"> ");
                    //        Response.Write(dtclass.Rows[i]["hy_name"].ToString());
                    //    }
                    //}
                    //else
                    //{
                    Response.Write("<input type=\"checkbox\" name=\"" + pis_name + "_sub" + i.ToString()+"_" + dtclass.Rows[i]["id"].ToString() + "\" value=\"" + dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" onclick=\"SelDept(this.name)\" style=\"width:13;\">");
                        Response.Write(dtclass.Rows[i]["hy_name"].ToString());
                    //}
                    Response.Write("<dl>");

                    //显示子部门以及部门人员
                    GetNextDept(dtclass.Rows[i]["id"].ToString(), pis_name + "_sub" + i.ToString() + "_" + dtclass.Rows[i]["id"].ToString(), ls_string, ls_type);

                    Response.Write("</dl>");
                    Response.Write("</dd>");
                }
                else
                {
                    //不存在子部门
                    Response.Write("<dt>");
                    //if (ls_string != "")
                    //{
                    //    if (ls_string == dtclass.Rows[i]["id"].ToString())
                    //    {
                    //        Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\"");
                    //        Response.Write(dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" checked=\"checked\" align=\"left\" style=\"width:13;\"> ");
                    //    }
                    //    else
                    //    {
                    //        Response.Write("<input type=\"checkbox\" name=\"" + dtclass.Rows[i]["id"].ToString() + "\" value=\"");
                    //        Response.Write(dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" style=\"width:13;\"> ");
                    //    }
                    //}
                    //else
                    //{
                        Response.Write("<input type=\"checkbox\" name=\"" + pis_name + "_sub_" + dtclass.Rows[i]["id"].ToString() + "\" value=\"");
                        Response.Write(dtclass.Rows[i]["id"].ToString() + "\" text=\"" + dtclass.Rows[i]["hy_name"].ToString() + "\" align=\"left\" style=\"width:13;\"> ");
                    //}
                    Response.Write(dtclass.Rows[i]["hy_name"].ToString());
                    Response.Write("</dt>");
                }
            }
        }
    }