BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS Training.CustomerTask
IMPLEMENTS Consultingwerk.OERA.IBusinessService, Consultingwerk.OERA.IBusinessTaskCatalogInfo:
METHOD PUBLIC Consultingwerk.OERA.IBusinessTaskCatalogData GetCatalogData():
DEFINE VARIABLE oCatalog AS Consultingwerk.OERA.BusinessTaskCatalogData NO-UNDO.
oCatalog = NEW Consultingwerk.OERA.BusinessTaskCatalogData(THIS-OBJECT:GetClass():TypeName,
"myMethod", GET-CLASS(myParameterObject)).
RETURN oCatalog.
END METHOD.
METHOD PUBLIC VOID myMethod(poParameter AS myParameterObject):
// enter your code here
END METHOD.
END CLASS.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS Training.GetCustomerDataParameter
INHERITS Consultingwerk.JsonSerializable:
/* Input properties */
{ Akioma/Swat/JsonSerializableProperty.i CustomerNumber INTEGER }.
/* Output properties */
{ Akioma/Swat/JsonSerializableProperty.i TotalOrders INTEGER }.
{ Akioma/Swat/JsonSerializableProperty.i ShippedOrders INTEGER }.
{ Akioma/Swat/JsonSerializableProperty.i Balance INTEGER }.
END CLASS.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS Training.CustomerTask
IMPLEMENTS Consultingwerk.OERA.IBusinessService, Consultingwerk.OERA.IBusinessTaskCatalogInfo:
METHOD PUBLIC Consultingwerk.OERA.IBusinessTaskCatalogData GetCatalogData():
DEFINE VARIABLE oCatalog AS Consultingwerk.OERA.BusinessTaskCatalogData NO-UNDO.
oCatalog = NEW Consultingwerk.OERA.BusinessTaskCatalogData(THIS-OBJECT:GetClass():TypeName,
"myMethod", GET-CLASS(Training.GetCustomerDataParameter)).
RETURN oCatalog.
END METHOD.
METHOD PUBLIC VOID myMethod(poParameter AS Training.GetCustomerDataParameter):
// enter your code here
END METHOD.
END CLASS.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS Training.CustomerTask
IMPLEMENTS Consultingwerk.OERA.IBusinessService, Consultingwerk.OERA.IBusinessTaskCatalogInfo:
METHOD PUBLIC Consultingwerk.OERA.IBusinessTaskCatalogData GetCatalogData():
DEFINE VARIABLE oCatalog AS Consultingwerk.OERA.BusinessTaskCatalogData NO-UNDO.
oCatalog = NEW Consultingwerk.OERA.BusinessTaskCatalogData(THIS-OBJECT:GetClass():TypeName,
"GetCustomerData", GET-CLASS(Training.GetCustomerDataParameter)).
RETURN oCatalog.
END METHOD.
METHOD PUBLIC VOID GetCustomerData(poParameter AS Training.GetCustomerDataParameter):
// enter your code here
END METHOD.
END CLASS.
METHOD PUBLIC VOID GetCustomerData(poParameter AS Training.GetCustomerDataParameter):
DEF VAR iCount AS INT NO-UNDO.
DEF VAR iNumShipped AS INT NO-UNDO.
DEFINE BUFFER bCustomer FOR sportsdb.customer.
DEFINE BUFFER bOrder FOR sportsdb.order.
FIND bCustomer WHERE bCustomer.CustNum EQ poParameter:customerNumber.
ASSIGN iCount = 0 iNumShipped = 0.
// for each fetched Customer, go through all contacts in the DB
FOR EACH bOrder WHERE bOrder.custNum = poParameter:CustomerNumber NO-LOCK:
iCount = iCount + 1.
IF bOrder.orderStatus = "Shipped" THEN ASSIGN iNumShipped = iNumShipped + 1.
END.
poParameter:TotalOrders = iCount.
poParameter:ShippedOrders = iNumShipped.
poParameter:Balance = bCustomer.Balance.
END METHOD.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS Training.CustomerTask
IMPLEMENTS Consultingwerk.OERA.IBusinessService, Consultingwerk.OERA.IBusinessTaskCatalogInfo:
METHOD PUBLIC Consultingwerk.OERA.IBusinessTaskCatalogData GetCatalogData():
DEFINE VARIABLE oCatalog AS Consultingwerk.OERA.BusinessTaskCatalogData NO-UNDO.
oCatalog = NEW Consultingwerk.OERA.BusinessTaskCatalogData(THIS-OBJECT:GetClass():TypeName,
"GetCustomerData", GET-CLASS(Training.GetCustomerDataParameter)).
RETURN oCatalog.
END METHOD.
METHOD PUBLIC VOID GetCustomerData(poParameter AS Training.GetCustomerDataParameter):
DEF VAR iCount AS INT NO-UNDO.
DEF VAR iNumShipped AS INT NO-UNDO.
DEFINE BUFFER bCustomer FOR sportsdb.customer.
DEFINE BUFFER bOrder FOR sportsdb.order.
FIND bCustomer WHERE bCustomer.CustNum EQ poParameter:customerNumber.
ASSIGN iCount = 0 iNumShipped = 0.
// for each fetched Customer, go through all contacts in the DB
FOR EACH bOrder WHERE bOrder.custNum = poParameter:CustomerNumber NO-LOCK:
iCount = iCount + 1.
IF bOrder.orderStatus = "Shipped" THEN ASSIGN iNumShipped = iNumShipped + 1.
END.
poParameter:TotalOrders = iCount.
poParameter:ShippedOrders = iNumShipped.
poParameter:Balance = bCustomer.Balance.
END METHOD.
END CLASS.