Manuais
PHC GO SDK de Add-ons
 

Introdução

Este artigo pretende ajudar na transição da framework de PHC CS para a framework de Addons de PHC GO, nomeadamente trabalhar com classes utilitárias que contêm desde funções para retornar valores que estão armazenados na base de dados, até classes inteiramente dedicadas á gestão de regras de negócio e funcionalidades das entidades de utilizador

Existem vários artigos da série Usa PHC CS com o intuito de facilitar a transição da programação da framework PHC CS em Visual FoxPro para a framework PHC GO em .NET Framework, utilizando Visual Basic.

Recomenda-se a leitura dos artigos pela ordem indicada, de forma a apresentar as diversas tecnologias e técnicas de programação em sequência crescente de complexidade e funcionalidade.



SDK de Add-Ons



Na aplicação PHC GO, existem dois SDKs disponíveis: um para programação em frontend, utilizando a linguagem TypeScript, e outro para programação em backend, utilizando a linguagem Visual Basic .NET.

No frontend, é fundamental respeitar a convenção de nomenclatura das classes, considerando o uso de letras maiúsculas e minúsculas. O próprio termo (sdk) deve ser sempre escrito em minúsculas.

No backend, embora a escrita seja indiferente, é recomendado adotar o mesmo formato em que a classe foi originalmente definida, como uma boa prática.

Além disso, nos casos que envolvem métodos de web services, tanto o serviço como os seus métodos e os nomes dos parâmetros devem seguir as mesmas convenções aplicadas ao frontend, garantindo consistência na nomenclatura.

PHC GO Help Center

https://helpcenter.phcgo.net

No PHC GO Help Center, estão descritos as funcionalidades e os diversos produtos e Add-Ons existentes na aplicação, neste local existe o Developers Help Center, onde estão descritas as funções de SDK de frontend e backend, assim como diversos exemplos de utilização.

Developers Help Center

https://helpcenter.phcgo.net/PT/programs/ewpview.aspx?codigo=developers

SDK de frontend

https://helpcenter.phcgo.net/PT/sug/ptxview.aspx?stamp=379g%3a3469c5f697%3af285ee

Nos manuais anteriores da série Usa PHC CS, foi mostrados diversos exemplos do uso deste SDK. A maioria dessas funções são desenhadas para alterar o aspeto visual dos componentes presentes nos ecrãs das entidades de utilizador ou de sistema.

Existe uma, que por fazer a ponte entre o frontend e o backend, nos ajuda a manter as regras de negócio no servidor, é a função sdk.runBusinessRuleOnDemand:

https://helpcenter.phcgo.net/pt/sug/ptxview.aspx?stamp=b1976fd542gfdf6929c523

SDK de backend

https://helpcenter.phcgo.net/PT/sug/ptxview.aspx?stamp=1877dd5fe%3ab682%3a%3ad72584

Nos manuais anteriores da série Usa PHC CS, foram apresentados diversos exemplos do uso deste SDK. As funções do SDK estão organizadas em classes e, à medida que são desenvolvidas novas funcionalidades e adicionados novos produtos e Add-Ons à aplicação PHC GO, este SDK é continuamente expandido.

Entre os exemplos apresentados, destacaram-se as classes System, User e Query. Neste manual, iremos aprofundar a análise da classe Business, que descreve o funcionamento dos controladores de negócio das diferentes entidades existentes na aplicação, sejam elas de utilizador ou de sistema.

SDKBiz

No manual Regras de Negócio da série Usa PHC, foram abordados os diversos eventos disponíveis num controlador de negócio de uma entidade. Quando desejamos incluir código personalizado para atuar num determinado ecrã, basta aproveitar esses eventos e inserir o código necessário.

Caso seja necessário executar código relacionado a uma entidade diferente da entidade principal associada ao ecrã onde estamos a trabalhar, é necessário utilizar a função SDK.Business.CreateBiz. Esta função permite inicializar o controlador da entidade desejada e realizar as operações pretendidas.

A função SDK.Business.CreateBiz recebe o nome da entidade como parâmetro. Essa entidade pode corresponder a um ecrã já existente na aplicação PHC GO ou a uma entidade personalizada criada a partir de um Add-On. A função devolve uma classe nativa que implementa os mesmos eventos descritos no manual Regras de Negócio.

