111 lines
3.3 KiB
C#
111 lines
3.3 KiB
C#
// ========================================================================
|
|
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
|
|
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
|
// ------------------------------------------------------------------------
|
|
// $Workfile: $ $Revision: $
|
|
// $Author: $ $Date: $
|
|
//
|
|
// $History: $
|
|
// ========================================================================
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using VEPROMS.CSLA.Library;
|
|
using Csla;
|
|
using System.Windows.Forms;
|
|
|
|
namespace DataLoader
|
|
{
|
|
public class FolderTreeNode : TreeNode
|
|
{
|
|
FolderTreeNode(string s) : base(s)
|
|
{
|
|
this.Name="ID:" + s;
|
|
}
|
|
FolderTreeNode(FolderInfo folderinfo)
|
|
: base(folderinfo.Name)
|
|
{
|
|
_folderinfo = folderinfo;
|
|
this.Name = "ID:" + folderinfo.FolderID.ToString();
|
|
}
|
|
private FolderInfo _folderinfo;
|
|
public FolderInfo FolderInfo
|
|
{
|
|
get { return _folderinfo; }
|
|
set
|
|
{
|
|
_folderinfo = value;
|
|
}
|
|
}
|
|
private Dictionary<int, FolderTreeNode> _findTree = null;
|
|
private Dictionary<int, FolderTreeNode> FindTree
|
|
{
|
|
get { return _findTree; }
|
|
set { _findTree = value; }
|
|
}
|
|
public FolderTreeNode FindTreeNode(int folderID)
|
|
{
|
|
if (_findTree != null) return _findTree[folderID];
|
|
return null;
|
|
}
|
|
public static FolderTreeNode BuildTreeList()
|
|
{
|
|
FolderTreeNode root = null;
|
|
FolderInfoList fil = FolderInfoList.Get();
|
|
Dictionary<int, FolderTreeNode> dicMissing = new Dictionary<int, FolderTreeNode>();
|
|
Dictionary<int, FolderTreeNode> dicExists = new Dictionary<int, FolderTreeNode>();
|
|
foreach (FolderInfo fi in fil)
|
|
{
|
|
FolderTreeNode ftp = null;
|
|
if (dicExists.ContainsKey(fi.ParentID))
|
|
{
|
|
ftp = dicExists[fi.ParentID];
|
|
// dicNeedToLoad.Remove(ftp);
|
|
}
|
|
else
|
|
{
|
|
if (fi.ParentID != 0)
|
|
{
|
|
ftp = new FolderTreeNode(fi.ParentID.ToString());
|
|
dicMissing.Add(fi.ParentID, ftp);
|
|
dicExists.Add(fi.ParentID, ftp);
|
|
if (fi.FolderDocVersionCount > 0)
|
|
{
|
|
TreeNode tn = new TreeNode("dummy");
|
|
tn.Tag = "dummy";
|
|
ftp.Nodes.Add(tn);
|
|
}
|
|
}
|
|
}
|
|
FolderTreeNode ft = null;
|
|
if (dicMissing.ContainsKey(fi.FolderID))
|
|
{
|
|
ft = dicMissing[fi.FolderID];
|
|
ft.FolderInfo = fi;
|
|
dicMissing.Remove(fi.FolderID);
|
|
}
|
|
else
|
|
{
|
|
ft = new FolderTreeNode(fi);
|
|
if (fi.FolderDocVersionCount > 0)
|
|
{
|
|
TreeNode tn = new TreeNode("dummy");
|
|
tn.Tag = "dummy";
|
|
ft.Nodes.Add(tn);
|
|
}
|
|
dicExists.Add(fi.FolderID, ft);
|
|
//dicNeedToLoad.Add(ft);
|
|
}
|
|
ft.Tag = fi;
|
|
if (fi.ParentID == 0)
|
|
root = ft;
|
|
else
|
|
ftp.Nodes.Add(ft);
|
|
}
|
|
root.FindTree = dicExists;
|
|
return root;
|
|
}
|
|
}
|
|
}
|
|
|