예제 #1
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="persistence">
 /// The entity persistence.
 /// </param>
 /// <param name="tree">
 /// The tree controller.
 /// </param>
 /// <param name="helper">
 /// The folder helper.
 /// </param>
 public FormHelper(IEntityPersistence persistence, TreeController tree, FolderHelper helper)
 {
     Persistence = persistence;
     Tree = tree;
     Helper = helper;
 }
 public EntityWebEventArgs(IListDeleteRegister entityManager, IEntityPersistence entity, string pageName)
     : this(entityManager, entity, pageName, null)
 {
 }
예제 #3
0
 private bool isCorrectTypeEntity(IEntityPersistence entity)
 {
     return(entitySource == entity.GetType().Name);
 }
예제 #4
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public EntitiesController(IEntityPersistence entityPersistence, IEntityHelper entityHelper)
 {
     Entities     = entityPersistence;
     EntityHelper = entityHelper;
 }
예제 #5
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public ValidationsController(UmbracoContext context)
     : base(context)
 {
     Persistence = ValidationPersistence.Current.Manager;
     Entities    = EntityPersistence.Current.Manager;
 }
예제 #6
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public FoldersController(UmbracoContext context)
     : base(context)
 {
     Persistence = FolderPersistence.Current.Manager;
     Entities    = EntityPersistence.Current.Manager;
 }
예제 #7
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="persistence">
 /// The entity persistence.
 /// </param>
 /// <param name="tree">
 /// The tree controller.
 /// </param>
 public FolderHelper(IEntityPersistence persistence,
                     TreeController tree)
 {
     Persistence = persistence;
     Tree        = tree;
 }
예제 #8
0
        public void SetValuePropertyEntity(IEntityPersistence entity, string propertyName, object value)
        {
            if (propertyName == string.Empty)
            {
                return;
            }

            PropertyInfo propertyInfo = GetPropertyInfo(entity, propertyName);

            if (propertyInfo == null)
            {
                return;
            }

            Type typeProperty = propertyInfo.PropertyType;

            if (typeProperty.Name.ToLower() == "nullable`1" && value != null)
            {
                if (value.ToString().Trim() != string.Empty)
                {
                    typeProperty = Nullable.GetUnderlyingType(typeProperty);
                }
                else
                {
                    value = null;
                }
            }

            try
            {
                switch (typeProperty.Name.ToLower())
                {
                case "string": propertyInfo.SetValue(entity, (value != null ? value.ToString() : string.Empty), null); break;

                case "int16":
                case "int32":
                case "int64": propertyInfo.SetValue(entity, Convert.ToInt32(value), null); break;

                case "boolean": propertyInfo.SetValue(entity, Convert.ToBoolean(value), null); break;

                case "datetime": propertyInfo.SetValue(entity, Convert.ToDateTime(value), null); break;

                case "decimal": propertyInfo.SetValue(entity, Convert.ToDecimal(value), null); break;

                default: propertyInfo.SetValue(entity, value, null); break;
                }
            }
            catch (TargetInvocationException E)
            {
                if (E.InnerException is PropertyException)
                {
                    throw new PropertyException(((PropertyException)E.InnerException).Property, E.InnerException.Message);
                }
            }
            catch (PropertyException E)
            {
                throw new PropertyException(E.Message);
            }
            catch (FormatException E)
            {
                string displayProperty = string.Empty;

                DisplayNamePropertyAttribute attributo = GetAttribute(propertyInfo, typeof(DisplayNamePropertyAttribute)) as DisplayNamePropertyAttribute;

                if (attributo != null)
                {
                    displayProperty = attributo.DisplayName;
                }
                else
                {
                    displayProperty = propertyInfo.Name;
                }

                throw new PropertyException(new Property(propertyInfo.Name, value), "O campo " + displayProperty + " está com valor inválido !", E);
            }
        }
예제 #9
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public FoldersController(UmbracoContext context)
     : base(context)
 {
     Persistence = FolderPersistence.Current.Manager;
     Entities = EntityPersistence.Current.Manager;
 }
예제 #10
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public DataValuesController(IDataValuePersistence dataValuePersistence, IEntityPersistence entityPersistence, DataValueKindCollection dataValueKindCollection)
 {
     Persistence             = dataValuePersistence;
     Entities                = entityPersistence;
     DataValueKindCollection = dataValueKindCollection;
 }
