Class SDKBiz
- Namespace
- PHCBusinessLayer
- Assembly
- PHCBusinessLayer.dll
public class SDKBiz
- Inheritance
-
SDKBiz
Properties
BizInstance
public ISDKBiz BizInstance { get; set; }
Property Value
Methods
ActEntity(object)
Executes business logic triggered by field value changes and updates related fields accordingly.
public List<MessageVO> ActEntity(object itemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The entity to update and process for business logic triggers. |
Returns
- List<MessageVO>
A list of MessageVO objects containing:
- Informational messages (e.g., stock warnings).
- Error messages if certain changes are reverted.
Remarks
Note: To persist the changes in the database, call the Save method after processing.
ClearRecover(string)
public PHCResult ClearRecover(string IdStamp)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string |
Returns
ClearRecovered()
public PHCResult ClearRecovered()
Returns
Delete(List<string>)
Available for BusinessVO and AddOnPanelVO. It allows to delete various entities from the database, by the unique identifiers
public PHCResult Delete(List<string> IdStamps)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamps |
List<string> | List of unique identifier of the records that will be delete |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process, if the list contains error messages, the process should be canceled.
Remarks
This method does not run business rules of the warning type, and if the business rules allow deleting the record, it is removed from the database immediately, unlike the other methods is not necessary to call the Save method so that the triggered action has reflection in the database.
Each entity is delete in its own transaction, the failure of one of the entities to delete does not affect the deleting of the following entities.
Delete(List<string>, bool)
Available for BusinessVO and AddOnPanelVO. It allows to delete various entities from the database, by the unique identifiers
public PHCResult Delete(List<string> IdStamps, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamps |
List<string> | List of unique identifier of the records that will be delete |
runWarningRules |
bool | If we want to run the business rules of the warning type |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process, if the list contains error messages, the process should be canceled.
Remarks
If the business rules allow deleting the record, it is removed from the database immediately, unlike the other methods is not necessary to call the Save method so that the triggered action has reflection in the database.
Each entity is delete in its own transaction, the failure of one of the entities to delete does not affect the deleting of the following entities.
Delete(IList)
Available for BusinessVO and AddOnPanelVO. It allows to delete various entities from the database, by the unique identifiers
public PHCResult Delete(IList itemsVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemsVO |
IList | List of entities that will be delete |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process, if the list contains error messages, the process should be canceled.
Remarks
This method does not run business rules of the warning type, and if the business rules allow deleting the record, it is removed from the database immediately, unlike the other methods is not necessary to call the Save method so that the triggered action has reflection in the database.
Each entity is delete in its own transaction, the failure of one of the entities to delete does not affect the deleting of the following entities.
Delete(IList, bool)
Available for BusinessVO and AddOnPanelVO. It allows to delete various entities from the database, by the unique identifiers
public PHCResult Delete(IList itemsVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemsVO |
IList | List of entities that will be delete |
runWarningRules |
bool | If we want to run the business rules of the warning type |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process, if the list contains error messages, the process should be canceled.
Remarks
If the business rules allow deleting the record, it is removed from the database immediately, unlike the other methods is not necessary to call the Save method so that the triggered action has reflection in the database.
Each entity is delete in its own transaction, the failure of one of the entities to delete does not affect the deleting of the following entities.
Delete(object)
Available for BusinessVO and AddOnPanelVO. It allows to delete an entity from the database, by its unique identifier
public PHCResult Delete(object itemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The entity that will be delete |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process, if the list contains error messages, the process should be canceled.
Remarks
This method does not run business rules of the warning type, and if the business rules allow deleting the record, it is removed from the database immediately, unlike the other methods is not necessary to call the Save method so that the triggered action has reflection in the database.
Delete(object, bool)
Available for BusinessVO and AddOnPanelVO. It allows to delete an entity from the database, by its unique identifier
public PHCResult Delete(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The entity that will be delete |
runWarningRules |
bool | If we want to run the business rules of the warning type |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process, if the list contains error messages, the process should be canceled.
Remarks
If the business rules allow deleting the record, it is removed from the database immediately, unlike the other methods is not necessary to call the Save method so that the triggered action has reflection in the database.
Delete(string)
Available for BusinessVO and AddOnPanelVO. Allows deleting an entity from the database by its unique identifier.
public PHCResult Delete(string IdStamp)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string | Unique identifier of the record to be deleted. |
Returns
- PHCResult
A PHCResult object where:
Remarks
Note: This method does not execute warning-type business rules. If the business rules allow deletion, the entity is immediately removed from the database. Unlike other methods, it is not necessary to call the Save method for the changes to take effect.
Delete(string, bool)
Available for BusinessVO and AddOnPanelVO. It allows to delete an entity from the database, by its unique identifier
public PHCResult Delete(string IdStamp, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string | Unique identifier of the record that will be delete |
runWarningRules |
bool | If we want to run the business rules of the warning type |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process, if the list contains error messages, the process should be canceled.
Remarks
If the business rules allow deleting the record, it is removed from the database immediately, unlike the other methods is not necessary to call the Save method so that the triggered action has reflection in the database.
EditInstance(object)
Initiates the process of editing an existing entity in the database.
public PHCResult EditInstance(object itemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The item to be edited |
Returns
- PHCResult
A PHCResult object where:
Remarks
Note: This method verifies if the entity can be edited by evaluating the associated business rules. It does not execute warning-type business rules. To persist changes to the database, call the Save method after a successful validation.
EditInstance(object, bool)
Initiates the process of editing an existing entity in the database.
public PHCResult EditInstance(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The entity to be edited. |
runWarningRules |
bool | Flag indicating whether to execute warning-type business rules. |
Returns
- PHCResult
A PHCResult object where:
Remarks
Note: This method verifies whether the entity can be edited by evaluating the associated business rules. It does not execute warning-type business rules. To persist changes to the database, the Save method must be called after a successful validation.
EditInstance(string)
Initiates the process of editing an existing entity in the database.
public PHCResult EditInstance(string IdStamp)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string | Unique identifier of the record to be edited. |
Returns
- PHCResult
A PHCResult object where:
Remarks
Note: This method checks whether the entity can be edited by evaluating associated business rules. It does not execute warning-type business rules. To persist any changes to the database, the Save method must be called after a successful validation.
EditInstance(string, bool)
Initiates the process of editing an existing entity in the database.
public PHCResult EditInstance(string IdStamp, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string | Unique identifier of the record to be edited. |
runWarningRules |
bool | Flag indicating whether to execute warning-type business rules. |
Returns
- PHCResult
A PHCResult object where:
Remarks
Note: This method verifies whether the entity can be edited by evaluating the associated business rules. It does not execute warning-type business rules. To persist changes to the database, the Save method must be called after a successful validation.
GetDuplicateInstance(string)
Creates a duplicate of an existing entity.
public PHCResult GetDuplicateInstance(string IdStamp)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string | Unique identifier of the record to be duplicated. |
Returns
GetNewInstance()
Creates a new instance of an entity (without associated series) for BusinessVO and AddOnPanelVO.
public PHCResult GetNewInstance()
Returns
- PHCResult
A PHCResult object where:
Remarks
Note: To persist the entity in the database, call the Save method after creation.
GetNewInstance(int)
Creates a new instance of an entity (with associated series) for BusinessVO and AddOnPanelVO.
public PHCResult GetNewInstance(int ndos)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
ndos |
int | Source document number (ndos) that will be used as the basis for the new instance. |
Returns
- PHCResult
Returns an object containing the created instance
Remarks
Note: To persist the entity in the database, call the Save method after creation.
GetNewInstanceFromReference(InstanceFromReference)
Creates a new entity instance based on a reference from another entity type.
public PHCResult GetNewInstanceFromReference(InstanceFromReference valuesItem)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
valuesItem |
InstanceFromReference | Specifies the parameters identifying the reference entity for creating the new instance. |
Returns
- PHCResult
A PHCResult object where:
Remarks
Note: To persist the new entity in the database, call the Save method after creation.
HandleOnAddOnCopyRecords(object, object)
public List<MessageVO> HandleOnAddOnCopyRecords(object bdItem, object addOnItem)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
bdItem |
object | |
addOnItem |
object |
Returns
HandleOnAdding(object, bool)
public List<MessageVO> HandleOnAdding(object itemVO, bool duplicating)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
duplicating |
bool |
Returns
HandleOnAfterSave(object)
public List<MessageVO> HandleOnAfterSave(object itemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object |
Returns
HandleOnCopyLines(object, List<object>, object, string)
public List<MessageVO> HandleOnCopyLines(object itemVO, List<object> collections, object oriItemVO, string code)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
collections |
List<object> | |
oriItemVO |
object | |
code |
string |
Returns
HandleOnDelete(object, bool)
public List<MessageVO> HandleOnDelete(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
runWarningRules |
bool |
Returns
HandleOnEditing(object, bool)
public List<MessageVO> HandleOnEditing(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
runWarningRules |
bool |
Returns
HandleOnFromReference(object, object, InstanceFromReference)
public List<MessageVO> HandleOnFromReference(object itemVO, object oriItemVO, InstanceFromReference payload)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
oriItemVO |
object | |
payload |
InstanceFromReference |
Returns
HandleOnList(IList)
public List<MessageVO> HandleOnList(IList itemsVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemsVO |
IList |
Returns
HandleOnRunCode(object, string, ref object, bool)
public List<MessageVO> HandleOnRunCode(object itemVO, string code, ref object payload, bool runWarningRules = false)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
code |
string | |
payload |
object | |
runWarningRules |
bool |
Returns
HandleOnRunListCode(string, ref object)
public List<MessageVO> HandleOnRunListCode(string code, ref object payload)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
code |
string | |
payload |
object |
Returns
HandleOnSave(object, bool)
public List<MessageVO> HandleOnSave(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
runWarningRules |
bool |
Returns
HandleOnSync(GenericVO, List<EntityChangeOperation>)
public List<MessageVO> HandleOnSync(GenericVO entity, List<EntityChangeOperation> list)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
entity |
GenericVO | |
list |
List<EntityChangeOperation> |
Returns
OnAddOnCopyRecords(object, object)
protected virtual List<MessageVO> OnAddOnCopyRecords(object bdItemVO, object addOnItemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
bdItemVO |
object | |
addOnItemVO |
object |
Returns
OnAdding(object, bool)
protected virtual List<MessageVO> OnAdding(object itemVO, bool duplicating)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
duplicating |
bool |
Returns
OnAfterSave(object)
protected virtual List<MessageVO> OnAfterSave(object itemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object |
Returns
OnCopyLines(object, List<object>, object, string)
protected virtual List<MessageVO> OnCopyLines(object itemVO, List<object> collections, object oriItemVO, string code)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
collections |
List<object> | |
oriItemVO |
object | |
code |
string |
Returns
OnDelete(object, bool)
protected virtual List<MessageVO> OnDelete(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
runWarningRules |
bool |
Returns
OnEditing(object, bool)
protected virtual List<MessageVO> OnEditing(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
runWarningRules |
bool |
Returns
OnFromReference(object, object, InstanceFromReference)
protected virtual List<MessageVO> OnFromReference(object itemVO, object oriItemVO, InstanceFromReference payload)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
oriItemVO |
object | |
payload |
InstanceFromReference |
Returns
OnList(IList)
protected virtual List<MessageVO> OnList(IList itemsVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemsVO |
IList |
Returns
OnRunCode(object, string, ref object, bool)
protected virtual List<MessageVO> OnRunCode(object itemVO, string code, ref object payload, bool runWarningRules = false)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
code |
string | |
payload |
object | |
runWarningRules |
bool |
Returns
Remarks
O help deste código não deve incluir na assinatura o parametro code por isso é tratado no sdkbiz.t4
OnRunListCode(string, ref object)
protected virtual List<MessageVO> OnRunListCode(string code, ref object payload)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
code |
string | |
payload |
object |
Returns
OnSave(object, bool)
protected virtual List<MessageVO> OnSave(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
runWarningRules |
bool |
Returns
OnSync(object, List<EntityChangeOperation>)
protected virtual List<MessageVO> OnSync(object itemVO, List<EntityChangeOperation> changedItems)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
changedItems |
List<EntityChangeOperation> |
Returns
OnSyncDelete(object, List<EntityChangeOperation>)
protected virtual List<MessageVO> OnSyncDelete(object itemVO, List<EntityChangeOperation> changedItems)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | |
changedItems |
List<EntityChangeOperation> |
Returns
OnTriggers(object)
public virtual List<MessageVO> OnTriggers(object itemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object |
Returns
Recover(string)
Available for BusinessVO and AddOnPanelVO.
public PHCResult Recover(string IdStamp)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string |
Returns
Recovered(List<string>)
public PHCResult Recovered(List<string> selectItems)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
selectItems |
List<string> |
Returns
RunCode(object, string, object, bool)
Available for BusinessVO and AddOnPanelVO. Allows to run On-Demand type code of the entity
public PHCResult RunCode(object itemVO, string code, object payload, bool runWarningRules = false)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | Entity that will be send to the On-Demand type code |
code |
string | Unique ID of the On-Demand type code |
payload |
object | Parameters that we wish to send to the execution of the code |
runWarningRules |
bool | Parameters that we wish to send to the execution of the code |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process.
RunCode(string, string, object, bool)
Available for BusinessVO and AddOnPanelVO. Allows to run On-Demand type code of the entity
public PHCResult RunCode(string IdStamp, string code, object payload, bool runWarningRules = false)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
IdStamp |
string | Unique identifier of the entity that will be send to the On-Demand type code |
code |
string | Unique ID of the On-Demand type code |
payload |
object | Parameters that we wish to send to the execution of the code |
runWarningRules |
bool | Parameters that we wish to send to the execution of the code |
Returns
- PHCResult
PHCResult where result contains the new entity and messages may contain messages resulting from this process.
Save(IList)
Validates business rules and, if successful, saves a collection of entities to the database.
public List<MessageVO> Save(IList itemsVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemsVO |
IList | A list of entities to be saved. |
Returns
- List<MessageVO>
A List(Of MessageVO) containing:
- Errors if any business rule prevents an entity from being saved.
- An empty list (or non-error messages) if all entities are saved successfully.
Remarks
Note: Each entity is saved in its own transaction. Failure to save one entity does not affect the others. This method does not execute warning-type business rules.
Save(IList, bool)
Validates business rules and, if successful, saves a collection of entities to the database.
public List<MessageVO> Save(IList itemsVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemsVO |
IList | The entity to be saved. |
runWarningRules |
bool | Flag indicating whether to execute warning-type business rules |
Returns
- List<MessageVO>
A List(Of MessageVO) containing:
- Errors if any business rule prevents saving.
- Warning messages if enabled.
- An empty list if all entities are valid and saved successfully.
Remarks
Note: Each entity is saved in its own transaction. Failure to save one entity does not affect the others.
Save(IList, bool, bool)
Validates business rules and, if successful, saves a collection of entities to the database.
public List<MessageVO> Save(IList itemsVO, bool runWarningRules, bool @virtual)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemsVO |
IList | The entity To be saved. |
runWarningRules |
bool | Flag indicating whether to execute warning-type business rules. |
virtual |
bool | If True, only validations and triggers are executed without persisting the entities. |
Returns
- List<MessageVO>
A List(Of MessageVO) containing:
- Errors if any business rule prevents saving.
- Warning messages if enabled.
- If
virtualis False, an empty list indicates the entities were saved successfully. - If
virtualis True, the entities are only validated without being persisted.
Remarks
Note: Each entity is saved in its own transaction. The failure to save one entity does not affect the saving of the others.
Save(object)
Validates business rules and, if successful, saves the entity to the database.
public List<MessageVO> Save(object itemVO)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The entity to be saved. |
Returns
- List<MessageVO>
A List(Of MessageVO) containing:
- Errors if business rules prevent the entity from being saved.
- An empty list (or non-error messages) if the save is successful.
Remarks
Note: This method internally calls Save(itemVO, False). Ensure that the entity adheres to the required format and guidelines.
Save(object, bool)
Validates business rules and, if successful, saves the entity to the database.
public List<MessageVO> Save(object itemVO, bool runWarningRules)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The entity to be saved. |
runWarningRules |
bool |
Returns
- List<MessageVO>
A List(Of MessageVO) containing:
- Errors if business rules prevent saving.
- Warning messages if enabled.
- An empty list if the entity is valid and saved successfully.
Remarks
Note: To persist the entity, ensure all business rules are satisfied.
Save(object, bool, bool)
Validates business rules and processes the entity based on the specified mode.
public List<MessageVO> Save(object itemVO, bool runWarningRules, bool @virtual)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
itemVO |
object | The entity to be saved. |
runWarningRules |
bool | Flag indicating whether to execute warning-type business rules. |
virtual |
bool | If True, only validations and triggers are executed without persisting the entities. |
Returns
- List<MessageVO>
A List(Of MessageVO) containing:
- Errors if any business rule prevents processing.
- Warning messages if enabled.
- If
virtualis False, an empty list indicates the entity was saved successfully. - If
virtualis True, the entity is only validated without being persisted.
Remarks
Note: When operating in virtual mode, the entity is not saved to the database.
XMLExport(object, string, bool)
Allows to export the record in XML format
public PHCResult XMLExport(object payload, string IdStamp, bool runValidations)
Parameters
| Nome | Tipo | Descrição |
|---|---|---|
payload |
object | Parameters that we wish to send to the execution of the code |
IdStamp |
string | Unique identifier of the entity that will be send to the XML export |
runValidations |
bool | If we want to run the business rules |
Returns
- PHCResult
PHCResult where PHCResult.scalarResult.stringResult contains the new filename of the XMl produced and PHCResult.messages may contain messages resulting from this process.