001.
Imports
System.IO
002.
Imports
System.Collections.Generic
003.
Imports
CrystalDecisions.CrystalReports.Engine
004.
Imports
System.Data
005.
Imports
System.Data.SqlClient
006.
007.
008.
Public
Class
Site
009.
Inherits
System.Web.UI.MasterPage
010.
Dim
PathMSDS
As
String
=
"C:\Users\TiP-ToP\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\REPORT"
011.
Dim
myDirInfo
As
DirectoryInfo
012.
Dim
myFolderInfo
As
DirectoryInfo
013.
Dim
arrFolderInfo
As
Array
014.
Dim
_dirFile
As
String
015.
Dim
RootMaster =
New
Menu
016.
Dim
RootMenu =
New
MenuItem
017.
Dim
RootTmp =
New
MenuItem
018.
Dim
SubTmp =
New
MenuItem
019.
Dim
arrMenu()
As
String
020.
Dim
tarray
As
New
ArrayList()
021.
Dim
SearchPath
As
String
=
"C:\MSDS\"
022.
023.
Sub
BuildTree(
ByVal
s
As
String
)
024.
025.
Dim
strName
As
String
= HttpContext.Current.User.Identity.Name.ToString
026.
Dim
rootdir =
New
DirectoryInfo(
"C:\Users\TiP-ToP\Documents\Visual Studio 2010\Projects\WebApplication1\WebApplication1\REPORT\"
& s)
027.
Dim
rootnode =
New
TreeNode(rootdir.Name, rootdir.FullName)
028.
Dim
rootSub =
New
MenuItem(rootdir.Name, rootdir.FullName)
029.
030.
031.
NavigationMenu.Items.Add(rootSub)
032.
033.
RecursiveSearch2(rootdir, rootSub)
034.
035.
036.
037.
End
Sub
038.
039.
040.
041.
042.
043.
044.
045.
046.
047.
048.
049.
050.
051.
052.
053.
054.
055.
056.
057.
058.
059.
060.
061.
062.
063.
064.
065.
066.
067.
068.
Private
Sub
RecursiveSearch2(
ByRef
CurrentMenu,
ByRef
CurrentSubMenu)
069.
070.
071.
072.
073.
074.
075.
076.
077.
Dim
myFile
As
FileInfo
078.
For
Each
myFile
In
CurrentMenu.GetFiles
079.
Dim
MenuFile
As
New
MenuItem(Mid(myFile.Name, 1, Len(myFile.Name) - 4), myFile.FullName)
080.
081.
082.
083.
084.
085.
086.
087.
MenuFile.NavigateUrl =
"viewreport.aspx"
088.
089.
CurrentSubMenu.Childitems.Add(MenuFile)
090.
Next
091.
092.
End
Sub
093.
094.
095.
096.
097.
098.
099.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
Private
Sub
Page_Init(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Init
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
End
Sub
145.
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Me
.Load
146.
If
IsPostBack =
False
Then
147.
BuildTree(
"Account"
)
148.
BuildTree(
"Bill Collector"
)
149.
BuildTree(
"Finance"
)
150.
BuildTree(
"IT"
)
151.
BuildTree(
"Marketing"
)
152.
BuildTree(
"Purchase"
)
153.
BuildTree(
"Terminal"
)
154.
155.
End
If
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
End
Sub
223.
224.
Private
Sub
DocumentMenu_MenuItemClick(
ByVal
sender
As
Object
,
ByVal
e
As
System.Web.UI.WebControls.MenuEventArgs)
225.
MsgBox(sender.ToString &
" "
& e.Item.Value)
226.
227.
228.
229.
230.
231.
232.
233.
234.
End
Sub
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
Protected
Sub
NavigationMenu_MenuItemClick(
ByVal
sender
As
Object
,
ByVal
e
As
System.Web.UI.WebControls.MenuEventArgs)
Handles
NavigationMenu.MenuItemClick
252.
253.
End
Sub
254.
End
Class