Trusted_Connection=yes”)
Dim StrSQL As String
StrSQL=”select AttributeID,AttributeName from tb_ClassAttribute where ClassID=’”+CLassID+”’”
MyCommand=New SqlDataAdapter(StrSQL,MyConnection)
Dim ds As DataSet
ds=New DataSet()
MyCommand.Fill(ds,”tb_ClassAttribute”)
MydataGrid.DataSource=ds.Tables(”tb_ClassAttribute”).DefaultView
MydataGrid.DataBind()
End Sub
Private Sub ChangeLink()
hlkEvent.NavigateUrl=”wfrmEvent.aspx?ClassId=”+lblClassID.Text+”&;VersionID=”+VersionId
hlkMethod.NavigateUrl=”wfrmMethod.aspx?ClassId=”+lblClassID.Text+”
&;VersionID=”+VersionId
hlkBase.NavigateUrl=”wfrmBase.aspx?ClassId=”+lblClassID.Text+”&;VersionID=”
+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
hlkBase.Visible=True
hlkSuper.Visible=True
hlkClass.Visible=True
End Sub
Private Sub unable_Link()
hlkEvent.Visible=False
hlkMethod.Visible=False
hlkBase.Visible=False
hlkSuper.Visible=False
hlkClass.Visible=False
End Sub
Private Sub txtBox_init()
txtAttriName.ReadOnly=True
txtAttriIns.ReadOnly=True
txtAttriEg.ReadOnly=True
txtAttriType.ReadOnly=True
btnSave.CommandArgument=”Add”
btnEdit.Enabled=False
btnAdd.Enabled=True
btnSave.Enabled=False
btnCancel.Enabled=False
lblMessage.Visible=True
lblError.Text=””
lblErrType.Text=””
lblMessage.Text=”*单击添加新增属性”
End Sub
Private Sub save(ByVal ClassId As String)
If(Page.IsValid)Then
Dim myConn As New SqlConnection(”server=(local);database=componentSystem;Trusted_Connection=yes”)
myConn.Open()
Dim StrSQL As String
StrSQL=”Select AttributeName From tb_ClassAttribute Where AttributeName=’”
+Trim(txtAttriName.Text)+”’and ClassID=’”+ClassId+”’”
Dim myCommand As SqlCommand=New SqlCommand(StrSQL,myConn)
Dim reader As SqlDataReader
reader=myCommand.ExecuteReader()
If reader.Read()Then
lblError.Text=”*该属性已存在!”
reader.Close()
lblSave.Text=””
Exit Sub
Else
reader.Close()
StrSQL=”INSERT INTO tb_ClassAttribute(ClassId, AttributeID,AttributeName,AttributeType,AttributeInstruction,AttributeExample)values(’”+ClassId+_”’,’”+lblAttriID.Text+”’,’”+txtAttriName.Text+”’,’”+ txtAttriType.Text+”’,’”+txtAttriIns.
Text+”’,’”+txtAttriEg.Text+”’)”
myCommand=New SqlCommand(StrSQL,myConn)
myCommand.ExecuteNonQuery()
lblSave.Visible=True
lblSave.Text=”*注册成功!”
ChangeLink()
MYbind(ClassId)
txtBox_init()
myConn.Close()
End If
End If
End Sub
Private Sub update(ByVal ClassID As String)
If(Page.IsValid)Then
Dim myConn As New SqlConnection(”server=(local);database=componentSystem;Trusted_Connection=yes”)
myConn.Open()
Dim StrSQL As String
Dim myCommand As SqlCommand
StrSQL=”update tb_ClassAttribute set AttributeInstruction=’”+txtAttriIns.
Text_+”’,AttributeExample=’”+txtAttriEg.Text+”’,AttributeType=’”+txtAttriType.Text+”’
where AttributeID=’”+lblAttriID.Text+”’”
myCommand=New SqlCommand(StrSQL,myConn)
myCommand.ExecuteNonQuery()
lblSave.Visible=True
lblSave.Text=”*修改成功!”
ChangeLink()
txtBox_init()
myConn.Close()
MYbind(ClassID)
End If
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
lblClassID.Text=Request.QueryString().Item(”ClassID”)
ClassID=lblClassID.Text
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=’”+lblClassID.Text+”’”
Dim Comm As SqlCommand=New SqlCommand(StrSQL,myConn)
lblClassName.Text=CType(Comm.ExecuteScalar(),String)
MYbind(lblClassID.Text)
unable_Link()
txtAttriName.Enabled=True
lblError.Text=””
lblErrType.Text=””
ChangeLink()
End Sub
P rivate Sub btnAdd_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles btnAdd.Click
Dim myConn As New SqlConnection (”server=(local);database=ComponentSystem;Trusted_Connection=yes”)
myConn.Open()
Dim StrSQL As String
StrSQL=”Select count(AttributeID)as exper1 FROM tb_ClassAttribute”
Dim countComm As SqlCommand=New SqlCommand(StrSQL,myConn)
If(CType(countComm.ExecuteScalar(),Integer)=0)Then
lblAttriID.Text=”A1000001”
Else
StrSQL=”SELECT MAX(RIGHT(AttributeID,7))as exper1 FROM tb_ClassAttribute”
Dim myCommand As SqlCommand=New SqlCommand(StrSQL,myConn)
Dim id As Integer
id=CType(myCommand.ExecuteScalar(),Integer)
id=id+1
lblAttriID.Text=”A”+CType(id,String)
End If
txtAttriName.Text=””
txtAttriIns.Text=””
txtAttriEg.Text=””
txtAttriType.Text=””
txtAttriName.ReadOnly=False
txtAttriIns.ReadOnly=False
txtAttriEg.ReadOnly=False
txtAttriType.ReadOnly=False
lblSave.Text=””
lblError.Text=””
lblErrType.Text=””
btnSave.CommandArgument=”Add”
btnEdit.Enabled=False
btnAdd.Enabled=False
btnSave.Enabled=True
btnCancel.Enabled=True
lblMessage.Visible=False
unable_Link()
lblSave.Text=””
End Sub
P rivate Sub btnSave_Click ( ByVal sender As System.Object,ByVal e AsSystem.EventArgs)Handles btnSave.Click
If(Trim(txtAttriName.Text=””))Then
lblError.Text=”*输入属性名”
Exit Sub
End If
If(Trim(txtAttriType.Text=””))Then
lblErrType.Text=”*输入属性类型”
Exit Sub
End If
If(Trim(txtAttriIns.Text=””))Then
txtAttriIns.Text=””
End If
If(Trim(txtAttriEg.Text=””))Then
txtAttriIns.Text=””
End If
If(btnSave.CommandArgument=”Add”)Then