//模块权限列表
    protected string fRoleNames()
    {
        string ls_return = "";
        string ls_userid = "";
        string ls_roleids = "";

            //加载
            HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role();
            DataTable dt = Hyoa_role.Getroles();
            //fdselectroleid
            if (this.Request.QueryString["selectroleid"] != null)
            {
                this.fdselectroleid.Value = ","+ this.Request.QueryString["selectroleid"].ToString()+",";
            }

            if(dt.Rows.Count>0)
            {
                for(var i=0;i<dt.Rows.Count;i++)
                {
                    //if (ls_roleids == "")
                    //{
                    ls_return += "<td width=\"25%\">";

                    if (this.fdselectroleid.Value.IndexOf(","+dt.Rows[i]["hy_roleid"].ToString()+",") >= 0)
                    {
                        //判断是否已经选中,如果选中了,则前面打勾
                        ls_return += "<input type=\"checkbox\" checked=true name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\" text=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\" id=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString();
                    }
                    else
                    {
                        ls_return += "<input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\" text=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\" id=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString();
                    }
                    ls_return += "</td>";
                    //}
                    //else
                    //{
                    //    if (ls_roleids.Contains(dt.Rows[i]["hy_roleid"].ToString()))
                    //    {
                    //        ls_return += "<td width=\"25%\"><input type=\"checkbox\" checked=\"checked\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\" text=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>";
                    //    }
                    //    else
                    //    {
                    //        ls_return += "<td width=\"25%\"><input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\" text=\"" + dt.Rows[i]["hy_rolename"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>";
                    //    }
                    //}

                    if (((i+1) % 4)==0 && i<dt.Rows.Count)
                        ls_return += "</tr><tr>";

                }
            }

            dt.Clear();

        return ls_return;
    }
