csharp [BOF] A_BonusCardCopy

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp [BOF] A_BonusCardCopy相关的知识,希望对你有一定的参考价值。

[
    DataContractAttribute,
    SysOperationContractProcessingAttribute(classstr(SysOperationAutomaticUIBuilder))
]
class A_BonusCardCopyContract
{
    str             packedQuery;
    FromDate        fromDate;
    ToDate          toDate;
}

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

public void initQuery()
{
    Query   newQuery;
    newQuery = new Query(queryStr(A_BonusCardCopy));

    this.setQuery(newQuery);
}

[
    DataMemberAttribute
    , SysOperationDisplayOrderAttribute('1')
]
public FromDate parmFromDate(FromDate _fromDate = fromDate)
{
    fromDate = _fromDate;
    return fromDate;
}

[
    DataMemberAttribute,
    AifQueryTypeAttribute('_packedQuery', queryStr(A_BonusCardCopy))
]
public str parmPackedQuery(str _packedQuery = packedQuery)
{
    packedQuery = _packedQuery;

    return packedQuery;
}

[
    DataMemberAttribute
    , SysOperationDisplayOrderAttribute('2')
]
public toDate parmToDate(ToDate _toDate = toDate)
{
    toDate = _toDate;
    return toDate;
}

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

public boolean canGoBatch()
{
    return false;
}

public void initializeFromArgs(Args _args)
{
    A_BonusCardCopyContract             contract;

    ;

    super(_args);

    contract = this.getDataContractInfoObject().dataContractObject();
    contract.initQuery();
}

public static void main (Args _args)
{
    A_BonusCardCopyController       controller;
    SysOperationStartResult         result;

    ;

    controller = A_BonusCardCopyController::newFromArgs(_args);

    result = controller.startOperation();
    if(result != SysOperationStartResult::Started)
        throw Exception::Error;
}

public static A_BonusCardCopyController newFromArgs(Args _args)
{
    A_BonusCardCopyController       controller;

    ;

    controller = new A_BonusCardCopyController();

    controller.initializeFromArgs(_args);

    return controller;
}
class A_BonusCardCopyService
{
}

private void copyCriteria(A_BonusCardRecId _fromBonusCard, A_BonusCardRecId _toBonusCard)
{
    A_BonusCriteria     bonusCriteria;
    A_BonusCriteria     newBonusCriteria;

    ;

    while select bonusCriteria where bonusCriteria.BonusCard == _fromBonusCard
    {
        newBonusCriteria.clear();
        newBonusCriteria.data(BonusCriteria);
        newBonusCriteria.BonusCard = _toBonusCard;
        newBonusCriteria.insert();
    }
}

private void copyObjectRecipient(A_BonusCardRecId _fromBonusCard, A_BonusCardRecId _toBonusCard)
{
    A_BonusObjectRecipient                  bonusObjectRecipient;
    A_BonusObjectRecipient                  newBonusObjectRecipient;
    A_BonusObjectRecipientAddressException  addressException;
    A_BonusObjectRecipientAddressException  newAddressException;

    ;

    while select bonusObjectRecipient where bonusObjectRecipient.BonusCard == _fromBonusCard
    {
        newBonusObjectRecipient.clear();
        newBonusObjectRecipient.data(bonusObjectRecipient);
        newBonusObjectRecipient.BonusCard = _toBonusCard;
        newBonusObjectRecipient.insert();
    }

    while select addressException where addressException.BonusCard == _fromBonusCard
    {
        newAddressException.clear();
        newAddressException.data(addressException);
        newAddressException.BonusCard = _toBonusCard;
        newAddressException.insert();
    }
}

private void copyRules(A_BonusCardRecId _fromBonusCard, A_BonusCardRecId _toBonusCard)
{
    A_BonusPaymRules    bonusPaymRules;
    A_BonusPaymRules    newBonusPaymRules;

    ;

    while select bonusPaymRules where bonusPaymRules.BonusCard == _fromBonusCard
    {
        newBonusPaymRules.clear();
        newBonusPaymRules.data(bonusPaymRules);
        newBonusPaymRules.BonusCard = _toBonusCard;
        newBonusPaymRules.insert();
    }
}

[SysEntryPointAttribute]
public void runOperation(A_BonusCardCopyContract _contract)
{
    A_BonusCard             bonusCard;
    A_BonusCard             bonusCardToCopy;
    A_BonusCard             bonusCardToUpd;
    QueryRun                qr;
    FromDate                fromDate;
    ToDate                  toDate;

    ;

    fromDate    = _contract.parmFromDate();
    toDate      = _contract.parmToDate();

    try
    {
        ttsBegin;

        qr = new QueryRun(_contract.getQuery());
        while(qr.next())
        {
            bonusCardToCopy = qr.get(tableNum(A_BonusCard));

            bonusCard.clear();
            bonusCard.initValue();
            bonusCard.initFromBonusCard(bonusCardToCopy);
            bonusCard.FromDate  = fromDate  ? fromDate  : bonusCard.FromDate;
            bonusCard.ToDate    = toDate    ? toDate    : bonusCard.ToDate;
            if (!bonusCard.validateWrite())
                throw error("@SYS79625");
            bonusCard.insert();

            this.copyObjectRecipient(bonusCardToCopy.RecId, bonusCard.RecId);
            this.copyCriteria(bonusCardToCopy.RecId, bonusCard.RecId);
            this.copyRules(bonusCardToCopy.RecId, bonusCard.RecId);

            bonusCardToUpd = A_BonusCard::find(bonusCardToCopy.BonusCardId, true);
            bonusCardToUpd.BonusWorkFlowStatus = A_BonusWorkFlowStatus::Frozen;
            bonusCardToUpd.update();
        }

        ttsCommit;
    }
    catch
    {
        ttsAbort;
    }
}

以上是关于csharp [BOF] A_BonusCardCopy的主要内容,如果未能解决你的问题,请参考以下文章

csharp [BOF] A_BonusCardDuplicate

bof

学生信息管理系统EOF 和 BOF

逆向及Bof基础实践

20145311王亦徐《网络对抗技术》MAL_逆向与Bof基础

Bag of Features (BOF)图像检索算法