Status | ID | Priority | Type |
Closed | 35661 | Major | Question |
Profile | Reply |
gabossoloClient | Hello -- Please help me on how to validate BusinessOperation parameters... Thank you |
User | Description | Posted On |
MariyaVoytovichAgent | Hello gabossolo! I apologize for the delayed response. To validate the parameters of a BusinessOperation, you need to create your own BOMethodRunner. public class ValidateBOMethodRunnerExecute : BOMethodRunnerExecute { public ValidateBOMethodRunnerExecute(XafApplication application) : base(application) { }public override void Run(BusinessOperationAction createResultViewParameters, IBusinessOperation businessOperation, ShowViewParameters showViewParameters) { base.Run(createResultViewParameters, businessOperation, showViewParameters);if (showViewParameters.CreatedView != null) { var dialogController = showViewParameters.Controllers.OfType().FirstOrDefault(); if (dialogController == null) { dialogController = Application.CreateController(); showViewParameters.Controllers.Add(dialogController); }dialogController.Accepting += (sender, args) => { var controller = sender as DialogController; RuleSetValidationResult result = Validator.RuleSet.ValidateTarget(this.Application.CreateObjectSpace(), controller.Frame.View.CurrentObject, ContextIdentifier.Save); if (result.ValidationOutcome > ValidationOutcome.Information) args.Cancel = true; else MyRunOperationCore(createResultViewParameters, businessOperation, args.ShowViewParameters); }; } } Add a controller to customize the BusinessOperationCustomExecute event. To more information see Business Operations. Executing Events and Customization. public class CustomizeBusinessOperationsController : ViewController { private BOExecViewController _boExecViewController;protected override void OnActivated() { base.OnActivated(); _boExecViewController = Frame.GetController(); if (_boExecViewController != null) { // Subscribing to handling of controller's events for specific business operations. _boExecViewController.BOEvents[typeof(TargetBO)].BusinessOperationCustomExecute += CustomizeBusinessOperationsController_BusinessOperationCustomExecute; } } Feel free to contact us if you need further assistance or have additional questions. Regards, |