示例#2
0
    private void DataPlay()
    {
        //加载一级目录ID、一级目录名称、每个一级目录最大的二级目录
        HyoaClass.Hyoa_ml Hyoa_firstml = new HyoaClass.Hyoa_ml();
        DataTable dtfirstml = Hyoa_firstml.GetFirstmls();
        if (dtfirstml.Rows.Count > 0)
        {
            this.ddlfirstmlid.DataSource = dtfirstml;
            this.ddlfirstmlid.DataTextField = "MLID";
            this.ddlfirstmlid.DataValueField = "MLID";
            this.ddlfirstmlid.DataBind();
            this.ddlfirstmlid.Items.Insert(0, "--请选择--");
            this.ddlfirstmlid.SelectedIndex = 0;
            this.ddlfirstmlname.DataSource = dtfirstml;
            this.ddlfirstmlname.DataTextField = "MLName";
            this.ddlfirstmlname.DataValueField = "MLName";
            this.ddlfirstmlname.DataBind();
            this.ddlfirstmlname.Items.Insert(0, "--请选择--");
            this.ddlfirstmlname.SelectedIndex = 0;
            //加载每个一级目录最大的二级目录
            string ls_id;
            for (var i = 0; i < dtfirstml.Rows.Count; i++)
            {
                ls_id = Hyoa_firstml.GetMaxMLID(dtfirstml.Rows[i]["MLID"].ToString());
                this.ddlsecondmlid.Items.Insert(i, ls_id);
            }
            this.ddlsecondmlid.Items.Insert(0, "--请选择--");
            this.ddlsecondmlid.SelectedIndex = 0;
        }

        //加载模块信息
        HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
        DataTable dtmudel = Hyoa_mudel.Getmudels();
        if (dtmudel.Rows.Count > 0)
        {
            this.ddlmudelid.DataSource = dtmudel;
            this.ddlmudelid.DataTextField = "hy_mudelname";
            this.ddlmudelid.DataValueField = "hy_mudelid";
            this.ddlmudelid.DataBind();
            this.ddlmudelid.Items.Insert(0, "--请选择--");
            this.ddlmudelid.SelectedIndex = 0;
        }

        //加载权限
        HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role();
        DataTable dtrole = Hyoa_role.Getroles();
        if (dtrole.Rows.Count > 0)
        {
            this.ddlrole.DataSource = dtrole;
            this.ddlrole.DataTextField = "hy_rolename";
            this.ddlrole.DataValueField = "hy_roleid";
            this.ddlrole.DataBind();
            this.ddlrole.Items.Insert(0, "--请选择--");
            this.ddlrole.SelectedIndex = 0;
        }

        this.ddlisenabled.Items.Insert(0, "是");
        this.ddlisenabled.Items.Insert(1, "否");

        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //判断当前用户是否有保存的权限
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
            {
                this.btn_submit.Visible = true; //保存
            }
            else
            {
                this.btn_submit.Visible = false; //保存
            }

            HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml();

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                if (this.Request.QueryString["id"] != null)
                {
                    //根据id得到信息
                    this.lblid.Value = this.Request.QueryString["id"].ToString();
                    this.txtMLID.Value = this.Request.QueryString["id"].ToString();
                    DataTable dt = Hyoa_ml.Getml(this.lblid.Value);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtname.Value = dt.Rows[0]["MLName"].ToString();
                        this.txtlink.Value = dt.Rows[0]["hy_link"].ToString();
                        this.ddltarget.SelectedValue = dt.Rows[0]["hy_target"].ToString();
                        this.ddlrole.SelectedValue = dt.Rows[0]["hy_role"].ToString();
                        this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString();
                        //模块信息定位
                        for (var i = 0; i < this.ddlmudelid.Items.Count; i++)
                        {
                            if (this.ddlmudelid.Items[i].Value == dt.Rows[0]["hy_mudelid"].ToString())
                            {
                                this.ddlmudelid.SelectedIndex = i;
                            }
                        }
                        //一级目录定位
                        for (var i = 0; i < this.ddlfirstmlid.Items.Count; i++)
                        {
                            if (this.ddlfirstmlid.Items[i].Value == dt.Rows[0]["MLID"].ToString().Substring(0,3))
                            {
                                this.ddlfirstmlid.SelectedIndex = i;
                                this.ddlfirstmlname.SelectedIndex = i;
                            }
                        }

                        if (dt.Rows[0]["hy_ifqy"].ToString() == "是")
                            this.ddlisenabled.SelectedIndex = 0;
                        else
                            this.ddlisenabled.SelectedIndex = 1;

                        //根据模块信息得到对应的选择表单值
                        if (dt.Rows[0]["hy_tableid"] != "" && dt.Rows[0]["hy_tableid"] != null)
                        {
                            this.ddltableid.Items.Clear();
                            //根据模块ID得到表单ID
                            HyoaClass.Hyoa_tableconfig Hyoa_tableconfig = new HyoaClass.Hyoa_tableconfig();
                            DataTable dtgettableid = Hyoa_tableconfig.GetTablesbymudelid(dt.Rows[0]["hy_mudelid"].ToString());
                            if (dtgettableid.Rows.Count > 0)
                            {
                                for (var i = 0; i < dtgettableid.Rows.Count; i++)
                                {
                                    this.ddltableid.Items.Insert(i, new ListItem(dtgettableid.Rows[i]["hy_name"].ToString(), dtgettableid.Rows[i]["ID"].ToString()));
                                }
                                this.ddltableid.Items.Insert(0, new ListItem("--请选择--", ""));
                                //定位
                                this.ddltableid.SelectedValue = dt.Rows[0]["hy_tableid"].ToString();
                            }
                        }
                    }
                    dt.Clear();
                }
            }
        }
    }
    //模块权限列表
    protected string fRoleNames()
    {
        string ls_return = "";
        string ls_userid = "";
        string ls_roleids = "";
        if(this.Request.QueryString["userid"]!=null)
        {
            ls_userid = this.Request.QueryString["userid"].ToString();
            //得到已有的模块权限
            HyoaClass.Hyoa_roleuser Hyoa_roleuser = new HyoaClass.Hyoa_roleuser();
            DataTable dtroleuser = Hyoa_roleuser.Getrolesbyuserid(ls_userid);
            if (dtroleuser.Rows.Count > 0)
            {
                for (var i = 0; i < dtroleuser.Rows.Count; i++)
                {
                    ls_roleids += "," + dtroleuser.Rows[i]["hy_roleid"].ToString();
                }
                this.fdHaveRoleid.Value = ls_roleids + ",";
            }
            //加载
            HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role();
            DataTable dt = Hyoa_role.Getroles();

            if (dt.Rows.Count > 0)
            {
                for (var i = 0; i < dt.Rows.Count; i++)
                {
                    if (ls_roleids == "")
                    {
                        ls_return += "<td style=\"border-bottom:1px solid #cccccc\" width=\"25%\"><input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>";
                    }
                    else
                    {
                        if (ls_roleids.Contains(dt.Rows[i]["hy_roleid"].ToString()))
                        {
                            ls_return += "<td style=\"border-bottom:1px solid #cccccc\" width=\"25%\"><input type=\"checkbox\" checked=\"checked\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>";
                        }
                        else
                        {
                            ls_return += "<td style=\"border-bottom:1px solid #cccccc\" width=\"25%\"><input type=\"checkbox\" name=\"fRoleName\" value=\"" + dt.Rows[i]["hy_roleid"].ToString() + "\">" + dt.Rows[i]["hy_rolename"].ToString() + "</td>";
                        }
                    }

                    if (((i + 1) % 4) == 0 && i < dt.Rows.Count)
                        ls_return += "</tr><tr style=\"border-bottom:1px\">";

                }
            }
            dtroleuser.Clear();
            dt.Clear();
        }
        return ls_return;
    }
