Example #1
0
 /// <summary>
 /// Gets the customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="profileId">The profile id.</param>
 /// <returns></returns>
 private static CustomizationItemEntity GetCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId? profileId)
 {
     return GetCustomizationItem(fullId, structureType, commandType, profileId, null);
 }
Example #2
0
        /// <summary>
        /// Gets the customization item.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        private static CustomizationItemEntity GetCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
        {
            CustomizationItemEntity result = null;

            FilterElementCollection filters = new FilterElementCollection();
            filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldXmlFullId, fullId));
            filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldStructureType, (int)structureType));
            filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldCommandType, (int)commandType));

            // Filter by profile
            if (profileId.HasValue)
                filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldProfileId, profileId.Value));
            else
                filters.Add(FilterElement.IsNullElement(CustomizationItemEntity.FieldProfileId));

            // Filter by principal
            if (principalId.HasValue)
                filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldPrincipalId, principalId.Value));
            else
                filters.Add(FilterElement.IsNullElement(CustomizationItemEntity.FieldPrincipalId));

            EntityObject[] items = BusinessManager.List(CustomizationItemEntity.ClassName, filters.ToArray());

            if (items != null && items.Length > 0)
            {
                result = items[0] as CustomizationItemEntity;
            }

            return result;
        }
Example #3
0
 /// <summary>
 /// Creates the navigation item by parent.
 /// </summary>
 /// <param name="structureType">Type of the structure.</param>
 /// <param name="parentFullId">The parent full id.</param>
 /// <param name="commandType">Type of the command.</param>
 /// <param name="profileId">The profile id.</param>
 /// <param name="principalId">The principal id.</param>
 /// <returns></returns>
 private static CustomizationItemEntity CreateCustomizationItemByParent(string parentFullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
 {
     string fullId = string.Concat(parentFullId, "/", Guid.NewGuid().ToString("D"));
     return CreateCustomizationItem(fullId, structureType, commandType, profileId, principalId);
 }
Example #4
0
 /// <summary>
 /// Gets the customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <returns></returns>
 private static CustomizationItemEntity GetCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType)
 {
     return GetCustomizationItem(fullId, structureType, commandType, null, null);
 }
Example #5
0
        /// <summary>
        /// Gets the customization item arguments.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="commandType">Type of the command.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        public static Dictionary<string, CustomizationItemArgumentEntity> GetCustomizationItemArguments(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
        {
            CustomizationItemEntity item = GetCustomizationItem(fullId, structureType, commandType, profileId, principalId);

            if (item != null && item.PrimaryKeyId.HasValue)
            {
                return GetCustomizationItemArguments(item.PrimaryKeyId.Value);
            }

            return null;
        }
Example #6
0
        /// <summary>
        /// Creates the navigation item.
        /// </summary>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="fullId">The full id.</param>
        /// <param name="commandType">Type of the command.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        private static CustomizationItemEntity CreateCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
        {
            CustomizationItemEntity item = BusinessManager.InitializeEntity<CustomizationItemEntity>(CustomizationItemEntity.ClassName);

            if (structureType != CustomizationStructureType.Undefined)
            {
                item.StructureType = (int)structureType;
            }
            item.XmlFullId = fullId;
            if (profileId.HasValue)
                item.Properties["ProfileId"].Value = profileId;
            if (principalId.HasValue)
                item.Properties["PrincipalId"].Value = principalId;

            item.CommandType = (int)commandType;

            item.PrimaryKeyId = BusinessManager.Create(item);

            return item;
        }
Example #7
0
 /// <summary>
 /// Gets the customization item arguments.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="structureType">Type of the structure.</param>
 /// <param name="commandType">Type of the command.</param>
 /// <returns></returns>
 public static Dictionary<string, CustomizationItemArgumentEntity> GetCustomizationItemArguments(string fullId, CustomizationStructureType structureType, ItemCommandType commandType)
 {
     return GetCustomizationItemArguments(fullId, structureType, commandType, null, null);
 }
Example #8
0
 /// <summary>
 /// Gets the customization item arguments.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="structureType">Type of the structure.</param>
 /// <param name="commandType">Type of the command.</param>
 /// <param name="profileId">The profile id.</param>
 /// <returns></returns>
 public static Dictionary<string, CustomizationItemArgumentEntity> GetCustomizationItemArguments(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId? profileId)
 {
     return GetCustomizationItemArguments(fullId, structureType, commandType, profileId, null);
 }
