void OnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs logicRuleExecuteEventArgs) {
            var logicRuleInfo = logicRuleExecuteEventArgs.LogicRuleInfo;
            var rule = logicRuleInfo.Rule as IActionStateRule;
            if (rule!=null) {
                foreach (ActionBase actionBase in GetActions(rule)) {
                    switch (rule.ActionState) {
                        case ActionState.ForceActive: {
                            actionBase.Active.Clear();
                            break;
                        }
                        case ActionState.Hidden:
                            ActivateDeActivateAction(logicRuleInfo, actionBase);
                            break;
                        case ActionState.Disabled:
                            EnableDisableAction(logicRuleInfo, actionBase);
                            break;
                        case ActionState.Executed: {
                            if (logicRuleInfo.Active) {
                                ExecuteAction(actionBase);
                            }
                        }
                            break;
                        case ActionState.ExecutedAndDisable:
                            ExecuteAndDisableAction(actionBase);
                            break;
                    }
                }
            }

        }
        void OnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs logicRuleExecuteEventArgs) {
            var info = logicRuleExecuteEventArgs.LogicRuleInfo;
            var additionalViewControlsRule = info.Rule as IAdditionalViewControlsRule;
            if (Frame != null && additionalViewControlsRule!=null) {
                var viewSiteTemplate = Frame.Template as IViewSiteTemplate;
                if (viewSiteTemplate == null)
                    return;
                
                object viewSiteControl = GetContainerControl(viewSiteTemplate, additionalViewControlsRule);
                if (viewSiteControl != null) {
                    var calculator = new AdditionalViewControlsProviderCalculator(additionalViewControlsRule, info.View.ObjectTypeInfo.Type);
                    Type controlType = calculator.ControlsRule.ControlType;
                    ICollection controls = GetControls(viewSiteControl);
                    IAdditionalViewControl additionalViewControl = FindControl(additionalViewControlsRule, controls);
                    if (info.Active && ViewContextIsCorrect(additionalViewControlsRule)) {

                        var control = GetControl(controlType, additionalViewControl, additionalViewControlsRule);
                        if (control != null) {
                            control.Rule = additionalViewControlsRule;
                            calculator.ControlsRule.DecoratorType.CreateInstance(new[] { info.View, (object)control, additionalViewControlsRule });
                            if (additionalViewControl == null) {
                                InitializeControl(control, additionalViewControlsRule, calculator, logicRuleExecuteEventArgs.ExecutionContext);
                                AddControl(control, controls, info);
                            }
                        }
                    } else if (additionalViewControl != null) {
                        controls.CallMethod("Remove", new object[]{additionalViewControl});
                    }
                }
            }

        }
        void LogicRuleViewControllerOnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs e) {
            LogicRuleInfo info = e.LogicRuleInfo;
            if (info.InvertCustomization)
                return;
            var objectViewRule = info.Rule as IObjectViewRule;
            if (objectViewRule!=null) {
                ExecutionContext executionContext = e.ExecutionContext;
                switch (executionContext) {
                    case ExecutionContext.None:
                        if (info.Active) {
                            ProcessActions(info, objectViewRule);
                        }
                        break;
                    case ExecutionContext.CustomProcessSelectedItem:
                        if (info.Active && objectViewRule.ObjectView is IModelListView) {
                            CustomProcessSelectedItem(info, objectViewRule);
                        }
                        break;
                    case ExecutionContext.CustomizeShowViewParameters:
                        if (info.Active&&objectViewRule.ObjectView is IModelDetailView) {
                            CustomizeShowViewParameters(info, objectViewRule);
                        }
                        break;
                    case ExecutionContext.CurrentObjectChanged:
                        if (View.Model.AsObjectView is IModelDetailView && objectViewRule.ObjectView is IModelDetailView&&View.ObjectTypeInfo!=null) {
                            var modelView = info.Active ? objectViewRule.ObjectView : GetDefaultObjectView();
                            if (modelView!=null){
                                Frame.GetController<ModelController>().SetView();
                            }
                        }
                        break;
                }

            }
        }
Beispiel #4
0
 protected virtual void OnLogicRuleExecuted(LogicRuleExecuteEventArgs args) {
     if (args.LogicRuleInfo.Rule.IsNew.HasValue)
         Evaluator.IsNew = false;
     if (LogicRuleExecuted != null) {
         LogicRuleExecuted(this, args);
     }
 }
Beispiel #5
0
 protected virtual void OnLogicRuleExecuted(LogicRuleExecuteEventArgs args)
 {
     if (args.LogicRuleInfo.Rule.IsNew.HasValue)
     {
         Evaluator.IsNew = false;
     }
     LogicRuleExecuted?.Invoke(this, args);
 }
