Пример #1
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_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_flowinfor Hyoa_flowinfor = new HyoaClass.Hyoa_flowinfor();
            if (this.Request.QueryString["op"] == "modify")
            {
                if (this.Request.QueryString["id"] != null)
                {
                    //根据id得到信息
                    this.txtid.Text = this.Request.QueryString["id"].ToString();
                    DataTable dt = Hyoa_flowinfor.Getflowinfor(this.txtid.Text);
                    if (dt.Rows.Count > 0)
                    {
                        this.txtname.Value = dt.Rows[0]["hy_flowname"].ToString();
                        this.txtsort.Value = dt.Rows[0]["hy_sort"].ToString();
                        this.ddlmudelid.SelectedValue = dt.Rows[0]["hy_mudelid"].ToString();
                    }
                    dt.Clear();
                    this.txtid.Enabled = false;
                }
            }
            else
            {
                //自动获取最大排序号,然后+2
                DataTable dt_maxsort = Hyoa_flowinfor.GetMaxflowinforsort();
                if (dt_maxsort.Rows.Count > 0)
                    txtsort.Value = (int.Parse(dt_maxsort.Rows[0]["hy_sort"].ToString()) + 2).ToString();
                else
                    txtsort.Value = "1";
            }
        }
    }