' Código PHC GO – VB.NET´

' create the controller
Dim clBiz as SDKBiz = SDK.Business.CreateBiz("CL")
If clBiz Is Nothing
Return new MsgError("The client business is not available.")
End If

' get's the customer record to be updated
Dim myFilters as New FilterItems
myFilters.Add(New FilterItem("no", Comparison.Equal, 1))
myFilters.Add(New FilterItem("estab", Comparison.Equal, 0))
Dim myClient As ClVO = SDK.Query.getEntityData(Of ClVO)(myFilters).FirstOrDefault()

' update field
myClient.inactivo = 1

' save record
dim myMessages as List(Of MessageVO) = clBiz.Save(myClient)

' Código PHC GO – VB.NET

' create the controller
Dim albumBiz as SDKBiz = SDK.Business.CreateBiz("u0000_album")
If albumBiz Is Nothing
Return new MsgError("The album business is not available.")
End If

' get's all not percious albuns
Dim myNotPercious As List(Of u0000_AlbumVO) = SDK.Query.getEntityData(Of
u0000_AlbumVO)(New FilterItem("rarity", Comparison.Equal, 0))


' update
For Each albumItem in myNotPercious
albumItem.rarity = 1
End For

' save all records
dim myMessages as List(Of MessageVO) = albumBiz.Save(myNotPercious)


Muitos desses eventos retornam uma variável do tipo PHCResult. Anteriormente, vimos exemplos em que o retorno consistia em listas de mensagens, do tipo List(Of MessageVO).

O novo tipo PHCResult é utilizado quando, além de retornar essa lista de mensagens, existe a necessidade de incluir simultaneamente outro tipo de resultado, específico ao evento em questão.

' Código PHC GO – VB.NET

Public Class PHCResult

#Region "Properties"

''' <summary>
''' Collection that stores errors.
''' </summary>
Public Property messages As New List(Of MessageVO)

''' <summary>
''' Collection that stores the results.
''' </summary>
Public Property result As New List(Of Object)

''' <summary>
''' Property used to return a simple value.
''' </summary>
Public Property scalarResult As New ScalarResult()

#End Region

#Region "Methods - Add"

Public Function Add(otherResult As PHCResult) As PHCResult
End Function

Public Function AddResult(itemValue As Object) As PHCResult
End Function

Public Function AddResult(itemValues As IList) As PHCResult
End Function

Public Function AddMessages(itemValues As List(Of MessageVO)) As PHCResult
End Function

Public Function AddMessage(itemValue As MessageVO) As PHCResult
End Function

Public Function AddScalar(item As Object) As PHCResult
End Function

#End Region
#Region "Methods - Get"

Public Function GetResult(Of T)() As T
End Function

Public Function GetResult(Of T)(zeroBaseIndex As Integer) As T
End Function

Public Function GetMsgsError() As List(Of MessageVO)
Return (From pk In messages Where
pk.messageType = MessageVO.MessagesType.Error).ToList()
End Function

Public Function GetFirstMsgsError() As MessageVO
Return (From pk In messages Where
pk.messageType = MessageVO.MessagesType.Error).FirstOrDefault()
End Function

#End Region

#Region "Utils"

Public Shared Function hasMsgErrors(messages As List(Of MessageVO)) As Boolean
Return (From pk In messages Where
pk.messageType = MessageVO.MessagesType.Error).Any
End Function

Public Shared Function hasMsgWarnings(messages As List(Of MessageVO)) As Boolean
Return (From pk In messages Where
pk.messageType = MessageVO.MessagesType.Warning).Any
End Function

Public Shared Function hasMsgInformations(messages As List(Of MessageVO)) As Boolean
Return (From pk In messages Where
pk.messageType = MessageVO.MessagesType.Information).Any
End Function

#End Region

End Class


O tipo ScalarResult oferece uma alternativa para trabalhar com tipos nativos do .NET. Embora seja possível continuar a utilizar a propriedade result, que aceita qualquer tipo de dados por ser uma lista de objetos, o ScalarResult destaca-se por disponibilizar funções utilitárias adicionais que podem ser bastante úteis em diversos cenários.

' Código PHC GO – VB.NET

Public Class ScalarResult

#Region "Properties"

''' <summary>
''' Indicates that no value has been assigned to the object
''' </summary>
Public Property isVoid As Boolean = True

