コード例 #1
0
    private void DataPlay()
    {
        this.btn_submit.Visible = false; //保存
        HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global();
        if (Hyoa_global.isHaveRole("Role9999", (this.Session["hyuid"].ToString())))
        {
            this.btn_submit.Visible = true; //保存
        }

        //加载模块信息
        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 dt = Hyoa_role.GetMaxrolesort();
        if (dt.Rows.Count > 0)
            this.txtno.Value = (System.Int32.Parse(dt.Rows[0]["hy_sort"].ToString()) + 2).ToString();
        else
            this.txtno.Value = "1";
    }
コード例 #2
0
    private void DataPlay()
    {
        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_role Hyoa_role = new HyoaClass.Hyoa_role();
            if (this.Request.QueryString["op"] == "modify")
            {
                txtroleid.Enabled = false;
                if (this.Request.QueryString["roleid"] != null)
                {
                    //根据roleid得到信息
                    this.txtroleid.Text = this.Request.QueryString["roleid"].ToString();
                    DataTable dt = Hyoa_role.Getrole(this.txtroleid.Text);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtrolename.Value = dt.Rows[0]["hy_rolename"].ToString();
                        this.txtroleno.Value = dt.Rows[0]["hy_sort"].ToString();
                    }
                    dt.Clear();
                }
            }
            else
            {
                this.txtroleid.Text = "Role";
                ////得到最大的ROLEID值
                //this.txtroleid.Text = Hyoa_role.GetNextroleid();
                //this.txtroleno.Value = this.txtroleid.Text.Substring(4);

                //自动获取最大排序号,然后+2
                DataTable dt_maxsort = Hyoa_role.GetMaxrolesort();
                if (dt_maxsort.Rows.Count > 0)
                    txtroleno.Value = (int.Parse(dt_maxsort.Rows[0]["hy_sort"].ToString()) + 2).ToString();
                else
                    txtroleno.Value = "1";
            }
        }
    }