Beispiel #6
0
        protected virtual void OnLogicRuleExecute(LogicRuleExecuteEventArgs e)
        {
            EventHandler <LogicRuleExecuteEventArgs> handler = LogicRuleExecute;

            if (handler != null)
            {
                handler(this, e);
            }
        }
 void LogicRuleExecutorOnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs logicRuleExecuteEventArgs) {
     var logicRuleInfo = logicRuleExecuteEventArgs.LogicRuleInfo;
     var auditTrailRule = logicRuleInfo.Rule as IAuditTrailRule;
     if (auditTrailRule != null) {
         if (!logicRuleInfo.InvertCustomization) {
             ApplyCustomization(auditTrailRule);
         } else {
             InvertCustomization(auditTrailRule);
         }
     }
 }
 private void LogicRuleExecutorOnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs e){
     var info = e.LogicRuleInfo;
     var controllerStateRule = info.Rule as IControllerStateRule;
     if (controllerStateRule != null) {
         if (!string.IsNullOrEmpty(controllerStateRule.Module)) {
             ChangeStateOnModules(info);
         }
         else
             ChangeState(controllerStateRule);
     }
 }
 void LogicRuleViewControllerOnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs logicRuleExecuteEventArgs) {
     var info = logicRuleExecuteEventArgs.LogicRuleInfo;
     var masterDetailRule = info.Rule as IMasterDetailRule;
     if (masterDetailRule!=null) {
         if (info.Active) {
             if (!(_masterDetailRules.Contains(masterDetailRule))) {
                 _masterDetailRules.Add(masterDetailRule);
             }
         }
         else {
             _masterDetailRules.Remove(masterDetailRule);
         }
     }
 }
 void LogicRuleExecutorOnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs logicRuleExecuteEventArgs) {
     var logicRuleInfo = logicRuleExecuteEventArgs.LogicRuleInfo;
     var auditTrailRule = logicRuleInfo.Rule as IAuditTrailRule;
     if (auditTrailRule != null) {
         ApplyCustomization(auditTrailRule);
         var auditingOptionsEventArgs = logicRuleInfo.EventArgs as CustomizeSessionAuditingOptionsEventArgs;
         if (auditingOptionsEventArgs != null){
             if (auditTrailRule.AuditingMode.HasValue)
                 auditingOptionsEventArgs.ObjectAuditingMode = (DevExpress.Persistent.AuditTrail.ObjectAuditingMode) auditTrailRule.AuditingMode.Value;
             auditingOptionsEventArgs.AuditTrailStrategy = auditTrailRule.AuditTrailStrategy;
         }
         var handledEventArgs = logicRuleInfo.EventArgs as HandledEventArgs;
         if (handledEventArgs != null) handledEventArgs.Handled = true;
     }
 }
 void LogicRuleExecutorOnLogicRuleExecute(object sender, LogicRuleExecuteEventArgs logicRuleExecuteEventArgs) {
     var logicRuleInfo = logicRuleExecuteEventArgs.LogicRuleInfo;
     var emailRule = logicRuleInfo.Rule as EmailRule;
     if (emailRule != null && !logicRuleInfo.InvertCustomization) {
         var modelApplicationEmail = (IModelApplicationEmail) Application.Model;
         var emailTemplateObject = EmailTemplateObject(modelApplicationEmail, emailRule, ObjectSpace);
         var modelSmtpClientContext = modelApplicationEmail.Email.SmtpClientContexts.First(emailTemplate => emailTemplate.GetValue<string>("Id") == emailRule.SmtpClientContext);
         var email = CreateEmail(logicRuleInfo, emailRule, modelSmtpClientContext,emailTemplateObject,modelApplicationEmail);
         if (email!=null) {
             var emailSender = new EmailSender{
                 CreateClientFactory =
                     () => new SmtpClientWrapper(CreateSmtpClient(modelSmtpClientContext))
             };
             emailSender.Send(email);
         }
     }
 }
 private void LogicRuleExecutorOnLogicRuleExecuted(object sender, LogicRuleExecuteEventArgs logicRuleExecuteEventArgs){
     var logicRuleInfo = logicRuleExecuteEventArgs.LogicRuleInfo;
     var auditTrailRule = logicRuleInfo.Rule as IAuditTrailRule;
     if (auditTrailRule != null){
         if (auditTrailRule.AuditPending.HasValue){
             _auditPending = auditTrailRule.AuditPending.Value;
         }
     }
 }
Beispiel #13
0
 protected virtual void OnLogicRuleExecute(LogicRuleExecuteEventArgs e) {
     EventHandler<LogicRuleExecuteEventArgs> handler = LogicRuleExecute;
     if (handler != null) handler(this, e);
 }
Beispiel #14
0
        protected virtual void OnLogicRuleExecute(LogicRuleExecuteEventArgs e)
        {
            EventHandler <LogicRuleExecuteEventArgs> handler = LogicRuleExecute;

            handler?.Invoke(this, e);
        }