protected virtual void OnContextValidating(ContextValidatingEventArgs args) { if (ContextValidating != null) { ContextValidating(this, args); } }
void OnContextValidating(object sender, ContextValidatingEventArgs contextValidatingEventArgs) { if (contextValidatingEventArgs.Context == ContextIdentifier.Save.ToString()) { Validator.RuleSet.ValidationCompleted += RuleSetOnValidationCompleted; } }
private void controller_ContextValidating(object sender, ContextValidatingEventArgs e) { IPermission permission = ((IPersistentPermission)View.CurrentObject).Permission; if (!e.TargetObjects.Contains(permission)) { e.TargetObjects.Add(permission); } }
void ActionOnExecuted(object sender, ActionBaseEventArgs actionBaseEventArgs) { ValidationTargetObjectSelector deleteSelector = new ActionExecuteContextTargetObjectSelector(); SubscribeSelectorEvents(deleteSelector); var selectedObjects = ((SimpleActionExecuteEventArgs) actionBaseEventArgs).SelectedObjects; var context = actionBaseEventArgs.Action.Id; var deleteContextArgs = new ContextValidatingEventArgs(context, new ArrayList(selectedObjects)); OnContextValidating(deleteContextArgs); Validator.RuleSet.ValidateAll(deleteContextArgs.TargetObjects, context, CustomizeDeleteValidationException); }
void ActionOnExecuted(object sender, ActionBaseEventArgs actionBaseEventArgs) { if (View.ObjectTypeInfo.Type != typeof(ValidationResults)) { ValidationTargetObjectSelector deleteSelector = new ActionExecuteContextTargetObjectSelector(); SubscribeSelectorEvents(deleteSelector); var selectedObjects = ((SimpleActionExecuteEventArgs)actionBaseEventArgs).SelectedObjects; var context = actionBaseEventArgs.Action.Id; var contextValidatingEventArgs = new ContextValidatingEventArgs(context, new ArrayList(selectedObjects)); OnContextValidating(contextValidatingEventArgs); if (CanAccessDeletedObjects(context)) Validator.RuleSet.ValidateAll(contextValidatingEventArgs.TargetObjects, context, CustomizeDeleteValidationException); } }
void ActionOnExecuted(object sender, ActionBaseEventArgs actionBaseEventArgs) { if (View.ObjectTypeInfo.Type != typeof(ValidationResults)) { ValidationTargetObjectSelector deleteSelector = new ActionExecuteContextTargetObjectSelector(); SubscribeSelectorEvents(deleteSelector); var selectedObjects = ((SimpleActionExecuteEventArgs)actionBaseEventArgs).SelectedObjects; var context = actionBaseEventArgs.Action.Id; var contextValidatingEventArgs = new ContextValidatingEventArgs(context, new ArrayList(selectedObjects)); OnContextValidating(contextValidatingEventArgs); if (CanAccessDeletedObjects(context)) { Validator.RuleSet.ValidateAll(contextValidatingEventArgs.TargetObjects, context, CustomizeDeleteValidationException); } } }
private void ActionBaseOnExecuting(object sender, CancelEventArgs cancelEventArgs) { if (View != null && View.ObjectTypeInfo.Type != typeof(ValidationResults)) { var selector = CreateSaveContextTargetObjectSelector(); SubscribeSelectorEvents(selector); var selectedObjects = selector.GetObjectsToValidate(ObjectSpace, View.CurrentObject); var context = ((ActionBase)sender).Id; var contextValidatingEventArgs = new ContextValidatingEventArgs(context, new ArrayList(selectedObjects)); OnContextValidating(contextValidatingEventArgs); if (View.ObjectTypeInfo.IsPersistent && CanAccessDeletedObjects(context) && !_otherValidationContextFailed) { Validator.RuleSet.ValidateAll(ObjectSpace, contextValidatingEventArgs.TargetObjects, context, CustomizeDeleteValidationException); } } _otherValidationContextFailed = false; }
private void controller_ContextValidating(object sender, ContextValidatingEventArgs e) { IPermission permission = ((IPersistentPermission)View.CurrentObject).Permission; if (!e.TargetObjects.Contains(permission)) e.TargetObjects.Add(permission); }
void OnContextValidating(object sender, ContextValidatingEventArgs contextValidatingEventArgs) { if (contextValidatingEventArgs.Context==ContextIdentifier.Save.ToString()) { Validator.RuleSet.ValidationCompleted += RuleSetOnValidationCompleted; } }
protected virtual void OnContextValidating(ContextValidatingEventArgs args) { ContextValidating?.Invoke(this, args); }