示例#4
0
    private void DataPlay()
    {
        this.ddlisenabled.Items.Insert(0, "是");
        this.ddlisenabled.Items.Insert(1, "否");

        //加载权限和全权用户
        HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role();
        DataTable dtrole = Hyoa_role.Getroles();
        if (dtrole.Rows.Count > 0)
        {
            this.ddlrole.DataSource = dtrole;
            this.ddlrole.DataTextField = "hy_rolename";
            this.ddlrole.DataValueField = "hy_roleid";
            this.ddlrole.DataBind();
            this.ddlrole.Items.Insert(0, new ListItem("--请选择--", ""));
            this.ddlrole.SelectedIndex = 0;

            this.ddlqqrole.DataSource = dtrole;
            this.ddlqqrole.DataTextField = "hy_rolename";
            this.ddlqqrole.DataValueField = "hy_roleid";
            this.ddlqqrole.DataBind();
            this.ddlqqrole.Items.Insert(0, new ListItem("--请选择--", ""));
            this.ddlqqrole.SelectedIndex = 0;
        }

        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //判断当前用户是否有保存的权限
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
            {
                this.btn_submit.Visible = true; //保存
            }
            else
            {
                this.btn_submit.Visible = false; //保存
            }

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                if (this.Request.QueryString["id"] != null)
                {
                    //根据roleid得到信息
                    this.txtmudelid.Value = this.Request.QueryString["id"].ToString();
                    HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
                    DataTable dt = Hyoa_mudel.Getmudel(this.txtmudelid.Value);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtid.Text = this.Request.QueryString["id"].ToString();
                        this.txtname.Value = dt.Rows[0]["hy_mudelname"].ToString();
                        this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString();

                        if (dt.Rows[0]["hy_isenabled"].ToString() == "是")
                            this.ddlisenabled.SelectedIndex = 0;
                        else
                            this.ddlisenabled.SelectedIndex = 1;

                        this.ddlrole.SelectedValue = dt.Rows[0]["hy_roleid"].ToString();
                        this.ddlqqrole.SelectedValue = dt.Rows[0]["hy_qqroleid"].ToString();
                    }
                    dt.Clear();
                    this.txtid.Enabled = false;
                }
            }
            else
            {
                this.txtid.Text = "Mudel";
                //自动获取最大排序号,然后+2
                HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
                DataTable dt_maxsort = Hyoa_mudel.GetMaxmudelsort();
                if (dt_maxsort.Rows.Count > 0)
                    txtsort.Value = (int.Parse(dt_maxsort.Rows[0]["hy_sort"].ToString()) + 2).ToString();
                else
                    txtsort.Value = "1";
            }
        }
    }
