예제 #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)
            {
                if ((this._parent.EndDeviceAsset == item))
                {
                    this._parent.EndDeviceAsset = null;
                    return(true);
                }
                IReadingQuality readingQualityItem = item.As <IReadingQuality>();

                if (((readingQualityItem != null) &&
                     this._parent.ReadingQualities.Remove(readingQualityItem)))
                {
                    return(true);
                }
                IMeterReading meterReadingItem = item.As <IMeterReading>();

                if (((meterReadingItem != null) &&
                     this._parent.MeterReadings.Remove(meterReadingItem)))
                {
                    return(true);
                }
                if ((this._parent.ReadingType == item))
                {
                    this._parent.ReadingType = null;
                    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)
            {
                if ((this._parent.EndDeviceAsset == null))
                {
                    IEndDeviceAsset endDeviceAssetCasted = item.As <IEndDeviceAsset>();
                    if ((endDeviceAssetCasted != null))
                    {
                        this._parent.EndDeviceAsset = endDeviceAssetCasted;
                        return;
                    }
                }
                IReadingQuality readingQualitiesCasted = item.As <IReadingQuality>();

                if ((readingQualitiesCasted != null))
                {
                    this._parent.ReadingQualities.Add(readingQualitiesCasted);
                }
                IMeterReading meterReadingsCasted = item.As <IMeterReading>();

                if ((meterReadingsCasted != null))
                {
                    this._parent.MeterReadings.Add(meterReadingsCasted);
                }
                if ((this._parent.ReadingType == null))
                {
                    IReadingType readingTypeCasted = item.As <IReadingType>();
                    if ((readingTypeCasted != null))
                    {
                        this._parent.ReadingType = readingTypeCasted;
                        return;
                    }
                }
            }
예제 #3
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                IReadingQuality readingQualitiesCasted = item.As <IReadingQuality>();

                if ((readingQualitiesCasted != null))
                {
                    this._parent.ReadingQualities.Add(readingQualitiesCasted);
                }
                IIntervalBlock intervalBlocksCasted = item.As <IIntervalBlock>();

                if ((intervalBlocksCasted != null))
                {
                    this._parent.IntervalBlocks.Add(intervalBlocksCasted);
                }
            }
예제 #4
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)
            {
                IReadingQuality readingQualityItem = item.As <IReadingQuality>();

                if (((readingQualityItem != null) &&
                     this._parent.ReadingQualities.Remove(readingQualityItem)))
                {
                    return(true);
                }
                IIntervalBlock intervalBlockItem = item.As <IIntervalBlock>();

                if (((intervalBlockItem != null) &&
                     this._parent.IntervalBlocks.Remove(intervalBlockItem)))
                {
                    return(true);
                }
                return(false);
            }