Thursday, 23 January 2020

CONTRACT CLASS IN SYSOPERATION D365 CODE X++ DYNAMICS AX

Hi,
In the below post you will see the sysoperation framework contract class which can be used to run the class form the contract class.

/// <summary>
///myclass contract
/// </summary>
[DataContractAttribute]
class MyClassContract
{
    str                      packedQuery;
    ItemId itemid;
    InventLocationId locationid;
    InventSiteId siteId;
    InventQty qty;

    [DataMemberAttribute,
    AifQueryTypeAttribute('_packedQuery', querystr(MyClassQuery))
    ]
    public str parmQuery(str _packedQuery = packedQuery)
    {
        packedQuery = _packedQuery;
        return packedQuery;
    }

    public Query getQuery()
    {
        return new Query(SysOperationHelper::base64Decode(packedQuery));
    }

    public void setQuery(Query _query)
    {
        packedQuery = SysOperationHelper::base64Encode(_query.pack());
    }

    [DataMemberAttribute,  SysOperationControlVisibilityAttribute(false)]
    public ItemId parmItemid(ItemId _itemid = itemId)
    {
        itemid = _itemid;
        return itemid;
    }

    [DataMemberAttribute,  SysOperationControlVisibilityAttribute(false)]
    public InventSiteId parmSiteId(InventSiteId _siteId = siteId)
    {
        siteId = _siteId;
        return siteId;
    }

    [DataMemberAttribute,  SysOperationControlVisibilityAttribute(false)]
    public InventlocationId parmLocationId(InventlocationId _locationid = locationid)
    {
        locationid = _locationid;
        return locationid;
    }

}

********************************************************************************
for validation use below class
/// <summary>
/// desctiption
/// </summary>
[DataContractAttribute]
public class MyClassContract implements SysOperationValidatable
{
    str         query;
    TransDate   fromDate;
    TransDate   toDate;
    DataAreaId fromDateany,toDateany;
 
   [
        DataMemberAttribute,
        SysOperationLabelAttribute('@Label'),
        SysOperationDisplayOrderAttribute('1')
    ]
    public TransDate parmFromDate(TransDate _FromDate = FromDate)
    {
        FromDate = _FromDate;
        return FromDate;
    }
 
    [
        DataMemberAttribute,
        SysOperationLabelAttribute('@Label'),
        SysOperationDisplayOrderAttribute('2')
    ]
    public TransDate parmToDate(TransDate _toDate = toDate)
    {
        toDate = _toDate;
        return toDate;
    }

    [DataMemberAttribute, AifQueryTypeAttribute('_query', querystr(MyClassQuery))]
    public str parmQuery(str _query = query)
    {
        query = _query;
        return query;
    }

    public Query getQuery()
    {
        return new Query(SysOperationHelper::base64Decode(query));
    }

    public void setQuery(Query _query)
    {
        query = SysOperationHelper::base64Encode(_query.pack());
    }

    public static MyClassContract construct()
    {
        return new MyClassContract();
    }

    public boolean validate()
    {
        boolean ret = true;

        if (!this.parmFromDate() || !this.parmToDate())
        {
            ret = checkFailed("@@Label");
      }

        return ret;
    }

    protected void new()
    {
    }

}

Thanks!!!!!!!!!!!!!!!!11111

Controller class for SysoperatonFramework D365 Dynamics AX

Hi,
In the below post you will see the sysoperation framework controller class which can be used to run the class form the controller class.

[SysOperationJournaledParametersAttribute(true)]
class MyclassController extends SysOperationServiceController
{
    public static void main(Args args)
    {
        MyclassController controller;
        controller = MyclassController::newFromArgs(args);
     
        controller.startOperation();
    }
    public void new()
    {
        super();
   
        this.parmClassName(classStr(MyclassService));
        this.parmMethodName(methodStr(MyclassService, processClassMethod));
        this.parmExecutionMode(SysOperationExecutionMode::Synchronous);
        this.parmDialogCaption("@Label");
    }

    public ClassDescription caption()
    {
        return "@Label";
    }

    public static MyclassController  newFromArgs(Args _args)
    {
        MyclassController    controller;
           
        controller = new MyclassController();
        controller.initializeFromArgs(_args);
        return controller;
    }
}

AZURE INTERVIEW QUESTIONS AND ANSWERS

AZURE INTERVIEW QUESTIONS AND ANSWERES 2021 2. What is cloud computing? Explanation:  It is the use of servers on the internet to “store...