Источник:
http://daxonline.org/1596-sysoperati...-template.html
==============
Contract with query:
/// /// The SOLCustMarketingClearDataContract contract for the job to clear customer marketing information./// [DataContractAttribute]class SOLCustMarketingClearDataContract{ str encodedQuery; [DataMemberAttribute, AifQueryTypeAttribute('_encodedQuery', queryStr(SOLCustMarketingQuery))] public str parmQuery(str _encodedQuery = encodedQuery) { encodedQuery = _encodedQuery; return encodedQuery; }}
Controller:
/// /// The SOLCustMarketingClearController controller for the job to clear customer marketing information./// class SOLCustMarketingClearController extends SysOperationServiceController{ public ClassDescription caption() { ClassDescription ret; ret = "@SOLMod:ClearUnregisteredEmailAddresses"; return ret; } public LabelType parmDialogCaption(LabelType _dialogCaption = "") { LabelType caption; caption = "@SOLMod:ClearUnregisteredEmailAddresses"; return caption; } public static SOLCustMarketingClearController construct() { return new SOLCustMarketingClearController(); } public void getFromDialog() { //FormComboBoxControl mainAccountControl; //DialogForm theDialogForm; SOLCustMarketingClearDataContract contract; //theDialogForm = this.dialog().dialogForm(); super(); //mainAccountControl = theDialogForm.runControl(#MainAccount); contract = this.getDataContractObject(classStr(SOLCustMarketingClearDataContract)); if (contract) { // Set the values in data contract //contract.parmMainAccount(mainAccountControl.text()); } } public static void main(Args args) { SOLCustMarketingClearController controller; identifierName className; identifierName methodName; SysOperationExecutionMode executionMode; [className, methodName, executionMode] = SysOperationServiceController::parseServiceInfo(args); controller = new SOLCustMarketingClearController(className, methodName, executionMode); if (controller.prompt()) { controller.run(); } }}
Service:
/// /// The SOLCustMarketingClearService the job to clear customer marketing information./// class SOLCustMarketingClearService{ /// /// Clears unregistered customer email addresses /// /// /// Job contract, contains query of records, which should be deleted /// public void clearCustMarketing(SOLCustMarketingClearDataContract _contract) { Query q = new Query(SysOperationHelper::base64Decode(_contract.parmQuery())); QueryRun qr= new QueryRun(q); SOLCustMarketing custMarketing; int recordsDeleted; ttsbegin; while (qr.next()) { custMarketing = qr.get(tableNum(SOLCustMarketing)); custMarketing.selectForUpdate(true); custMarketing.delete(); recordsDeleted++; } info(strfmt("@SOLMod:NonRegCustRecordsDeleted", recordsDeleted)); ttscommit; }}
Action Menu Item:
Enum Type Parameter: SysOperationExecutionMode
Enum Parameter: Synchronous
Object Type: Class
Object: SOLCustMarketingClearController (controller class)
Parameters: SOLCustMarketingClearService.clearCustMarketing (service static method to run)
Источник:
http://daxonline.org/1596-sysoperati...-template.html