protected void btnAdd_Click(object sender, EventArgs e)
    {
        STreeFunctionData model = new STreeFunctionData();
        STreeFunctionBB treeFunctionBB = new STreeFunctionBB();
        try
        {
            //项目编号不允许重复
            string strWhere = "nodeId=" + this.NodeId.ToString() + " and functionNo='" + this.functionNo.Text + "'";
            if (treeFunctionBB.GetList(strWhere).Tables[0].Rows.Count > 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"该功能编号已存在,请重新输入!\");", true);
                this.functionNo.Focus();
                return;
            }

            model.nodeId= this.NodeId;
            model.functionNo= this.functionNo.Text;
            model.functionNm= this.functionNm.Text;
            treeFunctionBB.AddRecord(model);
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            treeFunctionBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "CloseSubmit", "CloseSubmit()", true);
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        STreeFunctionData treeFunctionData = new STreeFunctionData();
        STreeFunctionBB treeFunctionBB = new STreeFunctionBB();
        try
        {
            //ɾ����ǰ�˵����й���
            treeFunctionBB.DeleteRecordByNode(this.NodeId);

            //��������
            foreach (DataListItem item in this.DataList1.Items)
            {
                CheckBox checkBox = (CheckBox)item.FindControl("typeNm");
                if (checkBox.Checked)
                {
                    HtmlInputHidden hid = (HtmlInputHidden)item.FindControl("typeNo");
                    string typeNo = hid.Value;

                    treeFunctionData.nodeId = this.NodeId;
                    treeFunctionData.functionNo = typeNo;
                    treeFunctionData.functionNm = checkBox.Text;
                    treeFunctionBB.AddRecord(treeFunctionData);
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            treeFunctionBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "Close", "window.close();", true);
    }