Quantcast
Channel: Martin Dráb's Activities
Viewing all articles
Browse latest Browse all 17532

how to get the original value after validating dataField?

$
0
0

I want to add control when I modify the "Product lifecycle state" : 

I add on validating eventHandler on dataField in dataSource  : 

[FormDataFieldEventHandler(formDataFieldStr(EcoResProductDetailsExtended, InventTable, ProductLifecycleStateId), FormDataFieldEventType::Validating)]
    public static void ProductLifecycleStateId_OnValidating(FormDataObject sender, FormDataFieldEventArgs e)
    {
        var                           args = e as FormDataFieldCancelEventArgs;
        SysTableIdView                tableId;
        EcoResProductCategory         productCategory;
        PdsApprovedVendorList         approvedVendorList;
        FormDataSource                 InventTable_ds = sender.datasource();
        InventTable                   inventTable     = InventTable_ds.cursor();
        EcoResProductLifecycleState   productLifeCycleState = EcoResProductLifecycleState::find(inventTable.ProductLifecycleStateId);
        CorollaryTable            corollaryTable ;
        boolean             ret;
        while select * from corollaryTable where corollaryTable.StateId == productLifeCycleState.StateId
        {
            if(corollaryTable)
            {
                select Name from tableId where tableId.Id == corollaryTable.TableNum;
                switch (tableId.Name)
                {
                    case "EcoResProductCategory" :
                        select Product from productCategory where productCategory.Product == InventTable.Product;
                        if(!productCategory)
                        {
                            ret = checkFailed("La table "+corollaryTable.TableLabel+ " n'est pas renseignée !");
                            args.cancel(true);

                        }
                        break;

                    case "PdsApprovedVendorList" :
                        select ItemId from approvedVendorList where approvedVendorList.ItemId == InventTable.ItemId;
                        if(!approvedVendorList)
                        {
                            ret = checkFailed("La table "+corollaryTable.TableLabel+ " n'est pas renseignée !");
                            args.cancel(true);
                        }
                        break;

                }
            }

        }
     
    }
I get the new selected value ,

but I want to keep the old value of this field ,


Viewing all articles
Browse latest Browse all 17532

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>