コード例 #1
0
        /// <summary>
        /// 方法说明:删除文件夹
        /// 作    者:jason.tang
        /// 完成时间:2013-03-13
        /// </summary>
        private void DeleteFolder()
        {
            TreeNode node = tvMaterialPBom.SelectedNode;

            if (node != null && node.Tag != null)
            {
                bool result = ProductModuleBLL.DeletePBomFolder(node.Tag.ToString());
                if (result)
                {
                    tvMaterialPBom.Nodes.Remove(node);
                    tvMaterialPBom.Refresh();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 方法说明:新建文件夹
        /// 作    者:jason.tang
        /// 完成时间:2013-03-13
        /// </summary>
        private void NewFolder()
        {
            TreeNode node = tvMaterialPBom.SelectedNode;

            if (node != null)
            {
                TreeNode tn = new TreeNode();
                tn.ImageKey = "folder";

                ProductModule pm = new ProductModule();
                if (node.Tag != null)
                {
                    pm.ParentFolderId = node.Tag.ToString();
                }
                CommonInputFrm frm = new CommonInputFrm();
                frm.CommonObject = pm;

                //从属性类获取对应的Attributes
                AttributeCollection attributes =
                    TypeDescriptor.GetProperties(pm)["FolderCode"].Attributes;

                // 从属性集合获取分类属性
                CategoryAttribute myAttribute =
                    (CategoryAttribute)attributes[typeof(CategoryAttribute)];

                frm.FormTitle = myAttribute.Category;
                //MainFrm.mainFrm.OpenModule(frm);
                if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    pm = (ProductModule)frm.CommonObject;
                    Guid gid = ProductModuleBLL.InsertPBomFolder(pm);
                    tn.Text = pm.FolderName;
                    tn.Name = gid.ToString();
                    tn.Tag  = gid.ToString();
                    node.Nodes.Add(tn);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// 方法说明:根据根节点加载子节点
        /// 作    者:jason.tang
        /// 完成时间:2013-03-07
        /// </summary>
        /// <param name="parentNode"></param>
        private void LoadProductChildNode(TreeNode parentNode)
        {
            if (parentNode == null)
            {
                return;
            }

            parentNode.Nodes.Clear();

            //查找根节点(产品文件夹)下的子节点
            List <Model.ProductModule> productModuleList =
                ProductModuleBLL.GetProductModuleList(parentNode.Name);

            if (productModuleList.Count <= 0)
            {
                return;
            }

            productModuleList.ForEach((o) =>
            {
                TreeNode node = new TreeNode();
                node.Text     = o.FolderName;
                node.Tag      = o.FolderId;
                node.Name     = o.FolderId;
                node.ImageKey = parentNode.ImageKey;

                List <Model.ProductModule> childProductModuleList =
                    ProductModuleBLL.GetProductModuleList(node.Name);
                if (childProductModuleList.Count > 0)
                {
                    LoadProductChildNode(node);
                }

                parentNode.Nodes.Add(node);
            });
        }
コード例 #4
0
        /// <summary>
        /// 方法说明:根据根节点加载子节点
        /// 作    者:jason.tang
        /// 完成时间:2013-03-05
        /// </summary>
        /// <param name="parentNode"></param>
        private void LoadPBomChildNode(TreeNode parentNode)
        {
            if (parentNode == null)
            {
                return;
            }

            parentNode.Nodes.Clear();

            //根据BaseId查找PBOM
            List <Model.ProductModule> productModuleList =
                ProductModuleBLL.GetProductModuleList(parentNode.Name);

            if (productModuleList.Count <= 0)
            {
                return;
            }

            //productModuleList.ForEach((o) =>
            //{
            //    TreeNode node = new TreeNode();
            //    node.Text = o.FolderName;
            //    node.Tag = o.FolderId;
            //    node.Name = o.FolderId;
            //    node.ImageKey = parentNode.ImageKey;

            //    List<Model.MaterialVersionModule> childProductModuleList =
            //       MaterialModuleBLL.GetProductModuleList(node.Name);
            //    if (childProductModuleList.Count > 0)
            //    {
            //        LoadPBomChildNode(node);
            //    }

            //    parentNode.Nodes.Add(node);
            //});
        }