#End Region

#Region "Result"

''' <summary>
''' When the value is of type String
''' </summary>
''' <value>
''' Default value is an empty string and not anything
''' </value>
Public Property stringResult As String = ""

''' <summary>
''' When the value is of type Int32
''' </summary>
''' <value>
''' Default value is 0
''' </value>
Public Property integerResult As Int32

''' <summary>
''' When the value is of type Decimal
''' </summary>
''' <value>
''' Default value is 0
''' </value>
Public Property decimalResult As Decimal

''' <summary>
''' When the value is of type DateTime
''' </summary>
''' <value>
''' Default value is 01.01.1900
''' </value>
Public Property dateResult As DateTime = Utils.Dates.MinBusinessDate

''' <summary>
''' When the value is of type Boolean
''' </summary>
''' <value>
''' Default value is FALSE
''' </value>
Public Property booleanResult As Boolean

#End Region
#Region "Methods"

Public Function GetValue() As Object
Dim resultTy As Type = GetResultType()

If resultTy.IsEnum Then
Return integerResult
End If

If resultTy Is GetType(String) Then
Return stringResult
End If

If resultTy Is GetType(Int32) Then
Return integerResult
End If

If resultTy Is GetType(Decimal) Then
Return decimalResult
End If

If resultTy Is GetType(DateTime) Then
Return dateResult
End If

If resultTy Is GetType(Boolean) Then
Return booleanResult
End If

Return Nothing
End Function

Public Sub SetValue(value As Object, typeValue As Type)

If value Is Nothing Then
Clear()
Exit Sub
End If

If typeValue.IsEnum Then
integerResult = CType(value, Integer)
Exit Sub
End If
If typeValue Is GetType(String) Then
stringResult = CStr(value)
Exit Sub
End If

If typeValue Is GetType(Integer) Then
integerResult = CInt(value, Integer)
Exit Sub
End If

If typeValue Is GetType(Decimal) Then
decimalResult = CDbl(value, Decimal)
Exit Sub
End If

If typeValue Is GetType(Date) Then
dateResult = CDate(value)
Exit Sub
End If

If typeValue Is GetType(DateTime) Then
dateResult = CDate(value)
Exit Sub
End If

If typeValue Is GetType(Boolean) Then
booleanResult = CBool(value)
Exit Sub
End If

End Sub

Public Sub Clear()

isVoid = True
stringResult = ""
integerResult = 0
decimalResult = 0
dateResult = Utils.Dates.MinBusinessDate
booleanResult = False
End Sub

#End Region

End Class


Estas duas classes também estão disponíveis no frontend em TypeScript. No entanto, possuem menos funções utilitárias, oferecendo, em sua maioria, apenas as propriedades que armazenam os resultados.

' Código PHC GO  Typescript

export class PHCResult {
messages: MessageVO[] = [];
result: any[] = [];
scalarResult: ScalarResult;

static ok(result: PHCResult): boolean {
return !result.messages.find((value: MessageVO) => MessageVO.error(value));
}
}

' Código PHC GO – Typescript