예제 #11
0
 public EntityRepository(IConfigurationSettings configuration, IEntityPersistence <T> persistence, IPasswordManagement passwordManagement)
 {
     _configuration      = configuration;
     _persistence        = persistence;
     _passwordManagement = passwordManagement;
 }
예제 #12
0
 public EntityWebEventArgs(IListDeleteRegister entityManager, IEntityPersistence entity, IList listSource)
     : base(entityManager, entity, listSource)
 {
 }
예제 #13
0
 public EntityWebEventArgs(IListDeleteRegister entityManager, IEntityPersistence entity)
     : base(entityManager, entity)
 {
 }
예제 #14
0
 public static void Execute(IEntityPersistence entity, IComponent parent)
 {
     Execute(entity, parent, true);
 }
예제 #15
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public LayoutsController(UmbracoContext context)
     : base(context)
 {
     Persistence = LayoutPersistence.Current.Manager;
     Entities = EntityPersistence.Current.Manager;
 }
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public ValidationsController(UmbracoContext context)
     : base(context)
 {
     Persistence = ValidationPersistence.Current.Manager;
     Entities = EntityPersistence.Current.Manager;
 }
예제 #17
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public ConfiguredFormsController(UmbracoContext context)
     : base(context)
 {
     Persistence = ConfiguredFormPersistence.Current.Manager;
     Entities    = EntityPersistence.Current.Manager;
 }
예제 #18
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="entityPersistence">
 /// The entity Persistence.
 /// </param>
 /// <param name="validationPersistence">
 /// The validation Persistence.
 /// </param>
 public ValidationsController(IEntityPersistence entityPersistence, IValidationPersistence validationPersistence)
 {
     Persistence = validationPersistence;
     Entities    = entityPersistence;
 }
예제 #19
0
 public static IEnumerable <T> GetByIds <T>(this IEntityPersistence service, IEnumerable <long> ids)
     where T : Entity
 {
     return(service.GetByIds <T>(ids));
 }
예제 #20
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public ConfiguredFormsController(IConfiguredFormPersistence configuredFormPersistence, IEntityPersistence entityPersistence)
 {
     Persistence = configuredFormPersistence;
     Entities    = entityPersistence;
 }
예제 #21
0
 public static IEnumerable <T> GetByIds <T>(this IEntityPersistence service, IEnumerable <int> ids)
     where T : Entity
 {
     return(service.GetByIds <T>(ids.ToInt64s()));
 }
예제 #22
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public CloudController(UmbracoContext context)
     : base(context)
 {
     Entities = EntityPersistence.Current.Manager;
 }
예제 #23
0
 public static PagedDataResult <T> GetByIdsPaged <T>(this IEntityPersistence service, IEnumerable <long> ids, IPagedDataRequestSource source)
     where T : Entity
 {
     //var asObjects = CastIds(set);
     return(service.GetByIdsPaged <T>(ids, source));
 }
예제 #24
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public LayoutsController(UmbracoContext context)
     : base(context)
 {
     Persistence = LayoutPersistence.Current.Manager;
     Entities    = EntityPersistence.Current.Manager;
 }
예제 #25
0
 public static PagedDataResult <T> GetByIdsPaged <T>(this IEntityPersistence service, IEnumerable <int> ids, IPagedDataRequestSource source)
     where T : Entity
 {
     return(service.GetByIdsPaged <T>(ids.ToInt64s(), source));
 }
예제 #26
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public DataValuesController(UmbracoContext context)
     : base(context)
 {
     Persistence = DataValuePersistence.Current.Manager;
     Entities    = EntityPersistence.Current.Manager;
 }
예제 #27
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="context">Umbraco context.</param>
 public EntitiesController(UmbracoContext context)
     : base(context)
 {
     Entities = EntityPersistence.Current.Manager;
 }
예제 #28
0
 /// <summary>
 /// Primary constructor.
 /// </summary>
 /// <param name="persistence">
 /// The entity persistence.
 /// </param>
 /// <param name="tree">
 /// The tree controller.
 /// </param>
 public FolderHelper(IEntityPersistence persistence,
     TreeController tree)
 {
     Persistence = persistence;
     Tree = tree;
 }
예제 #29
0
 public virtual void SetDataSource(IEntityPersistence entity)
 {
 }