Exemple #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)
            {
                IAuxiliaryAccount auxiliaryAccountsCasted = item.As <IAuxiliaryAccount>();

                if ((auxiliaryAccountsCasted != null))
                {
                    this._parent.AuxiliaryAccounts.Add(auxiliaryAccountsCasted);
                }
                if ((this._parent.ParentCharge == null))
                {
                    ICharge parentChargeCasted = item.As <ICharge>();
                    if ((parentChargeCasted != null))
                    {
                        this._parent.ParentCharge = parentChargeCasted;
                        return;
                    }
                }
                IConsumptionTariffInterval consumptionTariffIntervalsCasted = item.As <IConsumptionTariffInterval>();

                if ((consumptionTariffIntervalsCasted != null))
                {
                    this._parent.ConsumptionTariffIntervals.Add(consumptionTariffIntervalsCasted);
                }
                ICharge childChargesCasted = item.As <ICharge>();

                if ((childChargesCasted != null))
                {
                    this._parent.ChildCharges.Add(childChargesCasted);
                }
                ITimeTariffInterval timeTariffIntervalsCasted = item.As <ITimeTariffInterval>();

                if ((timeTariffIntervalsCasted != null))
                {
                    this._parent.TimeTariffIntervals.Add(timeTariffIntervalsCasted);
                }
                if ((this._parent.FixedPortion == null))
                {
                    IAccountingUnit fixedPortionCasted = item.As <IAccountingUnit>();
                    if ((fixedPortionCasted != null))
                    {
                        this._parent.FixedPortion = fixedPortionCasted;
                        return;
                    }
                }
            }
Exemple #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)
            {
                IAuxiliaryAccount auxiliaryAccountItem = item.As <IAuxiliaryAccount>();

                if (((auxiliaryAccountItem != null) &&
                     this._parent.AuxiliaryAccounts.Remove(auxiliaryAccountItem)))
                {
                    return(true);
                }
                if ((this._parent.ParentCharge == item))
                {
                    this._parent.ParentCharge = null;
                    return(true);
                }
                IConsumptionTariffInterval consumptionTariffIntervalItem = item.As <IConsumptionTariffInterval>();

                if (((consumptionTariffIntervalItem != null) &&
                     this._parent.ConsumptionTariffIntervals.Remove(consumptionTariffIntervalItem)))
                {
                    return(true);
                }
                ICharge chargeItem = item.As <ICharge>();

                if (((chargeItem != null) &&
                     this._parent.ChildCharges.Remove(chargeItem)))
                {
                    return(true);
                }
                ITimeTariffInterval timeTariffIntervalItem = item.As <ITimeTariffInterval>();

                if (((timeTariffIntervalItem != null) &&
                     this._parent.TimeTariffIntervals.Remove(timeTariffIntervalItem)))
                {
                    return(true);
                }
                if ((this._parent.FixedPortion == item))
                {
                    this._parent.FixedPortion = null;
                    return(true);
                }
                return(false);
            }