Example #9
0
 /// <summary>
 /// Gets the customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="profileId">The profile id.</param>
 /// <returns></returns>
 private static CustomizationItemEntity GetCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId?profileId)
 {
     return(GetCustomizationItem(fullId, structureType, commandType, profileId, null));
 }
Example #10
0
        /// <summary>
        /// Gets the customization item.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        private static CustomizationItemEntity GetCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId?profileId, PrimaryKeyId?principalId)
        {
            CustomizationItemEntity result = null;

            FilterElementCollection filters = new FilterElementCollection();

            filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldXmlFullId, fullId));
            filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldStructureType, (int)structureType));
            filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldCommandType, (int)commandType));

            // Filter by profile
            if (profileId.HasValue)
            {
                filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldProfileId, profileId.Value));
            }
            else
            {
                filters.Add(FilterElement.IsNullElement(CustomizationItemEntity.FieldProfileId));
            }

            // Filter by principal
            if (principalId.HasValue)
            {
                filters.Add(FilterElement.EqualElement(CustomizationItemEntity.FieldPrincipalId, principalId.Value));
            }
            else
            {
                filters.Add(FilterElement.IsNullElement(CustomizationItemEntity.FieldPrincipalId));
            }

            EntityObject[] items = BusinessManager.List(CustomizationItemEntity.ClassName, filters.ToArray());

            if (items != null && items.Length > 0)
            {
                result = items[0] as CustomizationItemEntity;
            }

            return(result);
        }
Example #11
0
 /// <summary>
 /// Gets the customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <returns></returns>
 private static CustomizationItemEntity GetCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType)
 {
     return(GetCustomizationItem(fullId, structureType, commandType, null, null));
 }
Example #12
0
        /// <summary>
        /// Creates the navigation item.
        /// </summary>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="fullId">The full id.</param>
        /// <param name="commandType">Type of the command.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        private static CustomizationItemEntity CreateCustomizationItem(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId?profileId, PrimaryKeyId?principalId)
        {
            CustomizationItemEntity item = BusinessManager.InitializeEntity <CustomizationItemEntity>(CustomizationItemEntity.ClassName);

            if (structureType != CustomizationStructureType.Undefined)
            {
                item.StructureType = (int)structureType;
            }
            item.XmlFullId = fullId;
            if (profileId.HasValue)
            {
                item.Properties["ProfileId"].Value = profileId;
            }
            if (principalId.HasValue)
            {
                item.Properties["PrincipalId"].Value = principalId;
            }

            item.CommandType = (int)commandType;

            item.PrimaryKeyId = BusinessManager.Create(item);

            return(item);
        }
Example #13
0
        // ------------------- Private methods -------------------
        #region CreateCustomizationItemByParent(string parentFullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
        /// <summary>
        /// Creates the navigation item by parent.
        /// </summary>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="parentFullId">The parent full id.</param>
        /// <param name="commandType">Type of the command.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        private static CustomizationItemEntity CreateCustomizationItemByParent(string parentFullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId?profileId, PrimaryKeyId?principalId)
        {
            string fullId = string.Concat(parentFullId, "/", Guid.NewGuid().ToString("D"));

            return(CreateCustomizationItem(fullId, structureType, commandType, profileId, principalId));
        }
Example #14
0
        /// <summary>
        /// Gets the customization item arguments.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="commandType">Type of the command.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        /// <returns></returns>
        public static Dictionary <string, CustomizationItemArgumentEntity> GetCustomizationItemArguments(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId?profileId, PrimaryKeyId?principalId)
        {
            CustomizationItemEntity item = GetCustomizationItem(fullId, structureType, commandType, profileId, principalId);

            if (item != null && item.PrimaryKeyId.HasValue)
            {
                return(GetCustomizationItemArguments(item.PrimaryKeyId.Value));
            }

            return(null);
        }
Example #15
0
 /// <summary>
 /// Gets the customization item arguments.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="structureType">Type of the structure.</param>
 /// <param name="commandType">Type of the command.</param>
 /// <param name="profileId">The profile id.</param>
 /// <returns></returns>
 public static Dictionary <string, CustomizationItemArgumentEntity> GetCustomizationItemArguments(string fullId, CustomizationStructureType structureType, ItemCommandType commandType, PrimaryKeyId?profileId)
 {
     return(GetCustomizationItemArguments(fullId, structureType, commandType, profileId, null));
 }