ACT contex- modify and verify field

public static void modifiedFieldPost(XppPrePostArgs _args)
{
    SalesTable  salesTable = _args.getThis();
    FieldId     fieldId = _args.getArg("_fieldId");

    ACT_TeamBuyerTable teamBuyerTable;

    switch (fieldId)
    {
        case fieldNum(salesTable,ACT_Teambuyer):
            select firstOnly teamBuyerTable
                where teamBuyerTable.recid == salesTable.act_teamBuyer;
            salesTable.ACT_Division = ACT_Division::find(teamBuyerTable.DivisionId).RecId;
            salesTable.ACT_Department = ACT_Department::find(teamBuyerTable.DepartmentId).RecId;
            salesTable.ACT_Category = ACT_Category::find(teamBuyerTable.CategoryId).RecId;
            salesTable.ACT_ProductType = ACT_ProductType::find(teamBuyerTable.ProductTypeId).RecId;
            salesTable.TEX_BAS_LabelId = TEX_BAS_Label::find(teamBuyerTable.TEX_BAS_LabelId).RecId;
            break;
    }



}


public static void validateFieldPost(XppPrePostArgs _args)
{
    SalesTable  salesTable = _args.getThis();
    CustTable   custTable;
    FieldId     fieldId = _args.getArg("_fieldId");
    boolean     ret = _args.getReturnValue();
    TEX_BAS_Label           TEX_BAS_Label;
    TEX_BAS_Season          TEX_BAS_Season;
    ACT_Category            ACT_Category;
    ACT_Division            ACT_Division;
    ACT_Department          ACT_department;
    ACT_ProductType         ACT_ProductType;
    ;

    custTable = custTable::find(salesTable.CustAccount);

    switch (fieldId)
    {
        case fieldNum(salesTable,TEX_BAS_LabelId):
            if (salesTable.TEX_BAS_LabelId == 0)
                return;
            TEX_BAS_Label = TEX_BAS_Label::findRecId(salesTable.TEX_BAS_LabelId);
            ret = ACT_BuyerFilterSetup::validateSelectionByCust(custTable.RecId,TEX_BAS_Label);
            break;
        case fieldNum(salesTable,TEX_BAS_SeasonCode):
            if (salesTable.TEX_BAS_SeasonCode == 0)
                return;
            TEX_BAS_Season = TEX_BAS_Season::findRecId(salesTable.TEX_BAS_SeasonCode);
            ret = ACT_BuyerFilterSetup::validateSelectionByCust(custTable.RecId,TEX_BAS_Season);
            break;
        case fieldNum(salesTable,ACT_Category):
            if (salesTable.ACT_Category == 0)
                return;
            ACT_Category = ACT_Category::findRecId(salesTable.ACT_Category);
            ret = ACT_BuyerFilterSetup::validateSelectionByCust(custTable.RecId,ACT_Category);
            break;
        case fieldNum(salesTable,ACT_Division):
            if (salesTable.ACT_Division == 0)
                return;
            ACT_Division = ACT_Division::findRecId(salesTable.ACT_Division);
            ret = ACT_BuyerFilterSetup::validateSelectionByCust(custTable.RecId,ACT_Division);
            break;
        case fieldNum(salesTable,ACT_department):
            if (salesTable.ACT_department == 0)
                return;
            ACT_department = ACT_department::findRecId(salesTable.ACT_department);
            ret = ACT_BuyerFilterSetup::validateSelectionByCust(custTable.RecId,ACT_department);
            break;
        case fieldNum(salesTable,ACT_ProductType):
            if (salesTable.act_productType == 0)
                return;
            ACT_ProductType = ACT_ProductType::findRecId(salesTable.ACT_ProductType);
            ret = ACT_BuyerFilterSetup::validateSelectionByCust(custTable.RecId,ACT_ProductType);
            break;
    }

    _args.setReturnValue(ret);
}

你可能感兴趣的:(ACT contex- modify and verify field)