/// <summary> /// Moves a PropertyType to a specified PropertyGroup /// </summary> /// <param name="propertyTypeAlias">Alias of the PropertyType to move</param> /// <param name="propertyGroupName">Name of the PropertyGroup to move the PropertyType to</param> /// <returns></returns> public bool MovePropertyType(string propertyTypeAlias, string propertyGroupName) { if (PropertyTypes.Any(x => x.Alias == propertyTypeAlias) == false || PropertyGroups.Any(x => x.Name == propertyGroupName) == false) { return(false); } var propertyType = PropertyTypes.First(x => x.Alias == propertyTypeAlias); //The PropertyType already belongs to a PropertyGroup, so we have to remove the PropertyType from that group if (PropertyGroups.Any(x => x.PropertyTypes.Any(y => y.Alias == propertyTypeAlias))) { var oldPropertyGroup = PropertyGroups.First(x => x.PropertyTypes.Any(y => y.Alias == propertyTypeAlias)); oldPropertyGroup.PropertyTypes.RemoveItem(propertyTypeAlias); } propertyType.PropertyGroupId = new Lazy <int>(() => default(int)); propertyType.ResetDirtyProperties(); var propertyGroup = PropertyGroups.First(x => x.Name == propertyGroupName); propertyGroup.PropertyTypes.Add(propertyType); return(true); }
/// <summary> /// Sets a boolean indicating whether a Property is editable by the Member. /// </summary> /// <param name="propertyTypeAlias">PropertyType Alias of the Property to set</param> /// <param name="value">Boolean value, true or false</param> public void SetMemberCanEditProperty(string propertyTypeAlias, bool value) { if (MemberTypePropertyTypes.ContainsKey(propertyTypeAlias)) { var tuple = MemberTypePropertyTypes[propertyTypeAlias]; MemberTypePropertyTypes[propertyTypeAlias] = new Tuple <bool, bool, int>(value, tuple.Item2, tuple.Item3); } else { var propertyType = PropertyTypes.First(x => x.Alias.Equals(propertyTypeAlias)); var tuple = new Tuple <bool, bool, int>(value, false, propertyType.Id); MemberTypePropertyTypes.Add(propertyTypeAlias, tuple); } }