|
Imports System.Web.UI.WebControls.Unit
Imports System.Data.SqlClient
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Public DBCommon As CommonDBClass'DB Connection System Common Value
Private Const blankWidth = 6
Private Const plusPic = "<img src='./image/plus.gif' />"
Private Const minusPic = "<img src='./image/minus.gif' />"
Dim dsRole As DataSet
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.DBCommon = New CommonDBClass
Dim strSql As String = "Select * From Table_Role Where 1 = 1"
dsRole = Me.DBCommon.ADONETGetDataSetfromSQL(strSql)
Me.DBCommon.Dispose()
initRootNew("PanelN", "TableN", "DisplayN", "ImageN", Me.mainTable, 0)
End Sub
Private Function getIsEnd(ByVal strParent As String) As Integer
Dim arrResult As ArrayList
getChild(strParent, arrResult)
Return arrResult.Count
End Function
'Add By ZhengJia On 2006/12/31
Private Function getChildNew(ByVal intParent As Integer, ByRef arrResult As ArrayList) As Integer
arrResult = New ArrayList
Dim i As Integer
Dim strTemp As String
Dim drArray As DataRow()
drArray = dsRole.Tables(0).Select("PARENT_ID = "+ intParent.ToString)
For i = 0 To drArray.Length-1
'strTemp = Trim(drArray(i)("NAME").ToString)
'arrResult.Add(strTemp)
arrResult.Add(drArray(i))
Next
Return 1
End Function
'Add By ZhengJia On 2006/12/31
Private Function getIsEndNew(ByVal intParent As Integer) As Integer
Dim arrResult As ArrayList
getChildNew(intParent, arrResult)
Return arrResult.Count
End Function
'Add By ZhengJia On 2006/12/31
Private Function initRootNew(ByVal PanelName As String, _
ByVal TblName As String, _
ByVal DisplayName As String, _
ByVal ImgName As String, _
ByRef AtTblName As Table, _
ByVal intParent As Integer) As Integer
Dim tbl_Test As Table
Dim tbl_Row As TableRow
Dim tbl_Cell As TableCell
Dim PanelTemp As New Panel
Dim intI As Integer
Dim arrChild As ArrayList
Dim drTemp As DataRow
'Dim strParent As String
tbl_Test = New Table
'亲によって、子ForをGet
getChildNew(intParent, arrChild)
For intI = 1 To arrChild.Count
Dim intNextNum As Integer
drTemp = arrChild(intI-1)
'The end of the decision
intNextNum = getIsEndNew(CInt(drTemp("ID").ToString()))
initMeisaiNew(PanelName&intI.ToString, _
TblName&intI.ToString, _
DisplayName&intI.ToString, _
ImgName&intI.ToString, _
intNextNum, _
tbl_Test, _
arrChild(intI-1), _
intI)
Next
'************************************************* *******************************
tbl_Test.ID = TblName
tbl_Test.CssClass = "data4 font_size13 border_urdl"
tbl_Test.CellPadding = 0
tbl_Test.CellSpacing = 0
tbl_Test.Width = Percentage(100)
PanelTemp.ID = PanelName
PanelTemp.Controls.Add(tbl_Test)
tbl_Cell = New TableCell
tbl_Row = New TableRow
tbl_Cell.Width = Pixel(5)
tbl_Row.Cells.Add(tbl_Cell)
tbl_Cell = New TableCell
tbl_Cell.Controls.Add(PanelTemp)
tbl_Row.Cells.Add(tbl_Cell)
tbl_Row.ID = DisplayName
tbl_Row.Style.Item("display") = "block"
AtTblName.Rows.Add(tbl_Row)
Exit Function
ERR_FLAG:
End Function
'Add By ZhengJia On 2006/12/31
Private Function initMeisaiNew(ByVal PanelName As String, _
ByVal TblName As String, _
ByVal DisplayName As String, _
ByVal ImgName As String, _
ByVal intNextNum As Integer, _
ByRef AtTblName As Table, _
ByVal drRole As DataRow, _
ByVal intI As Integer) As Integer
Dim tbl_Test As Table
Dim tbl_Row As TableRow
Dim tbl_Cell As TableCell
Dim PanelTemp As New Panel
Dim strSekisanMeisa As String
tbl_Test = New Table
tbl_Row = New TableRow
tbl_Cell = New TableCell
strSekisanMeisa = "<table class='font_size13' cellpadding='0' cellspacing='0'>"
strSekisanMeisa = strSekisanMeisa&"<tr>"
strSekisanMeisa = strSekisanMeisa&"<td>"
If intNextNum> 0 Then
strSekisanMeisa = strSekisanMeisa&"<a href='javascript:onClick=fn_Display("""&DisplayName&""");fn_ImageChange("""&ImgName&""");'> "&_
"<img src='./image/minus.gif' id='"&ImgName&"'border='0'>"&_
"</a> "&"<a href='GridView.aspx?name="&drRole("NAME").ToString()&"'target='GridView'>"&drRole("NAME").ToString ()&"</a>"
'Else
'strSekisanMeisa = strSekisanMeisa&"<a href='GridView.aspx?name="&drRole("NAME").ToString()&"'target='GridView'>"&drRole("NAME").ToString()&"</a>"
End If
strSekisanMeisa = strSekisanMeisa&"</td>"
strSekisanMeisa = strSekisanMeisa&"</tr>"
strSekisanMeisa = strSekisanMeisa&"</table>"
If intNextNum> 0 Then
'******ライン一*****************************
tbl_Cell.Text = strSekisanMeisa
tbl_Cell.ColumnSpan = 2
tbl_Row.Cells.Add(tbl_Cell)
tbl_Test.Rows.Add(tbl_Row)
Dim intCur_ID = CInt(drRole("ID").ToString())
'*******************************************
initRootNew(PanelName&"_"&intI, _
TblName&"_"&intI, _
DisplayName, _
ImgName, _
tbl_Test, _
intCur_ID)
tbl_Test.ID = TblName
tbl_Test.Width = Percentage(100)
tbl_Test.BorderWidth = Pixel(0)
PanelTemp.ID = PanelName
PanelTemp.Controls.Add(tbl_Test)
tbl_Cell = New TableCell
tbl_Row = New TableRow
tbl_Cell.Controls.Add(PanelTemp)
tbl_Row.Cells.Add(tbl_Cell)
AtTblName.Rows.Add(tbl_Row)
Else
tbl_Cell.Text = strSekisanMeisa
tbl_Row.Cells.Add(tbl_Cell)
tbl_Row.ID = DisplayName
tbl_Row.Style.Item("display") = "block"
AtTblName.Rows.Add(tbl_Row)
End If
Exit Function
ERR_FLAG:
End Function
End Class |
|