How to cancel a new child added inside a BO

How to cancel a new child added inside a BO

Old forum URL: forums.lhotka.net/forums/t/8498.aspx


programmingperu posted on Tuesday, February 09, 2010

Hi

I have the following BO:

public class FixedAssetChild : Csla.BusinessBase<FixedAssetChild>

This class has the following properties:

private static PropertyInfo<FixedAssetSupplyChildList> SupplyListProperty = RegisterProperty<FixedAssetSupplyChildList>(typeof(FixedAssetChild), new PropertyInfo<FixedAssetSupplyChildList>("SupplyList"));

private static PropertyInfo<FixedAssetDepreciationChildList> DepreciationListProperty = RegisterProperty<FixedAssetDepreciationChildList>(typeof(FixedAssetChild), new PropertyInfo<FixedAssetDepreciationChildList>("DepreciationList"));

I have a GridView with a datasource filled by SupplyList, I need to validate that the user can't add new Supplies to the SupplyList if DepreciationList = 0 or if some elements of DepreciationList has certain values. Where is the best place to add this validation and how can I return the error message to the UI?

How can I cancel a new item added inside a BO?

I think I have to validate it in SupplyChild but I'm not sure how to implement it. 

Thanks in advance!

 

Copyright (c) Marimer LLC