public override void UpdateSelectItems()
        {
            Array enumValues = Enum.GetValues(typeof(T));

            SelectItems.Clear();
            foreach (object enumValue in enumValues)
            {
                string name        = enumValue.ToString();
                string displayName = name;
                if (enumValue is MatchOperator)
                {
                    displayName = GetOperatorDisplayName((MatchOperator)enumValue);
                }

                // TODO: get resource strings from tagged attributes for display name!
                if (ExclusiveItems == null)
                {
                    SelectItems.Add(new SelectItem(name, displayName, enumValue));
                }
                else if (!ExclusiveItems.Contains((T)enumValue))
                {
                    SelectItems.Add(new SelectItem(name, displayName, enumValue));
                }
            }
        }
        protected override async Task OnParametersSetAsync()
        {
            _renderFragments = new QueryDictionary <RenderFragment>();
            foreach (var column in GridComponent.Grid.Columns)
            {
                // Name must have a non empty value
                if (string.IsNullOrWhiteSpace(column.Name))
                {
                    column.Name = Guid.NewGuid().ToString();
                }

                if (column.CreateComponentType != null)
                {
                    VariableReference reference = new VariableReference();
                    Children.Add(column.Name, reference);
                    _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence,
                                                                                             GridComponent, column.CreateComponentType, column, Item, null, true, reference));
                }
            }
            _tabGroups = GridComponent.Grid.Columns
                         .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name)))
                         .Select(r => r.TabGroup).Distinct();

            foreach (var column in GridComponent.Grid.Columns)
            {
                if (((IGridColumn <T>)column).IsSelectColumn.IsSelectKey)
                {
                    var selectItem = await((IGridColumn <T>)column).SelectItemExpr(Item);
                    SelectItems.Add(column.Name, selectItem);
                }
            }

            _shouldRender = true;
        }
Ejemplo n.º 3
0
        public override void UpdateSelectItems()
        {
            SelectItems.Clear();
            string literalValue = Parent.TextDisplay;

            SelectItems.Add(new SelectItem(Properties.Resources.LiteralValue, literalValue, literalValue));
        }
        public override void UpdateSelectItems()
        {
            SelectItems.Clear();
            pathToSelectItemMap.Clear();
            RuleEditingContext context = Parent.RuleEditingContext;

            if (context == null)
            {
                return;
            }

            IEnumerable <NamedRule> namedRules = context.GetNamedRuleActivities();

            foreach (var namedRule in namedRules)
            {
                SelectItem newItem = new SelectItem(namedRule.Name, namedRule.DisplayName, namedRule);
                RulePoint  parent  = namedRule.Parent;
                // Build the hierarchy.
                HierarchicalSelectItem parentSelectItem = GetSelectItem(namedRule.Parent);
                parentSelectItem.Children.Add(newItem);
            }

            var    ruleManager = context.GetRuleSignature().Owner;
            string rootPath    = ruleManager.RootRulePoint.Path;

            if (pathToSelectItemMap.ContainsKey(rootPath))
            {
                var rootItem = pathToSelectItemMap[rootPath];
                foreach (var selectItem in rootItem.Children)
                {
                    SelectItems.Add(selectItem);
                }
            }
        }
Ejemplo n.º 5
0
        public override void UpdateSelectItems()
        {
            this.SelectItems.Clear();

            foreach (DynamicValue value in this.ValidValues)
            {
                SelectItems.Add(new SelectItem(value.ToString(), value.ToString(), value.Value));
            }
        }
Ejemplo n.º 6
0
        public ToDBCommand Select(Action <ToDBCommand> subQuery, string alias = null)
        {
            ToDBCommand cmd = new ToDBCommand();

            subQuery(cmd);
            SelectItems.Add(new SelectSubQuery {
                Alias = alias, SubQuery = cmd
            });
            return(this);
        }
