csharp [BOF] A_BonusCardDuplicate

Posted

tags:

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

[
    DataContractAttribute,
    SysOperationContractProcessingAttribute(classstr(A_BonusCardDuplicateUIBuilder))
]
class A_BonusCardDuplicateContract
{
    A_BonusCardId bonusCardId;
}

[
    DataMemberAttribute
]
public A_BonusCardId parmBonusCardId(A_BonusCardId _bonusCardId = bonusCardId)
{
    bonusCardId = _bonusCardId;

    return bonusCardId;
}
class A_BonusCardDuplicateController extends SysOperationServiceController
{
}

public boolean canGoBatch()
{
    return false;
}

public void initializeFromArgs(Args _args)
{
    A_BonusCardDuplicateContract    contract;
    A_BonusCard                     bonusCard;

    ;

    super(_args);

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

    if (_args.dataset() != tableNum(A_BonusCard))
        throw error("@SYS22996");

    bonusCard = _args.record();
    contract.parmBonusCardId(bonusCard.BonusWorkFlowStatus == A_BonusWorkFlowStatus::Approved ? bonusCard.BonusCardId : "");
}

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

    ;

    controller = A_BonusCardDuplicateController::newFromArgs(_args);

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

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

    ;

    controller = new A_BonusCardDuplicateController();

    controller.initializeFromArgs(_args);

    return controller;
}
class A_BonusCardDuplicateService
{
}

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_BonusCardDuplicateContract _contract)
{
    A_BonusCard             bonusCard;
    A_BonusCard             bonusCardToCopy;

    ;
    try
    {
        bonusCardToCopy = A_BonusCard::find(_contract.parmBonusCardId(), true);

        ttsBegin;
        bonusCard.clear();
        bonusCard.initValue();
        bonusCard.initFromBonusCard(bonusCardToCopy);
        if (!bonusCard.validateWrite() || !bonusCardToCopy.RecId)
            throw error("@SYS79625");
        bonusCard.insert();

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

        bonusCardToCopy.BonusWorkFlowStatus = A_BonusWorkFlowStatus::Closed;
        bonusCardToCopy.update();
        ttsCommit;
    }
    catch
    {
        ttsAbort;
    }
}
class A_BonusCardDuplicateUIBuilder extends SysOperationAutomaticUIBuilder
{
    A_BonusCardDuplicateContract    contract;
    DialogField                     dfBonusCardId;
}

public void lookupApproved(FormControl _formControl, str _filterStr)
{
    SysTableLookup      sysTableLookup;
    Query               query;

    ;

    sysTableLookup = SysTableLookup::newParameters(tableNum(A_BonusCard), _formControl);

    query = new Query(queryStr(A_BonusCardCopy));

    sysTableLookup.addLookupfield(fieldNum(A_BonusCard, BonusCardId), true);
    sysTableLookup.addLookupfield(fieldNum(A_BonusCard, Description));

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

public void postBuild()
{
    FormBuildStringControl      frmStringCtrl;

    ;

    super();

    contract = this.dataContractObject();

    dfBonusCardId = this.bindInfo().getDialogField(contract, methodstr(A_BonusCardDuplicateContract, parmBonusCardId));
    frmStringCtrl = dfBonusCardId.fieldControl();
    dfBonusCardId.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(A_BonusCardDuplicateUIBuilder, lookupApproved), this);
    frmStringCtrl.mandatory(true);
}

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

csharp [BOF] A_BonusCardDuplicate

bof

学生信息管理系统EOF 和 BOF

逆向及Bof基础实践

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

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