Dim Comm As SqlCommand=New SqlCommand(StrSQL,myConn)
versionID=CType(Comm.ExecuteScalar(),String)
hlkEvent.NavigateUrl=”wfrmEvent.aspx?ClassId=”+lblClassID.Text +”&VersionID=”+versionID
hlkMethod.NavigateUrl=”wfrmMethod.aspx?ClassId=”+lblClassID.Text+”&VersionID=”+versionID
hlkAttribute.NavigateUrl=”wfrmAttribute.aspx?ClassId=”+lblClassID.Text+”&Version ID=”+versionID
hlkSuper.NavigateUrl=”wfrmSuper.aspx?ClassId=”+lblClassID.Text+”&VersionID=”+versionID
hlkClass.NavigateUrl=”wfrmClass.aspx?ClassId=”+lblClassID.Text+”&VersionID=”+versionID
hlkEvent.Visible=True
hlkMethod.Visible=True
hlkAttribute.Visible=True
hlkSuper.Visible=True
hlkClass.Visible=True
End Sub
Private Sub unable_Link()
hlkEvent.Visible=False
hlkMethod.Visible=False
hlkAttribute.Visible=False
hlkSuper.Visible=False
hlkClass.Visible=False
End Sub
Private Sub MYbind(ByVal CLassID As String)
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection=New SqlConnection(”server=(local);database=ComponentSystem;
Trusted_Connection=yes”)
Dim StrSQL As String
StrSQL=”select ClassBaseID, ClassBaseName from view_Base where ClassID=’”+CLassID+”’”
MyCommand=New SqlDataAdapter(StrSQL,MyConnection)
Dim ds As DataSet
ds=New DataSet()
MyCommand.Fill(ds,”view_Base”)
Mydatagrid.DataSource=ds.Tables(”view_Base”).DefaultView
Mydatagrid.DataBind()
End Sub
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load
If Not IsPostBack Then
startIndex=0
End If
Dim className As String
ClassID=Request.QueryString().Item(”ClassID”)
versionID=Request.QueryString().Item(”versionID”)
Dim myConn As New SqlConnection(”server=(local);database=ComponentSystem;Trusted_Connection=yes”)
myConn.Open()
Dim StrSQL As String
StrSQL=”Select ClassName FROM tb_ClassInformation where ClassId=’”+ClassID+”’”
Dim Comm As SqlCommand=New SqlCommand(StrSQL,myConn)
className=CType(Comm.ExecuteScalar(),String)
lblClassName.Text=className
lblClassID.Text=ClassID
BaseID=Request.QueryString().Item(”BaseID”)
BaseName=Request.QueryString().Item(”BaseName”)
If(BaseID=””)Then
btnSave.Enabled=False
btnCancel.Enabled=False
hlkAdd.Visible=True
ChangeLink()
lblMessage.Visible=True
End If
If(BaseID<>””And lblBaseID.Text=””)Then
lblClassID.Text=ClassID
lblBaseID.Text=BaseID
lblBaseName.Text=BaseName
btnSave.CommandArgument=”Save”
btnSave.Enabled=True
btnCancel.Enabled=True
hlkAdd.Visible=False
lblMessage.Visible=False
unable_Link()
End If
hlkAdd.NavigateUrl=”wfrmTreeClass.aspx?ClassID=”+lblClassID.Text+”&FormSender=Base”
hlkAdd.Target=”_self”
MYbind(ClassID)
’在此处放置初始化页的用户代码
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object,ByVal e AsSystem.EventArgs)Handles btnCancel.Click
lblBaseID.Text=””
lblBaseName.Text=””
btnSave.CommandArgument=””
hlkAdd.Visible=True
btnSave.Enabled=False
btnCancel.Enabled=False
lblMessage.Visible=True
ChangeLink()
lblError.Text=””
lblSave.Text=””
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object,ByVal e AsSystem.EventArgs)Handles btnSave.Click
Dim myConn As New SqlConnection(”server=(local);database=componentSystem;Trusted_Connection=yes”)
myConn.Open()
Dim StrSQL As String
StrSQL=”select ClassBaseID from view_Base where ClassBaseID=’”+lblBaseID.Text+”’and ClassID=’”+lblClassID.Text+”’”
Dim myCommand As SqlCommand=New SqlCommand(StrSQL,myConn)
Dim reader As SqlDataReader
reader=myCommand.ExecuteReader()
If reader.Read()Then
lblError.Text=”*基类已存在!”
reader.Close()
Exit Sub
Else
reader.Close()
StrSQL=”INSERT INTO tb_ClassBase(ClassId,ClassBaseID)values(’”+ClassID+_”’,’”+lblBaseID.Text+”’)”
myCommand=New SqlCommand(StrSQL,myConn)
myCommand.ExecuteNonQuery()
lblSave.Visible=True
lblSave.Text=”*注册成功!”
MYbind(ClassID)
btnSave.CommandArgument()=””
btnSave.Enabled=False
btnCancel.Enabled=False
lblMessage.Visible=True
hlkAdd.Visible=True
lblError.Text=””
myConn.Close()
ChangeLink()
End If
End Sub
Private Sub Mydatagrid_ItemCommand(ByVal source As Object,ByVal e As System.Web.UI.
WebControls.DataGridCommandEventArgs)Handles Mydatagrid.ItemCommand
If e.Item.ItemType=ListItemType.Pager Or_
e.Item.ItemType=ListItemType.Header Then
Exit Sub
If e.CommandName=”Select”Then
lblBaseID.Text=e.Item.Cells(0).Text
lblBaseName.Text=e.Item.Cells(1).Text
Dim myConn As New SqlConnection(”server=(local);database=ComponentSystem;Trusted_Connection=yes”)
myConn.Open()
hlkAdd.Visible=True
btnSave.Enabled=False
btnCancel.Enabled=False
lblMessage.Visible=True
lblSave.Text=””
lblError.Text=””
ChangeLink()
End If
If e.CommandName=”Delete”Then
If(e.Item.Cells(0).Text=lblBaseID.Text)Then
lblBaseName.Text=””
lblBaseID.Text=””
hlkAdd.Visible=True
btnSave.Enabled=False
btnCancel.Enabled=False
lblSave.Text=””
lblError.Text=””
lblMessage.Visible=True
End If
Dim myConn As New SqlConnection(”server=(local);database=ComponentSystem;Trusted_Connection=yes”)
myConn.Open()
Dim StrSQL As String
StrSQL=”Delete from tb_ClassBase where ClassBaseId=’”+e.Item.Cells(0).Text+”’”
Dim myCommand As SqlCommand=New SqlCommand(StrSQL,myConn)
myCommand.ExecuteNonQuery()
lblMessage.Visible=True
btnSave.Enabled=False
btnCancel.Enabled=False
lblSave.Text=””
lblError.Text=””
MYbind(lblClassID.Text)
ChangeLink()
End If
End Sub
Private Sub Mydatagrid_PageIndexChanged(ByVal source As Object,ByVal e AsSystem.Web. UI.WebControls.DataGridPageChangedEventArgs) Handles Mydatagrid.