示例#1
0
    private void DataPlay()
    {
        if (this.Request.QueryString["op"] != null)
        {
            this.txtop.Value = this.Request.QueryString["op"].ToString();           //新增还是修改

            //得到当前模块对应的role
            HyoaClass.Hyoa_mudel Hyoa_mudel = new HyoaClass.Hyoa_mudel();
            DataTable dt_mudel = Hyoa_mudel.Getmudel(this.txtmudelid.Value);
            string ls_role = "Role9999";
            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.btn_submit.Visible = true;
            }
            else
            {
                this.btn_submit.Visible = false;
            }

            //新文档
            if (this.Request.QueryString["op"] == "add")
            {
                HyoaClass.Hyoa_gwk_class Hyoa_gwk_class = new HyoaClass.Hyoa_gwk_class();
                DataTable dt;
                string ls_id = "";
                if (this.Request.QueryString["id"] == "")
                {
                    //ID为空,说明是第一级
                    dt = Hyoa_gwk_class.GetFirstlevClasssSortByid_type(this.hy_type.Value);
                    if (dt.Rows.Count > 0)
                    {
                        //判断当前ID是不是有数据的
                        ls_id = (System.Int32.Parse(dt.Rows[0]["id"].ToString()) + 1).ToString();
                        if (ls_id.Length == 1)
                        {
                            this.hy_id.Text = "00" + ls_id;
                        }
                        else if (ls_id.Length == 2)
                        {
                            this.hy_id.Text = "0" + ls_id;
                        }
                        else
                        {
                            this.hy_id.Text = ls_id;
                        }
                    }
                    else
                    {
                        this.hy_id.Text = "001";
                    }

                }
                else
                {
                    //ID不为空,说明不是第一级
                    this.hy_id.Text = Hyoa_gwk_class.GetMaxid_type(this.txtid.Value, this.hy_type.Value);
                }
            }

            //旧文档
            if (this.Request.QueryString["op"] == "modify")
            {
                HyoaClass.Hyoa_gwk_class Hyoa_gwk_class = new HyoaClass.Hyoa_gwk_class();
                DataTable dt = Hyoa_gwk_class.GetClass_type(this.txtdocid.Value, this.hy_type.Value);
                if (dt.Rows.Count > 0)
                {
                    this.hy_id.Text = dt.Rows[0]["id"].ToString();
                    this.hy_sort.Text = dt.Rows[0]["hy_sort"].ToString();
                    this.hy_name.Text = dt.Rows[0]["hy_name"].ToString();
                }
                dt.Clear();
            }
        }
    }