示例#5
0
    private void DataPlay(int PageNo)
    {
        //判断当前用户是否有新建删除权限
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole("Role9999", 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; //删除
        }

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

        DataTable dt = new DataTable();
        if (this.hy_name.Value != "")
        {
            dt = Hyoa_role.Getrolesbyrolename(this.hy_name.Value);
        }
        else
        {
            dt = Hyoa_role.Getroles();
        }

        DataTable tempTable = dt.Clone();

        DataColumn col1 = new DataColumn("hy_roleuser", typeof(String)); //定义新的一列  add原因说明
        tempTable.Columns.Add(col1);  //追加一列  add

        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];
            }

            //得到该权限下边已经配置的人员
            string ls_roleuser = "";
            if (dt.Rows[i]["hy_roleid"].ToString() != "")
            {
                DataTable dtjudeg = Hyoa_roleuser.Getroleusersbyroleid(dt.Rows[i]["hy_roleid"].ToString());
                if (dtjudeg.Rows.Count > 0)
                {
                    for (var ii = 0; ii < dtjudeg.Rows.Count; ii++)
                    {
                        if (ls_roleuser == "")
                        {
                            ls_roleuser = getusernamebyuserid(dtjudeg.Rows[ii]["hy_userid"].ToString());
                        }
                        else
                        {
                            ls_roleuser = ls_roleuser + "," + getusernamebyuserid(dtjudeg.Rows[ii]["hy_userid"].ToString());
                        }
                    }
                }
            }
            if (ls_roleuser.Length > 50)
            {
                ls_roleuser = ls_roleuser.Substring(0, 50) + "...";
            }
            dr["hy_roleuser"] = ls_roleuser;

            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();
    }
示例#6
0
    private void DataPlay()
    {
        //加载权限
        HyoaClass.Hyoa_role Hyoa_role = new HyoaClass.Hyoa_role();
        DataTable dtrole = Hyoa_role.Getroles();
        if (dtrole.Rows.Count > 0)
        {
            this.ddlrole.DataSource = dtrole;
            this.ddlrole.DataTextField = "hy_rolename";
            this.ddlrole.DataValueField = "hy_roleid";
            this.ddlrole.DataBind();
            this.ddlrole.Items.Insert(0, "--请选择--");
            this.ddlrole.SelectedIndex = 0;
        }

        this.ddlisenabled.Items.Insert(0, "是");
        this.ddlisenabled.Items.Insert(1, "否");

        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //判断当前用户是否有保存的权限
            HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
            if (Hyoa_global.isHaveRole("Role9999", this.Session["hyuid"].ToString()))
            {
                this.btn_submit.Visible = true; //保存
            }
            else
            {
                this.btn_submit.Visible = false; //保存
            }

            HyoaClass.Hyoa_ml Hyoa_ml = new HyoaClass.Hyoa_ml();

            //新文档,自动得到最大目录号
            if (this.Request.QueryString["op"] == "add")
            {
                this.lblid.Text = Hyoa_ml.GetMaxFirstMLID();
            }

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                if (this.Request.QueryString["id"] != null)
                {
                    //根据id得到信息
                    this.lblid.Text = this.Request.QueryString["id"].ToString();
                    DataTable dt = Hyoa_ml.Getml(this.lblid.Text);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtname.Value = dt.Rows[0]["MLName"].ToString();

                        for (var i = 0; i < this.fdPic.Items.Count; i++)
                        {
                            if (this.fdPic.Items[i].Value == dt.Rows[0]["hy_pic"].ToString())
                            {
                                this.fdPic.SelectedIndex = i;
                            }
                        }
                        //图片
                        this.ml_pic.Src = dt.Rows[0]["hy_pic"].ToString();

                        this.txtlink.Value = dt.Rows[0]["hy_link"].ToString();
                        this.ddltarget.SelectedValue = dt.Rows[0]["hy_target"].ToString();
                        this.ddlrole.SelectedValue = dt.Rows[0]["hy_role"].ToString();
                        this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString();

                        if (dt.Rows[0]["hy_ifqy"].ToString() == "是")
                            this.ddlisenabled.SelectedIndex = 0;
                        else
                            this.ddlisenabled.SelectedIndex = 1;
                    }
                    dt.Clear();
                    this.lblid.Enabled = false;
                }
            }
        }
    }
示例#7
0
    private void DataPlay(int PageNo)
    {
        //判断当前用户是否有新建删除权限
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole("Role9999", 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; //删除
        }

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

        DataTable dt;
        if (this.hy_name.Value != "")
        {
            dt = Hyoa_role.Getrolesbyrolename(this.hy_name.Value);
        }
        else
        {
            dt = Hyoa_role.Getroles();
        }

        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();
    }