Exemplo n.º 1
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                ISelectItem selectItemItem = item.As <ISelectItem>();

                if (((selectItemItem != null) &&
                     this._parent.SelItems.Remove(selectItemItem)))
                {
                    return(true);
                }
                if ((this._parent.FromItem == item))
                {
                    this._parent.FromItem = null;
                    return(true);
                }
                IJoin joinItem = item.As <IJoin>();

                if (((joinItem != null) &&
                     this._parent.Joins.Remove(joinItem)))
                {
                    return(true);
                }
                if ((this._parent.WhereExp == item))
                {
                    this._parent.WhereExp = null;
                    return(true);
                }
                if ((this._parent.GroupBy == item))
                {
                    this._parent.GroupBy = null;
                    return(true);
                }
                return(false);
            }
Exemplo n.º 2
0
 public SelectItem(ISelectItem src = null)
 {
     if (src != null)
     {
         this.value = src.value;
         this.text  = src.text;
     }
 }
Exemplo n.º 3
0
        private static string Print(ISelectItem selectItem, IPlainSelect selectBody)
        {
            var expression = PrintExpression((dynamic)selectItem.Exp, selectBody);

            if (selectItem.Alias != null)
            {
                expression += " " + selectItem.Alias.Name;
            }
            return(expression);
        }
Exemplo n.º 4
0
        internal void NotifySelectItemRemoved(ISelectItem <TValue> selectItem)
        {
            if (selectItem == null)
            {
                return;
            }

            if (selectItems.Contains(selectItem))
            {
                selectItems.Remove(selectItem);
            }
        }
Exemplo n.º 5
0
        internal void NotifySelectItemInitialized(ISelectItem <TValue> selectItem)
        {
            if (selectItem == null)
            {
                return;
            }

            if (!selectItems.Contains(selectItem))
            {
                selectItems.Add(selectItem);
            }
        }
 public IEnumerable<ISelectItem> GetSelections(ExtendedMetadata metadata)
 {
     var allColors = Enum.GetValues(typeof(ProductColor));
     ISelectItem[] colorItems = new ISelectItem[allColors.Length-1];
     for (int i = 1; i < allColors.Length; i++)
     {
         var value =
             EPiServer.Framework.Localization.LocalizationService.Current.GetStringByCulture("/common/product/colors/" +
                                                                                             ((ProductColor)i).ToString(), ContentLanguage.PreferredCulture);
         colorItems[i-1] = new SelectItem() { Text = value, Value = value };
     }
     return colorItems;
 }
        //Will be called when initializing an editor with an existing value to get the corresponding text representation.
        public virtual ISelectItem GetItemByValue(string value)
        {
            ISelectItem current = _items.FirstOrDefault(i => i.Value.Equals(value));

            if (current != null)
            {
                return(current);
            }

            return(new SelectItem {
                Text = value, Value = value
            });
        }
Exemplo n.º 8
0
        public IEnumerable <ISelectItem> GetSelections(ExtendedMetadata metadata)
        {
            var allModes = Enum.GetValues(typeof(RecommendationsMode));

            ISelectItem[] colorItems = new ISelectItem[allModes.Length];
            for (int i = 0; i < allModes.Length; i++)
            {
                var value =
                    EPiServer.Framework.Localization.LocalizationService.Current.GetStringByCulture("/common/recommendations/mode/" +
                                                                                                    (RecommendationsMode)i, ContentLanguage.PreferredCulture);
                colorItems[i] = new SelectItem()
                {
                    Text = value, Value = value
                };
            }
            return(colorItems);
        }
Exemplo n.º 9
0
        public IEnumerable <ISelectItem> GetSelections(ExtendedMetadata metadata)
        {
            var allColors = Enum.GetValues(typeof(ProductColor));

            ISelectItem[] colorItems = new ISelectItem[allColors.Length - 1];
            for (int i = 1; i < allColors.Length; i++)
            {
                var value =
                    EPiServer.Framework.Localization.LocalizationService.Current.GetStringByCulture("/common/product/colors/" +
                                                                                                    (ProductColor)i, ContentLanguage.PreferredCulture);
                colorItems[i - 1] = new SelectItem()
                {
                    Text = value, Value = value
                };
            }
            return(colorItems);
        }
Exemplo n.º 10
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ISelectItem selItemsCasted = item.As <ISelectItem>();

                if ((selItemsCasted != null))
                {
                    this._parent.SelItems.Add(selItemsCasted);
                }
                if ((this._parent.FromItem == null))
                {
                    IFromItem fromItemCasted = item.As <IFromItem>();
                    if ((fromItemCasted != null))
                    {
                        this._parent.FromItem = fromItemCasted;
                        return;
                    }
                }
                IJoin joinsCasted = item.As <IJoin>();

                if ((joinsCasted != null))
                {
                    this._parent.Joins.Add(joinsCasted);
                }
                if ((this._parent.WhereExp == null))
                {
                    IExpression whereExpCasted = item.As <IExpression>();
                    if ((whereExpCasted != null))
                    {
                        this._parent.WhereExp = whereExpCasted;
                        return;
                    }
                }
                if ((this._parent.GroupBy == null))
                {
                    IGroupByElement groupByCasted = item.As <IGroupByElement>();
                    if ((groupByCasted != null))
                    {
                        this._parent.GroupBy = groupByCasted;
                        return;
                    }
                }
            }
Exemplo n.º 11
0
 public ItemController()
 {
     _selectItem = new SelectItem(db);
 }
Exemplo n.º 12
0
 public void Add(ISelectItem item)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 13
0
 public void Add(ISelectItem item)
 {
     throw new NotImplementedException();
 }