protected virtual bool IsValidRule(ILogicRuleObject rule, View view, EventArgs eventArgs, ExecutionContext executionContext) { var detailView = view as DetailView; var viewEditMode = detailView != null ? detailView.ViewEditMode : (ViewEditMode?)null; return(view != null && IsValidRule(rule, new ViewInfo(view.Id, view is DetailView, view.IsRoot, view.ObjectTypeInfo, viewEditMode), eventArgs, executionContext)); }
protected virtual bool IsVailidExecutionContext(ILogicRuleObject rule, ExecutionContext executionContext, EventArgs eventArgs) { if (executionContext == ExecutionContext.ObjectSpaceObjectChanged) { return(rule.ObjectChangedPropertyNames.Contains(((ObjectChangedEventArgs)eventArgs).PropertyName)); } return(true); }
protected virtual bool TemplateContextGroupIsValid(ILogicRuleObject ruleObject) { var frameTemplateContext = ruleObject.FrameTemplateContext; if (frameTemplateContext!=FrameTemplateContext.All) { var templateContextStringValue = Frame.Context.ToString().TrimEnd("Context".ToCharArray()); var templateContext =(FrameTemplateContext) Enum.Parse(typeof (FrameTemplateContext), templateContextStringValue); return (frameTemplateContext | templateContext) == frameTemplateContext; } return true; }
void AddRuleCore(ITypeInfo typeInfo, ExecutionContext executionContext, ILogicRuleObject logicRuleObject) { var tuple = new Tuple <ITypeInfo, ExecutionContext>(typeInfo, executionContext); if (!Instance._rules.ContainsKey(tuple)) { Instance._rules.Add(tuple, new List <ILogicRuleObject>()); } Instance._rules[tuple].Add(logicRuleObject); }
protected virtual bool IsValidRule(ILogicRuleObject rule, ViewInfo viewInfo,EventArgs eventArgs,ExecutionContext executionContext){ var isValidViewId = IsValidViewId(viewInfo.ViewId, rule); var isValidNewObject = IsValidNewObject(rule); var isValidViewType = IsValidViewType(viewInfo, rule); var isValidNestedType = IsValidNestedType(rule, viewInfo); var isValidTypeInfo = IsValidTypeInfo(viewInfo, rule); var isValidViewEditMode = IsValidViewEditMode(viewInfo, rule); var templateContextGroupIsValid = TemplateContextGroupIsValid(rule); var viewIsRoot = ViewIsRoot(rule); var isVailidExecutionContext = IsVailidExecutionContext(rule,executionContext,eventArgs); return isValidViewId &&isValidNewObject&&isValidViewType && isValidNestedType && isValidTypeInfo&& isValidViewEditMode && templateContextGroupIsValid && viewIsRoot&&isVailidExecutionContext; }
protected virtual bool TemplateContextGroupIsValid(ILogicRuleObject ruleObject) { var frameTemplateContext = ruleObject.FrameTemplateContext; if (frameTemplateContext != FrameTemplateContext.All) { var templateContextStringValue = Frame.Context.ToString().TrimEnd("Context".ToCharArray()); var templateContext = (FrameTemplateContext)Enum.Parse(typeof(FrameTemplateContext), templateContextStringValue); return((frameTemplateContext | templateContext) == frameTemplateContext); } return(true); }
protected virtual bool IsValidRule(ILogicRuleObject rule, ViewInfo viewInfo, EventArgs eventArgs, ExecutionContext executionContext) { var isValidViewId = IsValidViewId(viewInfo.ViewId, rule); var isValidNewObject = IsValidNewObject(rule); var isValidViewType = IsValidViewType(viewInfo, rule); var isValidNestedType = IsValidNestedType(rule, viewInfo); var isValidTypeInfo = IsValidTypeInfo(viewInfo, rule); var isValidViewEditMode = IsValidViewEditMode(viewInfo, rule); var templateContextGroupIsValid = TemplateContextGroupIsValid(rule); var viewIsRoot = ViewIsRoot(rule); var isVailidExecutionContext = IsVailidExecutionContext(rule, executionContext, eventArgs); return(isValidViewId && isValidNewObject && isValidViewType && isValidNestedType && isValidTypeInfo && isValidViewEditMode && templateContextGroupIsValid && viewIsRoot && isVailidExecutionContext); }
protected virtual bool IsValidDCTypeInfo(ViewInfo viewInfo, ILogicRuleObject rule) { if (viewInfo.ObjectTypeInfo.IsDomainComponent) { var entityType = XpoTypesInfoHelper.GetXpoTypeInfoSource().GetGeneratedEntityType(viewInfo.ObjectTypeInfo.Type); var types = new List <Type> { entityType }; while (entityType != null && entityType != typeof(object)) { entityType = entityType.BaseType; types.Add(entityType); } return(types.Contains(rule.TypeInfo.Type)); } return(true); }
protected virtual bool IsValidViewId(string viewId, ILogicRuleObject rule) { return rule.View != null ? viewId == rule.View.Id : !rule.Views.Any() || rule.Views.Contains(viewId); }
protected virtual bool IsValidViewId(string viewId, ILogicRuleObject rule) { return(rule.View != null ? viewId == rule.View.Id : !rule.Views.Any() || rule.Views.Contains(viewId)); }
protected virtual bool IsValidTypeInfo(ViewInfo viewInfo, ILogicRuleObject rule) { return(rule.TypeInfo.Type == typeof(AllViews) || ((rule.TypeInfo != null && rule.TypeInfo.IsAssignableFrom(viewInfo.ObjectTypeInfo)) || IsValidDCTypeInfo(viewInfo, rule)) || rule.TypeInfo == null); }
protected virtual bool IsValidDCTypeInfo(ViewInfo viewInfo, ILogicRuleObject rule) { if (viewInfo.ObjectTypeInfo.IsDomainComponent) { var entityType = XpoTypesInfoHelper.GetXpoTypeInfoSource().GetGeneratedEntityType(viewInfo.ObjectTypeInfo.Type); var types = new List<Type> { entityType }; while (entityType != null && entityType != typeof(object)) { entityType = entityType.BaseType; types.Add(entityType); } return types.Contains(rule.TypeInfo.Type); } return true; }
protected virtual bool IsValidRule(ILogicRuleObject rule, View view) { var viewEditMode = view is DetailView ? ((DetailView)view).ViewEditMode : (ViewEditMode?)null; return view != null && IsValidRule(rule, new ViewInfo(view.Id, view is DetailView, view.IsRoot, view.ObjectTypeInfo, viewEditMode)); }
bool IsValidNewObject(ILogicRuleObject rule) { return(!rule.IsNew.HasValue || (rule.IsNew.Value ? IsNew : !IsNew)); }
protected virtual bool IsValidViewEditMode(ViewInfo viewInfo, ILogicRuleObject rule) { return(!rule.ViewEditMode.HasValue || viewInfo.ViewEditMode == rule.ViewEditMode); }
protected virtual bool IsValidRule(ILogicRuleObject rule, ViewInfo viewInfo) { return (IsValidViewId(viewInfo.ViewId, rule)) &&IsValidNewObject(rule)&& IsValidViewType(viewInfo, rule) && IsValidNestedType(rule, viewInfo) && IsValidTypeInfo(viewInfo, rule) && IsValidViewEditMode(viewInfo, rule) && TemplateContextGroupIsValid(rule) && ViewIsRoot(rule); }
protected virtual bool IsValidRule(ILogicRuleObject rule, View view, EventArgs eventArgs, ExecutionContext executionContext) { var viewEditMode = view is DetailView ? ((DetailView)view).ViewEditMode : (ViewEditMode?)null; return view != null && IsValidRule(rule, new ViewInfo(view.Id, view is DetailView, view.IsRoot, view.ObjectTypeInfo, viewEditMode),eventArgs,executionContext); }
public virtual bool Fit(object targetObject, ILogicRuleObject logicRule) { var criteria = CriteriaOperator.Parse(logicRule.NormalCriteria); return(targetObject != null?criteria.Fit(targetObject) : CriteriaOperator.Parse(logicRule.EmptyCriteria).Fit(new object())); }
protected virtual bool IsValidTypeInfo(ViewInfo viewInfo, ILogicRuleObject rule) { return (((rule.TypeInfo != null && rule.TypeInfo.IsAssignableFrom(viewInfo.ObjectTypeInfo)) || IsValidDCTypeInfo(viewInfo, rule)) || rule.TypeInfo == null); }
protected virtual bool IsValidNestedType(ILogicRuleObject rule, ViewInfo viewInfo) { return(viewInfo.IsDetailView || (rule.Nesting == Nesting.Any || viewInfo.IsRoot)); }
protected virtual bool ViewIsRoot(ILogicRuleObject ruleObject) { return !(ruleObject.IsRootView.HasValue) || ruleObject.IsRootView == Frame.View.IsRoot; }
public virtual bool Fit(object targetObject, ILogicRuleObject logicRule) { var criteria = CriteriaOperator.Parse(logicRule.NormalCriteria); return targetObject != null ? criteria.Fit(targetObject) : string.IsNullOrEmpty(logicRule.EmptyCriteria) || CriteriaOperator.Parse(logicRule.EmptyCriteria).Fit(new object()); }
protected virtual bool IsValidViewType(ViewInfo viewInfo, ILogicRuleObject rule) { return (rule.ViewType == ViewType.Any || (viewInfo.IsDetailView ? rule.ViewType == ViewType.DetailView : rule.ViewType == ViewType.ListView)); }
protected virtual bool IsValidNestedType(ILogicRuleObject rule, ViewInfo viewInfo) { return viewInfo.IsDetailView || (rule.Nesting == Nesting.Any || viewInfo.IsRoot); }
protected virtual bool IsValidViewType(ViewInfo viewInfo, ILogicRuleObject rule) { return(rule.ViewType == ViewType.Any || (viewInfo.IsDetailView ? rule.ViewType == ViewType.DetailView : rule.ViewType == ViewType.ListView)); }
protected virtual bool IsVailidExecutionContext(ILogicRuleObject rule, ExecutionContext executionContext, EventArgs eventArgs){ if (executionContext == ExecutionContext.ObjectSpaceObjectChanged){ return rule.ObjectChangedPropertyNames.Contains(((ObjectChangedEventArgs) eventArgs).PropertyName); } return true; }
protected virtual bool ViewIsRoot(ILogicRuleObject ruleObject) { return(!(ruleObject.IsRootView.HasValue) || ruleObject.IsRootView == Frame.View.IsRoot); }
bool IsValidNewObject(ILogicRuleObject rule) { return !rule.IsNew.HasValue || (rule.IsNew.Value ? IsNew : !IsNew); }
protected virtual bool IsValidViewEditMode(ViewInfo viewInfo, ILogicRuleObject rule) { return !rule.ViewEditMode.HasValue || viewInfo.ViewEditMode == rule.ViewEditMode; }
protected virtual bool IsValidRule(ILogicRuleObject rule, ViewInfo viewInfo, EventArgs eventArgs, ExecutionContext executionContext) { return((IsValidViewId(viewInfo.ViewId, rule)) && IsValidNewObject(rule) && IsValidViewType(viewInfo, rule) && IsValidNestedType(rule, viewInfo) && IsValidTypeInfo(viewInfo, rule) && IsValidViewEditMode(viewInfo, rule) && TemplateContextGroupIsValid(rule) && ViewIsRoot(rule) && IsVailidExecutionContext(rule, executionContext, eventArgs)); }