示例#1
0
        public void SetValue(DomainEntityType source)
        {
            if (source.HasAttributes(EnumAttributes.filter))
            {
                return;
            }

            _refFilter.SetAttribute(source);
        }
示例#2
0
        public void SetValue(DomainEntityType source
                             , IDomainActionFilter filter
                             , IEnumerable <IFilterKeyPair> filters)
        {
            if (_refFilter == null)
            {
                _refFilter = filter;
            }

            _refFilter.SetAttribute(source, filters);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="THandler"></typeparam>
        /// <param name="Handler"></param>
        /// <param name="EntityType"></param>
        /// <param name="propName"></param>
        /// <returns></returns>
        public static void SetPropValues <THandler>(this THandler Handler, DomainEntityType EntityType, string propName)
            where THandler : IServiceHandler
        {
            List <IEntity> resList = new List <IEntity>(((dynamic)Handler).Get());

            //foreach (var res in (((dynamic)Handler).Get()))
            //{
            //    resList.Add(res as IBaseEntity);
            //}

            resList.AsQueryable().SetPropValues(EntityType, propName);
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="propValues"></param>
        /// <param name="Entity"></param>
        /// <param name="propName"></param>
        public static void SetPropValues <T>(this IQueryable <T> propValues
                                             , DomainEntityType Entity
                                             , string propName //PropKeyPairFieldDef propKeyPair
                                             )
            where T : class, IEntity                           //    BaseEntity<T>
        {
            if (Entity.Attributes == null)
            {
                Entity.Attributes = new ExpandoObject();
            }

            var propList = new List <PropListKeyPair>();

            foreach (var fil in propValues)
            {
                var value = default(dynamic);

                var key = fil
                          .GetType()
                          .GetProperty("Id")
                          .GetValue(fil, null);

                var prop = fil
                           .GetType()
                           .GetProperty(propName);

                if (typeof(DomainEntityType).IsAssignableFrom(prop.PropertyType))
                {
                    value = ((dynamic)prop
                             .GetValue(fil, null)).Value;
                }
                else
                {
                    value = prop
                            .GetValue(fil, null);
                }

                propList.Add(
                    new PropListKeyPair()
                {
                    Key     = key.ToString()
                    , Value = value
                }

                    );
            }

            dynamic attr = new ExpandoObject();

            ((IDictionary <String, Object>)Entity.Attributes)["propList"] = propList;
        }
示例#5
0
        public static bool SetValue(this IEnumerable <IFilterKeyPair> filterValues
                                    , DomainEntityType Entity)
        {
            if (filterValues == null)
            {
                return(false);
            }

            var filterKeyPair = GetServiceType <IFilterKeyPair>() as IFilterKeyPair;
            var actionFilter  = GetServiceType <IDomainActionFilter>();

            filterKeyPair.SetValue(Entity, actionFilter, filterValues);
            return(true);
        }
示例#6
0
 public override IEnumerable <string> GetValue(DomainEntityType Entity)
 {
     throw new System.NotImplementedException();
 }
示例#7
0
 public IEnumerable <IFilterKeyPair> GetFilterValues(DomainEntityType source)
 {
     SetValue(source);
     return(source.Attributes.Filter.Filters);
 }
示例#8
0
 public void SetAttribute(DomainEntityType source, IEnumerable <IFilterKeyPair> filters)
 {
     throw new NotImplementedException();
 }
示例#9
0
 public void SetAttribute(DomainEntityType source)
 {
     throw new NotImplementedException();
 }
示例#10
0
 public static IEnumerable <IFilterKeyPair> GetValue(this IFilterKeyPair filter
                                                     , DomainEntityType Entity)
 {
     return(filter.GetFilterValues(Entity));
 }
示例#11
0
 public abstract IEnumerable <string> GetValue(DomainEntityType Entity);