Example #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.AvailableCredit == null))
                {
                    IAccountingUnit availableCreditCasted = item.As <IAccountingUnit>();
                    if ((availableCreditCasted != null))
                    {
                        this._parent.AvailableCredit = availableCreditCasted;
                        return;
                    }
                }
                ICreditRegister creditRegistersCasted = item.As <ICreditRegister>();

                if ((creditRegistersCasted != null))
                {
                    this._parent.CreditRegisters.Add(creditRegistersCasted);
                }
                IChargeRegister chargeRegistersCasted = item.As <IChargeRegister>();

                if ((chargeRegistersCasted != null))
                {
                    this._parent.ChargeRegisters.Add(chargeRegistersCasted);
                }
                if ((this._parent.LowCreditWarningLevel == null))
                {
                    IAccountingUnit lowCreditWarningLevelCasted = item.As <IAccountingUnit>();
                    if ((lowCreditWarningLevelCasted != null))
                    {
                        this._parent.LowCreditWarningLevel = lowCreditWarningLevelCasted;
                        return;
                    }
                }
                if ((this._parent.CreditExpiryLevel == null))
                {
                    IAccountingUnit creditExpiryLevelCasted = item.As <IAccountingUnit>();
                    if ((creditExpiryLevelCasted != null))
                    {
                        this._parent.CreditExpiryLevel = creditExpiryLevelCasted;
                        return;
                    }
                }
                if ((this._parent.ServiceKind == null))
                {
                    IServiceCategory serviceKindCasted = item.As <IServiceCategory>();
                    if ((serviceKindCasted != null))
                    {
                        this._parent.ServiceKind = serviceKindCasted;
                        return;
                    }
                }
            }
Example #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.AvailableCredit == item))
                {
                    this._parent.AvailableCredit = null;
                    return(true);
                }
                ICreditRegister creditRegisterItem = item.As <ICreditRegister>();

                if (((creditRegisterItem != null) &&
                     this._parent.CreditRegisters.Remove(creditRegisterItem)))
                {
                    return(true);
                }
                IChargeRegister chargeRegisterItem = item.As <IChargeRegister>();

                if (((chargeRegisterItem != null) &&
                     this._parent.ChargeRegisters.Remove(chargeRegisterItem)))
                {
                    return(true);
                }
                if ((this._parent.LowCreditWarningLevel == item))
                {
                    this._parent.LowCreditWarningLevel = null;
                    return(true);
                }
                if ((this._parent.CreditExpiryLevel == item))
                {
                    this._parent.CreditExpiryLevel = null;
                    return(true);
                }
                if ((this._parent.ServiceKind == item))
                {
                    this._parent.ServiceKind = null;
                    return(true);
                }
                return(false);
            }
Example #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 CreditKindProxy(ICreditRegister modelElement) :
     base(modelElement, "creditKind")
 {
 }