Example #1
0
        /// <summary>
        /// Shows the hidden customization item.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        public static void ShowCustomizationItem(string fullId, CustomizationStructureType structureType, PrimaryKeyId?profileId, PrimaryKeyId?principalId)
        {
            CustomizationItemEntity item = GetCustomizationItem(fullId, structureType, ItemCommandType.Remove, profileId, principalId);

            if (item != null)
            {
                BusinessManager.Delete(item);

                ClearCache(profileId, principalId);
            }
        }
Example #2
0
        /// <summary>
        /// Hides the customization item.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        public static void HideCustomizationItem(string fullId, CustomizationStructureType structureType, PrimaryKeyId?profileId, PrimaryKeyId?principalId)
        {
            CustomizationItemEntity item = GetCustomizationItem(fullId, structureType, ItemCommandType.Remove, profileId, principalId);

            if (item == null)
            {
                CreateCustomizationItem(fullId, structureType, ItemCommandType.Remove, profileId, principalId);

                ClearCache(profileId, principalId);
            }
        }
Example #3
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 #4
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 #5
0
 /// <summary>
 /// Shows the hidden customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="structureType">Type of the structure.</param>
 /// <param name="profileId">The profile id.</param>
 public static void ShowCustomizationItem(string fullId, CustomizationStructureType structureType, PrimaryKeyId? profileId)
 {
     ShowCustomizationItem(fullId, structureType, profileId, null);
 }
Example #6
0
        /// <summary>
        /// Shows the hidden customization item.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        public static void ShowCustomizationItem(string fullId, CustomizationStructureType structureType, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
        {
            CustomizationItemEntity item = GetCustomizationItem(fullId, structureType, ItemCommandType.Remove, profileId, principalId);
            if (item != null)
            {
                BusinessManager.Delete(item);

                ClearCache(profileId, principalId);
            }
        }
Example #7
0
        /// <summary>
        /// Hides the customization item.
        /// </summary>
        /// <param name="fullId">The full id.</param>
        /// <param name="structureType">Type of the structure.</param>
        /// <param name="profileId">The profile id.</param>
        /// <param name="principalId">The principal id.</param>
        public static void HideCustomizationItem(string fullId, CustomizationStructureType structureType, PrimaryKeyId? profileId, PrimaryKeyId? principalId)
        {
            CustomizationItemEntity item = GetCustomizationItem(fullId, structureType, ItemCommandType.Remove, profileId, principalId);
            if (item == null)
            {
                CreateCustomizationItem(fullId, structureType, ItemCommandType.Remove, profileId, principalId);

                ClearCache(profileId, principalId);
            }
        }
Example #8
0
 /// <summary>
 /// Shows the hidden customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="structureType">Type of the structure.</param>
 public static void ShowCustomizationItem(string fullId, CustomizationStructureType structureType)
 {
     ShowCustomizationItem(fullId, structureType, null, null);
 }
Example #9
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 #10
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 #11
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 #12
0
 /// <summary>
 /// Shows the hidden customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="structureType">Type of the structure.</param>
 public static void ShowCustomizationItem(string fullId, CustomizationStructureType structureType)
 {
     ShowCustomizationItem(fullId, structureType, null, null);
 }
Example #13
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 #14
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 #15
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 #16
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 #17
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 #18
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 #19
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 #20
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 #21
0
 /// <summary>
 /// Shows the hidden customization item.
 /// </summary>
 /// <param name="fullId">The full id.</param>
 /// <param name="structureType">Type of the structure.</param>
 /// <param name="profileId">The profile id.</param>
 public static void ShowCustomizationItem(string fullId, CustomizationStructureType structureType, PrimaryKeyId?profileId)
 {
     ShowCustomizationItem(fullId, structureType, profileId, null);
 }
Example #22
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 #23
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);
 }