Ejemplo n.º 7
0
 public ToDBCommand Select(params string[] columns)
 {
     foreach (var item in columns)
     {
         SelectItems.Add(new SelectItem {
             Item = item.Trim()
         });
     }
     return(this);
 }
        public override void UpdateSelectItems()
        {
            SelectItems.Clear();
            Type requiredType = this.GetOutputType();

            foreach (var item in _provider.ExpressionItems)
            {
                if (requiredType == null ||
                    requiredType == item.ValueType ||
                    item.ValueType.IsSubclassOf(requiredType) ||
                    requiredType == typeof(DynamicValue))
                {
                    SelectItems.Add(new SelectItem(item.Name, item.DisplayName, item));
                }
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 获得所有Select的列
 /// </summary>
 private void GetSelectColumnNames()
 {
     foreach (var colQuery in SelectQuery)
     {
         var colName = string.Empty;
         if (!string.IsNullOrWhiteSpace(colQuery))
         {
             var sql = colQuery.Trim();
             //单纯的 xxxx.xxxx 没有 As 没有 =
             colName = GetMatchedSelectColumn(sql);
         }
         if (!string.IsNullOrWhiteSpace(colName))
         {
             SelectItems.Add(colName);
         }
     }
 }
Ejemplo n.º 10
0
        public override void UpdateSelectItems()
        {
            SelectItems.Clear();
            RuleEditingContext context = Parent.RuleEditingContext;

            if (context == null)
            {
                return;
            }

            IEnumerable <ActivityEntry> activities = context.GetAvailableActivities();

            foreach (ActivityEntry item in activities)
            {
                SelectItems.Add(new SelectItem(item.Name, item.DisplayName, item));
            }
        }
Ejemplo n.º 11
0
        public override void UpdateSelectItems()
        {
            SelectItems.Clear();
            Type outputType = GetOutputType();

            if (outputType == null)
            {
                return;
            }
            RuleEditingContext context = Parent.RuleEditingContext;

            if (context == null)
            {
                return;
            }

            foreach (var function in context.GetFunctions(outputType).OrderBy(f => f.DisplayName))
            {
                SelectItems.Add(new SelectItem(function.Name, function.DisplayName, function));
            }
        }
Ejemplo n.º 12
0
        public override void UpdateSelectItems()
        {
            SelectItems.Clear();
            Type outputType = GetOutputType();

            if (outputType == null)
            {
                return;
            }

            RuleEditingContext context = Parent.RuleEditingContext;

            if (context == null)
            {
                return;
            }

            foreach (var _operator in context.GetOperators(outputType))
            {
                SelectItems.Add(new SelectItem(_operator.Name, _operator.DisplayName, _operator));
            }
        }
Ejemplo n.º 13
0
 public void AddSelectColumn(string selectColumn)
 {
     SelectItems.Add(selectColumn);
 }
Ejemplo n.º 14
0
        protected override async Task OnParametersSetAsync()
        {
            _renderFragments = new QueryDictionary <RenderFragment>();
            foreach (var column in GridComponent.Grid.Columns)
            {
                // Name must have a non empty value
                if (string.IsNullOrWhiteSpace(column.Name))
                {
                    column.Name = Guid.NewGuid().ToString();
                }

                if (((ICGridColumn)column).SubGrids != null)
                {
                    var values = ((ICGridColumn)column).GetSubGridKeyValues(Item);
                    var grid   = await((ICGridColumn)column).SubGrids(values.Values.ToArray(), true, true, true, true) as ICGrid;
                    grid.Direction   = GridComponent.Grid.Direction;
                    grid.FixedValues = values;
                    VariableReference reference = new VariableReference();
                    if (Children.ContainsKey(column.Name))
                    {
                        Children[column.Name] = reference;
                    }
                    else
                    {
                        Children.Add(column.Name, reference);
                    }
                    if (_renderFragments.ContainsKey(column.Name))
                    {
                        _renderFragments[column.Name] = CreateSubGridComponent(grid, reference);
                    }
                    else
                    {
                        _renderFragments.Add(column.Name, CreateSubGridComponent(grid, reference));
                    }
                }
                else if (column.UpdateComponentType != null)
                {
                    VariableReference reference = new VariableReference();
                    if (Children.ContainsKey(column.Name))
                    {
                        Children[column.Name] = reference;
                    }
                    else
                    {
                        Children.Add(column.Name, reference);
                    }
                    if (_renderFragments.ContainsKey(column.Name))
                    {
                        _renderFragments[column.Name] = GridCellComponent <T> .CreateComponent(_sequence,
                                                                                               GridComponent, column.UpdateComponentType, column, Item, null, true, reference);
                    }
                    else
                    {
                        _renderFragments.Add(column.Name, GridCellComponent <T> .CreateComponent(_sequence,
                                                                                                 GridComponent, column.UpdateComponentType, column, Item, null, true, reference));
                    }
                }
            }
            _tabGroups = GridComponent.Grid.Columns
                         .Where(r => !string.IsNullOrWhiteSpace(r.TabGroup) && _renderFragments.Keys.Any(s => s.Equals(r.Name)))
                         .Select(r => r.TabGroup).Distinct();

            if (((CGrid <T>)GridComponent.Grid).ButtonCrudComponents != null && ((CGrid <T>)GridComponent.Grid).ButtonCrudComponents.Count() > 0)
            {
                foreach (var key in ((CGrid <T>)GridComponent.Grid).ButtonCrudComponents.Keys)
                {
                    var buttonCrudComponent = ((CGrid <T>)GridComponent.Grid).ButtonCrudComponents.Get(key);
                    if ((buttonCrudComponent.UpdateMode != null && buttonCrudComponent.UpdateMode(Item)) ||
                        (buttonCrudComponent.UpdateModeAsync != null && await buttonCrudComponent.UpdateModeAsync(Item)) ||
                        (buttonCrudComponent.GridMode.HasFlag(GridMode.Update)))
                    {
                        _buttonCrudComponentVisibility.Add(key, true);
                    }
                    else
                    {
                        _buttonCrudComponentVisibility.Add(key, false);
                    }
                }
            }

            foreach (var column in GridComponent.Grid.Columns)
            {
                if (((IGridColumn <T>)column).IsSelectColumn.IsSelectKey)
                {
                    var selectItem = await((IGridColumn <T>)column).SelectItemExpr(Item);
                    SelectItems.Add(column.Name, selectItem);
                }
            }

            _shouldRender = true;
        }