예제 #1
0
 protected virtual void OnContextValidating(ContextValidatingEventArgs args)
 {
     if (ContextValidating != null)
     {
         ContextValidating(this, args);
     }
 }
예제 #2
0
 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);
     }
 }
예제 #6
0
 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);
         }
     }
 }
예제 #7
0
 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;
 }
 protected virtual void OnContextValidating(ContextValidatingEventArgs args) {
     if (ContextValidating != null) {
         ContextValidating(this, args);
     }
 }
 private void controller_ContextValidating(object sender, ContextValidatingEventArgs e)
 {
     IPermission permission = ((IPersistentPermission)View.CurrentObject).Permission;
     if (!e.TargetObjects.Contains(permission))
         e.TargetObjects.Add(permission);
 }
예제 #10
0
 void OnContextValidating(object sender, ContextValidatingEventArgs contextValidatingEventArgs) {
     if (contextValidatingEventArgs.Context==ContextIdentifier.Save.ToString()) {
         Validator.RuleSet.ValidationCompleted += RuleSetOnValidationCompleted;
     }
 }
예제 #11
0
 protected virtual void OnContextValidating(ContextValidatingEventArgs args)
 {
     ContextValidating?.Invoke(this, args);
 }