예제 #1
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                if ((this._parent.StreetAddress == null))
                {
                    IStreetAddress streetAddressCasted = item.As <IStreetAddress>();
                    if ((streetAddressCasted != null))
                    {
                        this._parent.StreetAddress = streetAddressCasted;
                        return;
                    }
                }
                if ((this._parent.ElectronicAddress == null))
                {
                    IElectronicAddress electronicAddressCasted = item.As <IElectronicAddress>();
                    if ((electronicAddressCasted != null))
                    {
                        this._parent.ElectronicAddress = electronicAddressCasted;
                        return;
                    }
                }
                if ((this._parent.PostalAddress == null))
                {
                    IPostalAddress postalAddressCasted = item.As <IPostalAddress>();
                    if ((postalAddressCasted != null))
                    {
                        this._parent.PostalAddress = postalAddressCasted;
                        return;
                    }
                }
                if ((this._parent.Phone1 == null))
                {
                    ITelephoneNumber phone1Casted = item.As <ITelephoneNumber>();
                    if ((phone1Casted != null))
                    {
                        this._parent.Phone1 = phone1Casted;
                        return;
                    }
                }
                if ((this._parent.Phone2 == null))
                {
                    ITelephoneNumber phone2Casted = item.As <ITelephoneNumber>();
                    if ((phone2Casted != null))
                    {
                        this._parent.Phone2 = phone2Casted;
                        return;
                    }
                }
                IMarketRole marketRolesCasted = item.As <IMarketRole>();

                if ((marketRolesCasted != null))
                {
                    this._parent.MarketRoles.Add(marketRolesCasted);
                }
                IBusinessRole businessRolesCasted = item.As <IBusinessRole>();

                if ((businessRolesCasted != null))
                {
                    this._parent.BusinessRoles.Add(businessRolesCasted);
                }
            }
예제 #2
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                if ((this._parent.StreetAddress == item))
                {
                    this._parent.StreetAddress = null;
                    return(true);
                }
                if ((this._parent.ElectronicAddress == item))
                {
                    this._parent.ElectronicAddress = null;
                    return(true);
                }
                if ((this._parent.PostalAddress == item))
                {
                    this._parent.PostalAddress = null;
                    return(true);
                }
                if ((this._parent.Phone1 == item))
                {
                    this._parent.Phone1 = null;
                    return(true);
                }
                if ((this._parent.Phone2 == item))
                {
                    this._parent.Phone2 = null;
                    return(true);
                }
                IMarketRole marketRoleItem = item.As <IMarketRole>();

                if (((marketRoleItem != null) &&
                     this._parent.MarketRoles.Remove(marketRoleItem)))
                {
                    return(true);
                }
                IBusinessRole businessRoleItem = item.As <IBusinessRole>();

                if (((businessRoleItem != null) &&
                     this._parent.BusinessRoles.Remove(businessRoleItem)))
                {
                    return(true);
                }
                return(false);
            }
예제 #3
0
 /// <summary>
 /// Creates a new observable property access proxy
 /// </summary>
 /// <param name="modelElement">The model instance element for which to create the property access proxy</param>
 public KindProxy(IMarketRole modelElement) :
     base(modelElement, "kind")
 {
 }