protected void SelectButton_Click(object sender, EventArgs e)
    {
        if (this.ParentCode != "" && this.ParentCode != null)
        {
            DocumentDirectoryBFL   objBFL   = new DocumentDirectoryBFL();
            DocumentDirectoryModel ObjModel = new DocumentDirectoryModel();

            string DepartmentCode    = objBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).DepartmentCode;
            string DirectoryNodeCode = objBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).DirectoryNodeCode;

            string FullID = objBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).FullID;
            int    Deep   = objBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).Deep;

            foreach (GridViewRow gvr in GridView1.Rows)
            {
                CheckBox chk = (CheckBox)gvr.Cells[3].Controls[1];
                if (chk.Checked)
                {
                    Label labFileTemplateName = (Label)gvr.Cells[1].Controls[1];
                    ObjModel.DirectoryName = labFileTemplateName.Text;

                    ObjModel.ParentCode        = int.Parse(ParentCode);
                    ObjModel.DepartmentCode    = DepartmentCode;
                    ObjModel.DirectoryNodeCode = DirectoryNodeCode;
                    ObjModel.CreateDate        = System.DateTime.Now;
                    ObjModel.Deep = Deep + 1;

                    Label labCode = (Label)gvr.Cells[0].Controls[1];
                    ObjModel.FileTemplateCode = int.Parse(labCode.Text);

                    ObjModel.FullID = FullID + "/" + ParentCode;
                    objBFL.Insert(ObjModel);
                }
            }

            Response.Write("<script>window.parent.opener.location.reload();</script>");
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string tempStr = "";

        if (this.TreeView1.CheckedNodes.Count > 0)
        {
            foreach (TreeNode tn in this.TreeView1.CheckedNodes)
            {
                if (tn.Value != "0")
                {
                    tempStr += tn.Value + ",";
                }
            }
            tempStr = tempStr.Remove(tempStr.Length - 1, 1);
        }
        if (tempStr == "")
        {
            Response.Write("<script>alert('请选择模板类型');</script>");
        }
        else
        {
            FileTemplateTypeBFL BFL = new FileTemplateTypeBFL();
            XmlDocument         doc = BFL.GetFileTemplateTypeDataSourcePart(tempStr, 0, "部分模板管理");
            if (this.ParentCode != "" && this.ParentCode != null)
            {
                DocumentDirectoryBFL DDBFL = new DocumentDirectoryBFL();
                string DepartmentCode      = DDBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).DepartmentCode;
                string DirectoryNodeCode   = DDBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).DirectoryNodeCode;

                string FullID = DDBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).FullID;
                int    Deep   = DDBFL.GetDocumentDirectory(int.Parse(this.ParentCode)).Deep;
                DDBFL.Insert(doc, int.Parse(this.ParentCode), doc.DocumentElement.ChildNodes, DepartmentCode, FullID, Deep, DirectoryNodeCode);
                Response.Write("<script>opener.parent.location.reload();window.close();</script>");
            }
        }
    }