Hi,
I have a code for a button inside the form. and inside this button i'm calling a sysOperationService class. However i want to be able to pass a value from the code of the button to the service class
So what i did is inside the controller, i created a method that takes the value that i want to pass
then i created a contract class with parameter that matches the value that i want to pass
Now inside the validate method in the controller i filled the contract parameter with the value
and now my service has a parameter with the contract so that i can access that value
This is the code for the button
[Control("Button")]
class ButtonControl
{
guid guidField = newguid();
Table1 table1;
update_recordset table1
setting Status = Status::B,
TTTGuidFiled = guidField
where table1.Status == Status::A;
Table1_ds.research(true);
TTTController controller = TTTController::construct();
controller.setGuidFiled(guidField); // i had to create this method in the controller to meet my needs
controller.startOperation();
}
`
Here's my controller class
///
/// controller class
///
class TTTController extends SysOperationServiceController
{
guid guidField; // i had to add this
///
/// What method to call from the service class
///
protected void new()
{
super(classStr(TTTService),methodstr(TTTService,Send),SysOperationExecutionMode::ReliableAsynchronous);
}
public static TTTController construct()
{
TTTsController controller = new TTTController();
controller.parmShowDialog(false);
controller.parmShowProgressForm(false);
controller.parmLoadFromSysLastValue(false);
return controller;
}
protected boolean validate()
{
boolean ret = true;
TTTContract contract;
contract = this.getDataContractObject();
contract.GuidField(this.getGuidField()); // i had to add this
return ret;
}
public void setGuidField(guid _guidField) // i had to add this
{
guidField = _guidField;
}
public guid getGuidField() // i had to add this
{
return guidField;
}
protected ClassDescription defaultCaption()
{
return "@Label1";
}
}
This is my service class
public void Send(TTTContract _contract)
{
guid guidField = _contract.GuidField();
}
My question is: is what i did the right thing to do? was it ok to fill the value in the validate method of the controller? or is there a better way to do what i want