Пример #1
0
        private void InitializeResTree(ResClsType rtype)
        {
            this.tvwResNode.ImageList          = ClientData.MyImageList.imageList;
            this.tvwResNode.ImageIndex         = ClientData.MyImageList.GetIconIndex("ICO_RES_NODE");
            this.tvwResNode.SelectedImageIndex = ClientData.MyImageList.GetIconIndex("ICO_RES_NODE");
            TreeNode node = new TreeNode("工程资源", ClientData.MyImageList.GetIconIndex("ICO_RES_FDL"), ClientData.MyImageList.GetIconIndex("ICO_RES_FDL_OPEN"));

            this.tvwResNode.Nodes.Add(node);
            PLResFolder folder = new PLResFolder();

            try {
                DataSet allFolders = folder.GetAllFolders(ClientData.LogonUser.Oid);
                if (allFolders.Tables.Count > 0)
                {
                    if (rtype != ResClsType.All)
                    {
                        for (int i = allFolders.Tables[0].Rows.Count - 1; i >= 0; i--)
                        {
                            DEMetaClass metaClass;
                            DataRow     row = allFolders.Tables[0].Rows[i];
                            if (row["PLM_NODE_TYPE"].ToString() == "O")
                            {
                                metaClass = ModelContext.GetMetaClass(row["PLM_CLASS_NAME"].ToString());
                                switch (rtype)
                                {
                                case ResClsType.OutRes:
                                    if (!metaClass.IsOuterResClass)
                                    {
                                        allFolders.Tables[0].Rows.RemoveAt(i);
                                    }
                                    break;

                                case ResClsType.RefRes:
                                    if (!metaClass.IsRefResClass)
                                    {
                                        allFolders.Tables[0].Rows.RemoveAt(i);
                                    }
                                    break;

                                case ResClsType.TabRes:
                                    goto Label_0185;
                                }
                            }
                            continue;
Label_0185:
                            if (metaClass.IsRefResClass || metaClass.IsOuterResClass)
                            {
                                allFolders.Tables[0].Rows.RemoveAt(i);
                            }
                        }
                    }
                    ResFunc.FillMyTreeByUser(node, allFolders, ClientData.MyImageList);
                }
            } catch (Exception exception) {
                PrintException.Print(exception);
            }
        }
Пример #2
0
 public UCResNodeTree(ResClsType rtype)
 {
     this.InitializeComponent();
     this.InitializeResTree(rtype);
 }