Beispiel #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.MeterAssetModel == item))
                {
                    this._parent.MeterAssetModel = null;
                    return(true);
                }
                ITransaction transactionItem = item.As <ITransaction>();

                if (((transactionItem != null) &&
                     this._parent.VendingTransactions.Remove(transactionItem)))
                {
                    return(true);
                }
                IMeterServiceWork meterServiceWorkItem = item.As <IMeterServiceWork>();

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

                if (((meterReadingItem != null) &&
                     this._parent.MeterReadings.Remove(meterReadingItem)))
                {
                    return(true);
                }
                if (((meterServiceWorkItem != null) &&
                     this._parent.MeterReplacementWorks.Remove(meterServiceWorkItem)))
                {
                    return(true);
                }
                return(false);
            }
Beispiel #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.MeterAssetModel == null))
                {
                    IMeterAssetModel meterAssetModelCasted = item.As <IMeterAssetModel>();
                    if ((meterAssetModelCasted != null))
                    {
                        this._parent.MeterAssetModel = meterAssetModelCasted;
                        return;
                    }
                }
                ITransaction vendingTransactionsCasted = item.As <ITransaction>();

                if ((vendingTransactionsCasted != null))
                {
                    this._parent.VendingTransactions.Add(vendingTransactionsCasted);
                }
                IMeterServiceWork meterServiceWorksCasted = item.As <IMeterServiceWork>();

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

                if ((meterReadingsCasted != null))
                {
                    this._parent.MeterReadings.Add(meterReadingsCasted);
                }
                IMeterServiceWork meterReplacementWorksCasted = item.As <IMeterServiceWork>();

                if ((meterReplacementWorksCasted != null))
                {
                    this._parent.MeterReplacementWorks.Add(meterReplacementWorksCasted);
                }
            }