41 lines
1.5 KiB
VB.net
41 lines
1.5 KiB
VB.net
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Services.EDMIService.IDB
|
|
Imports System.Data.SqlClient
|
|
|
|
Namespace Methods.SetAttributeValue
|
|
Public Class SetAttributeValueMethod
|
|
Inherits BaseMethod
|
|
|
|
Private Connection As SqlConnection
|
|
Private Transaction As SqlTransaction
|
|
|
|
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer)
|
|
MyBase.New(pLogConfig, pDatabase)
|
|
|
|
Connection = Database.GetConnection()
|
|
Transaction = Connection.BeginTransaction()
|
|
End Sub
|
|
|
|
Public Function Run(pData As SetAttributeValueRequest) As SetAttributeValueResponse
|
|
Try
|
|
If Helpers.TestObjectIdExists(pData.ObjectId) = False Then
|
|
LogAndThrow("ObjectId does not exist!")
|
|
End If
|
|
|
|
Dim oResult = Helpers.SetAttributeValue(Connection, Transaction,
|
|
pData.ObjectId, pData.AttributeName, pData.AttributeValue, pData.Language, pData.Who)
|
|
|
|
If oResult = False Then
|
|
LogAndThrow("Attribute value could not be set!")
|
|
End If
|
|
|
|
Return New SetAttributeValueResponse(pData.ObjectId)
|
|
Catch ex As Exception
|
|
Logger.Warn("Error occurred while setting attribute value!")
|
|
Return New SetAttributeValueResponse(ex)
|
|
End Try
|
|
End Function
|
|
End Class
|
|
|
|
End Namespace |