示例#1
0
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        STreeBB treeBB = new STreeBB();
        DataSet ds = new DataSet();

        try
        {
            ds = treeBB.GetList(this.StrWhere);
            DataTable dt = ds.Tables[0];

            // 组合列表属性
            StringBuilder sBuilder = new StringBuilder();
            sBuilder.Append("编号|@itemNo|@|@left");
            sBuilder.Append("|!名称|@nodeNm|@|@left");
            sBuilder.Append("|!链接|@url|@|@left");

            //关联属性
            this.dataGrid.TitleDescription = sBuilder.ToString();
            this.dataGrid.DataSource = dt;
        }
        finally
        {
            treeBB.Dispose();
        }
    }
示例#2
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        STreeData model = new STreeData();
        STreeBB treeBB = new STreeBB();
        try
        {
            //项目编号不允许重复
            if (treeBB.GetList("itemNo='" + this.itemNo.Text + "' and nodeId<>" + this.IdValue.ToString()).Tables[0].Rows.Count > 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"该项目编号已存在,请重新输入!\");", true);
                this.itemNo.Focus();
                return;
            }

            if (this.State == "1")
            {
                this.SetModel(ref model);
                model.isEffect = true;
                this.IdValue = treeBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = treeBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                treeBB.ModifyRecord(model);
            }

            this.RefreshApplicationPageUrlTable();
            this.RefreshApplicationTreeTable();
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            treeBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
    }
    /// <summary>
    /// 根据树列表绑定DataList
    /// </summary>
    private void BindDataList()
    {
        STreeBB treeBB = new STreeBB();
        SCommBB commBB = new SCommBB();
        DataSet ds = new DataSet();

        try
        {
            //除了超级管理员,其他用户只能在自己的权限列表范围之内进行分配
            if (this.IsHaveRole(1))
            {
                ds = treeBB.GetList("");
            }
            else
            {
                ds = commBB.Query("select distinct nodeId,itemNo,nodeNm,orderId,parentId from vSTree where empId="
                    + this.currentUser.empId.ToString() + " order by itemNo");
            }
            DataTable dt = treeBB.ConvertTreeList(ds.Tables[0]);
            this.DataList1.DataSource = dt;
            this.DataList1.DataKeyField = "nodeId";
            this.DataList1.DataBind();
        }
        finally
        {
            treeBB.Dispose();
            commBB.Dispose();
        }
    }
示例#4
0
    /// <summary>
    /// 绑定父级菜单
    /// </summary>
    private void BindParentTree()
    {
        STreeBB treeBB = new STreeBB();
        DataSet ds = new DataSet();

        try
        {
            ds = treeBB.GetList("");
            DataTable dt = ds.Tables[0];

            //加载树
            this.parentId.Items.Clear();
            this.parentId.Items.Add(new ListItem("根目录", "0"));
            DataRow[] drs = dt.Select("parentId=0", "orderId");
            foreach (DataRow row in drs)
            {
                string nodeId = row["nodeID"].ToString();
                string text = row["nodeNm"].ToString();
                text = "╋" + text;
                this.parentId.Items.Add(new ListItem(text, nodeId));
                int parentId = int.Parse(nodeId);
                string blank = "├";

                this.BindNode(parentId, dt, blank);
            }
            this.parentId.DataBind();
        }
        finally
        {
            treeBB.Dispose();
        }
    }