示例#1
0
        private List <ActivityTep> GetDataPackageActivities(User user)
        {
            var etype = EntityType.GetEntityType(typeof(DataPackage));
            var priv  = Privilege.Get(EntityType.GetEntityTypeFromId(etype.Id), Privilege.GetOperationType(((char)EntityOperationType.View).ToString()));
            EntityList <ActivityTep> activities = new EntityList <ActivityTep>(Context);

            if (user != null)
            {
                activities.SetFilter("UserId", user.Id + "");
            }
            activities.SetFilter("EntityTypeId", etype.Id + "");
            activities.SetFilter("PrivilegeId", priv.Id + "");
            activities.Load();
            return(activities.GetItemsAsList());
        }
示例#2
0
        /// <summary>
        /// Froms the entity and privilege.
        /// </summary>
        /// <returns>The entity and privilege.</returns>
        /// <param name="context">Context.</param>
        /// <param name="entity">Entity.</param>
        /// <param name="operation">Operation.</param>
        public static new ActivityTep FromEntityAndPrivilege(IfyContext context, Entity entity, EntityOperationType operation)
        {
            var         etype  = EntityType.GetEntityType(entity.GetType());
            var         priv   = Privilege.Get(EntityType.GetEntityTypeFromId(etype.Id), Privilege.GetOperationType(((char)operation).ToString()));
            ActivityTep result = new ActivityTep(context);

            result.Entity       = entity;
            result.EntityTypeId = etype.Id;
            result.Privilege    = priv;
            result.Load();
            return(result);
        }