export class ScalarResult {
isVoid: boolean = true;

booleanResult: boolean = false;
dateResult: Date = new Date('1900-01-01T00:00:00Z');
decimalResult: number = 0;
integerResult: number = 0;
stringResult: number = 0;


SDKBiz – GetNewInstance

Este método vai executar o evento Ao Introduzir das regras de negócio.

Serve para criar novos registos de entidades principais. Para criar registos de entidades de coleções, após obter a entidade principal deve-se usar os métodos AddChild() para adicionar novos registos nas coleções.

Este evento possui os seguintes construtores:

' Código PHC GO – VB.NET

''' <summary>
''' Create a new instance of entity that do not have associated series.
''' </summary>
'''
''' <remarks>
''' For the entity to be save to the database it is necessary to call the Save method
''' </remarks>
Function GetNewInstance() As PHCResult

''' <summary>
''' Create a new instance of entity that have associated series.
''' </summary>
'''
''' <param name="ndos">
''' The serie ID
''' </param>
'''
''' <remarks>
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function GetNewInstance(ndos As Int32) As PHCResult


No manual Cursores, da série Usa PHC CS, foi apresentado um exemplo de criação de um álbum com uma música na sua coleção. Nesse exemplo, embora tenhamos utilizado o respetivo controlador de negócio dos álbuns para efetuar a gravação, a obtenção do novo registo foi realizada através da função GetNewInstance() da própria entidade.

Essa abordagem foi adotada para manter o foco no tópico principal do manual, os cursores. No exemplo seguinte, usamos o método adequado para criação de um novo registo da entidade principal.

' Código PHC GO – VB.NET

Dim listMsg as New List(Of MessageVO)

' create the controller
Dim albumBiz as SDKBiz = SDK.Business.CreateBiz("u0000_album")
If albumBiz Is Nothing
listMsg.Add(New MsgError("The album business is not available."))
Return listMsg
End If

Dim albumResult As PHCResult = albumBiz.GetNewInstance()
If albumResult Is Nothing
listMsg.Add(New MsgError("The album new entity is not available."))
listMsg.AddRange(albumResult.messages())
Return listMsg
End If

Dim musicItem as u0000_MusicaVO = albumResult.GetResult(Of u0000_MusicaVO)()
If musicItem Is Nothing
listMsg.Add(New MsgError("The album new entity is not available."))
Return listMsg
End If

' fill the values in the album
albumItem.nome = "The Best Portuguese Pimba"
albumItem.percious = .t.
' add a song
Dim musicItem as u0000_MusicaVO = albumItem.AddChild(Of u0000_MusicaVO)
' fill the values in the song
musicItem.nome = "O que elas querem é pimba"
' create the album with a song on the database.
listMsg.AddRange(albumBiz.Save(newAlbums))
Return listMsg


SDKBiz – GetDuplicateInstance

Este método vai executar o evento Ao Introduzir das regras de negócio, no modo de duplicação.

Este método permite criar um novo registo de uma entidade principal, tendo como base outro registo já existente da mesma entidade na base de dados.

Este evento possui o seguinte construtor:

' Código PHC GO – VB.NET

''' <summary>
''' Lets you create a new entity as a duplicate of an existing one.
''' </summary>
'''
''' <param name="IdStamp">
''' Unique identifier of the record that will be duplicated.
''' </param>
'''
''' <remarks>
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function GetDuplicateInstance(IdStamp As String) As PHCResult


SDKBiz – GetNewInstanceFromReference

Este método vai executar o evento Ao Introduzir com Referência das regras de negócio.

Este método permite criar um novo registo de uma entidade principal, de sistema ou utilizador, tendo como origem outro registo de uma entidade diferente, já existente na base de dados.

Uma particularidade é que, quando origin e destination do parâmetro valuesItem são os mesmos, o método anterior, GetDuplicateInstance, é executado.

Este evento possui o seguinte construtor:

' Código PHC GO – VB.NET

''' <summary>
''' Create a new instance of entity from another diferent type entity.
''' </summary>
'''
''' <param name="valuesItem">
''' Specifies the entity from which you want to create the new entity.
''' </param>
'''
''' <remarks>
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function GetNewInstanceFromReference(valuesItem As InstanceFromReference) As PHCResult


Estrutura da classe InstanceFromReference.

span style="color: #75715e">' Código PHC GO – VB.NET

Class InstanceFromReference
Property origin As String
Property originstamp As String
Property docid As Decimal
Property destination As String
Property payload As Object
Function GetValue(Of T)(key As String) As T

End Class


SDKBiz – EditInstance

Este método vai executar o evento Ao Alterar das regras de negócio.

Este método permite verificar se determinado registo de uma entidade principal pode ser alterado. Caso a alteração seja permitida, o registo é previamente colocado na cache de backend, o que melhora a performance em operações futuras.

É útil também para verificar se existe alguma regra de negócio prévia que impeça a alteração do registo, permitindo deste modo cancelar a operação ao invés de a continuar e só mais tarde no método Save ter conhecimento que a alteração não pode ser efetuada.

Este evento possui os seguintes construtores:

' Código PHC GO – VB.NET

''' <summary>
''' It starts the process of changing an existing entity in the database.
''' </summary>
'''
''' <param name="IdStamp">
''' Unique identifier of the record that will be edit.
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function EditInstance(IdStamp As String) As PHCResult

''' <summary>
''' It starts the process of changing an existing entity in the database
''' </summary>
'''
''' <param name="itemVO">
''' The entity that will be edit
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function EditInstance(itemVO As Object) As PHCResult
''' It starts the process of changing an existing entity in the database.
''' </summary>
'''
''' <param name="IdStamp">
''' Unique identifier of the record that will be edit.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
'''
''' <remarks>
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function EditInstance(IdStamp As String, runWarningRules As Boolean) As PHCResult

''' <summary>
''' It starts the process of changing an existing entity in the database
''' </summary>
'''
''' <param name="itemVO">
''' the entity that will be edit
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type
''' </param>
'''
''' <remarks>
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function EditInstance(itemVO As Object, runWarningRules As Boolean) As PHCResult


SDKBiz – ActEntity

Este método vai executar o evento Ao Sincronizar das regras de negócio.

Este método permite, após modificar um valor no registo da entidade principal ou em um registo de uma das coleções existentes, executar as regras de negócio associadas, de forma a atualizar outros campos da entidade com base na alteração inicial.

Por exemplo, nos documentos de faturação, ao criar um novo registo na coleção de linhas da fatura, e após alterar o campo de referência (ref), a execução deste evento possibilita a atualização da mesma linha, incluindo o campo descrição, o preço de venda, os descontos associados e até o cálculo do total da linha e do documento com base nestes valores.

Este evento possui o seguinte construtor:

' Código PHC GO – VB.NET

''' <summary>
''' Runs code associated with value changes of certain fields of the entity,
''' and updates the value of other fields based on these changes, for example
''' when changing the amount field the total of the row is updated automatically.
''' </summary>
'''
''' <param name="itemVO">
''' The entity to update.
''' </param>
'''
''' <remarks>
''' For the entity to be save to the database it is necessary to call the Save method.
''' </remarks>
Function ActEntity(itemVO As Object) As List(Of MessageVO)


SDKBiz – Save

Este método vai executar o evento Ao Gravar das regras de negócio.

Este método deve ser utilizado após efetuarmos as alterações desejadas no registo da entidade principal e/ou nas suas coleções, para instruir a aplicação a gravar esse registo na base de dados.

Este pedido irá acionar as regras de negócio associadas ao evento e, caso a gravação seja bemsucedida, executará o evento Após Gravar.

Este evento possui os seguintes construtores:

' Código PHC GO – VB.NET

''' <summary>
''' Run the business rules and if ok, save the entity on the database.
''' </summary>
'''
''' <param name="itemVO">
''' The entity to save.
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
''' </remarks>
Function Save(itemVO As Object) As List(Of MessageVO)

''' <summary>
''' Run the business rules and if ok, save the entity on the database.
''' </summary>
'''
''' <param name="itemsVO">
''' The entities to save.
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
''' </remarks>
Function Save(itemsVO As IList) As List(Of MessageVO)

''' <summary>
''' Run the business rules and if ok, save the entity on the database.
''' </summary>
'''
''' <param name="itemVO">
''' The entity to save.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
Function Save(itemVO As Object, runWarningRules As Boolean) As List(Of MessageVO)
''' Run the business rules and if ok, save the entity on the database.
''' </summary>
'''
''' <param name="itemsVO">
''' The entities to save.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
Function Save(itemsVO As IList, runWarningRules As Boolean) As List(Of MessageVO)

''' <summary>
''' Run the business rules and if ok, save the entity on the database.
''' </summary>
'''
''' <param name="itemVO">
''' The entity to save.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
'''
''' <param name="virtual">
''' If we just want to run business rules and triggers, not recording the entity.
''' </param>
Function Save(itemVO As Object, runWarningRules As Boolean, virtual As Boolean) As List(Of
MessageVO)
''' Run the business rules and if ok, save the entity on the database
''' </summary>
'''
''' <param name="itemsVO">
''' The entities to save
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type
''' </param>
'''
''' <param name="virtual">
''' If we just want to run business rules and triggers, not recording the entity.
''' </param>
Function Save(itemsVO As IList, runWarningRules As Boolean, virtual As Boolean) As List(Of
MessageVO)


SDKBiz – Delete

Este método vai executar o evento Ao Apagar das regras de negócio.

Este método permite verificar se determinado registo de uma entidade principal pode ser eliminado da base de dados.

Caso a eliminação seja permitida, o registo é imediatamente excluído da base de dados, ou seja, não é necessário chamar o método Save.

A tarefa de eliminar o registo da base de dados, é realizada automaticamente neste evento. No entanto, se a eliminação for bem-sucedida, o evento Após Gravar é executado.

Este evento possui os seguintes construtores:

' Código PHC GO – VB.NET
''' <summary>
''' It allows to delete an entity from the database, by its unique identifier.
''' </summary>
'''
''' <param name="IdStamp">
''' Unique identifier of the record that will be delete.
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
'''
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(IdStamp As String) As PHCResult
''' <summary>
''' It allows to delete an entity from the database, by its unique identifier.
''' </summary>
'''
''' <param name="itemVO">
''' The entity that will be delete.
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
'''
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(itemVO As Object) As PHCResult
''' It allows to delete an entity from the database, by its unique identifier.
''' </summary>
'''
''' <param name="IdStamp">
''' Unique identifier of the record that will be delete.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
'''
''' <remarks>
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(IdStamp As String, runWarningRules As Boolean) As PHCResult
''' <summary>
''' It allows to delete an entity from the database, by its unique identifier.
''' </summary>
'''
''' <param name="itemVO">
''' The entity that will be delete.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
'''
''' <remarks>
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(itemVO As Object, runWarningRules As Boolean) As PHCResult
''' It allows to delete various entities from the database, by the unique identifiers.
''' </summary>
'''
''' <param name="IdStamps">
''' List of unique identifier of the records that will be delete.
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
'''
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(IdStamps As List(Of String)) As PHCResult
''' <summary>
''' It allows to delete various entities from the database, by the unique identifiers.
''' </summary>
'''
''' <param name="itemsVO">
''' List of entities that will be delete.
''' </param>
'''
''' <remarks>
''' This method does not run business rules of the warning type.
'''
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(itemsVO As IList) As PHCResult
''' It allows to delete various entities from the database, by the unique identifiers.
''' </summary>
'''
''' <param name="IdStamps">
''' List of unique identifier of the records that will be delete.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
'''
''' <remarks>
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(IdStamps As List(Of String), runWarningRules As Boolean) As PHCResult
''' <summary>
''' It allows to delete various entities from the database, by the unique identifiers.
''' </summary>
'''
''' <param name="itemsVO">
''' List of entities that will be delete.
''' </param>
'''
''' <param name="runWarningRules">
''' If we want to run the business rules of the warning type.
''' </param>
'''
''' <remarks>
''' If the business rules allow deleting the record, it is removed from the
''' database immediately. It is not necessary to call the Save method.
''' </remarks>
Function Delete(itemsVO As IList, runWarningRules As Boolean) As PHCResult


SDKBiz – RunCode

Este método vai executar o evento A Pedido das regras de negócio.

Este método permite executar a mesma funcionalidade disponível no SDK de frontend, que consiste em solicitar a execução de uma regra de negócio no backend através da chamada sdk.runBusinessRuleOnDemand.

Este evento possui os seguintes construtores:

' Código PHC GO – VB.NET

''' <summary>
''' Allows to run On-Demand type code of the entity.
''' </summary>
'''
''' <param name="IdStamp">
''' Unique identifier of the entity that will be send to the On-Demand type code.
''' </param>
'''
''' <param name="code">
''' Unique ID of the On-Demand type code.
''' </param>
'''
''' <param name="payload">
''' Parameters that we wish to send to the execution of the code.
''' </param>
'''
''' <param name="runWarningRules">
''' Parameters that we wish to send to the execution of the code.
''' </param>
Function RunCode(IdStamp As String, code As String, payload As Object,
Optional runWarningRules As Boolean = False) As PHCResult
''' Allows to run On-Demand type code of the entity.
''' </summary>
'''
''' <param name="itemVO">
''' Entity that will be send to the On-Demand type code.
''' </param>
'''
''' <param name="code">
''' Unique ID of the On-Demand type code.
''' </param>
'''
''' <param name="payload">
''' Parameters that we wish to send to the execution of the code.
''' </param>
'''
''' <param name="runWarningRules">
''' Parameters that we wish to send to the execution of the code.
''' </param>
Function RunCode(itemVO As Object, code As String, payload As Object,
Optional runWarningRules As Boolean = False) As PHCResult