コード例 #1
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)
            {
                ICustomerAgreement customerAgreementItem = item.As <ICustomerAgreement>();

                if (((customerAgreementItem != null) &&
                     this._parent.CustomerAgreements.Remove(customerAgreementItem)))
                {
                    return(true);
                }
                if ((this._parent.ValidityInterval == item))
                {
                    this._parent.ValidityInterval = null;
                    return(true);
                }
                IEndDeviceGroup endDeviceGroupItem = item.As <IEndDeviceGroup>();

                if (((endDeviceGroupItem != null) &&
                     this._parent.EndDeviceGroups.Remove(endDeviceGroupItem)))
                {
                    return(true);
                }
                IEndDeviceControl endDeviceControlItem = item.As <IEndDeviceControl>();

                if (((endDeviceControlItem != null) &&
                     this._parent.EndDeviceControls.Remove(endDeviceControlItem)))
                {
                    return(true);
                }
                return(false);
            }
コード例 #2
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                ICustomerAgreement customerAgreementsCasted = item.As <ICustomerAgreement>();

                if ((customerAgreementsCasted != null))
                {
                    this._parent.CustomerAgreements.Add(customerAgreementsCasted);
                }
                if ((this._parent.ValidityInterval == null))
                {
                    IDateTimeInterval validityIntervalCasted = item.As <IDateTimeInterval>();
                    if ((validityIntervalCasted != null))
                    {
                        this._parent.ValidityInterval = validityIntervalCasted;
                        return;
                    }
                }
                IEndDeviceGroup endDeviceGroupsCasted = item.As <IEndDeviceGroup>();

                if ((endDeviceGroupsCasted != null))
                {
                    this._parent.EndDeviceGroups.Add(endDeviceGroupsCasted);
                }
                IEndDeviceControl endDeviceControlsCasted = item.As <IEndDeviceControl>();

                if ((endDeviceControlsCasted != null))
                {
                    this._parent.EndDeviceControls.Add(endDeviceControlsCasted);
                }
            }
コード例 #3
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.DemandResponseProgram == item))
                {
                    this._parent.DemandResponseProgram = null;
                    return(true);
                }
                IEndDeviceAsset endDeviceAssetItem = item.As <IEndDeviceAsset>();

                if (((endDeviceAssetItem != null) &&
                     this._parent.EndDeviceAssets.Remove(endDeviceAssetItem)))
                {
                    return(true);
                }
                IEndDeviceControl endDeviceControlItem = item.As <IEndDeviceControl>();

                if (((endDeviceControlItem != null) &&
                     this._parent.EndDeviceControls.Remove(endDeviceControlItem)))
                {
                    return(true);
                }
                return(false);
            }
コード例 #4
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.DemandResponseProgram == null))
                {
                    IDemandResponseProgram demandResponseProgramCasted = item.As <IDemandResponseProgram>();
                    if ((demandResponseProgramCasted != null))
                    {
                        this._parent.DemandResponseProgram = demandResponseProgramCasted;
                        return;
                    }
                }
                IEndDeviceAsset endDeviceAssetsCasted = item.As <IEndDeviceAsset>();

                if ((endDeviceAssetsCasted != null))
                {
                    this._parent.EndDeviceAssets.Add(endDeviceAssetsCasted);
                }
                IEndDeviceControl endDeviceControlsCasted = item.As <IEndDeviceControl>();

                if ((endDeviceControlsCasted != null))
                {
                    this._parent.EndDeviceControls.Add(endDeviceControlsCasted);
                }
            }