Esempio n. 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)
            {
                IIncidentCode incidentCodeItem = item.As <IIncidentCode>();

                if (((incidentCodeItem != null) &&
                     this._parent.IncidentCodes.Remove(incidentCodeItem)))
                {
                    return(true);
                }
                ITroubleTicket troubleTicketItem = item.As <ITroubleTicket>();

                if (((troubleTicketItem != null) &&
                     this._parent.TroubleTickets.Remove(troubleTicketItem)))
                {
                    return(true);
                }
                if ((this._parent.Period == item))
                {
                    this._parent.Period = null;
                    return(true);
                }
                return(false);
            }
Esempio n. 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)
            {
                IIncidentCode incidentCodesCasted = item.As <IIncidentCode>();

                if ((incidentCodesCasted != null))
                {
                    this._parent.IncidentCodes.Add(incidentCodesCasted);
                }
                ITroubleTicket troubleTicketsCasted = item.As <ITroubleTicket>();

                if ((troubleTicketsCasted != null))
                {
                    this._parent.TroubleTickets.Add(troubleTicketsCasted);
                }
                if ((this._parent.Period == null))
                {
                    IDateTimeInterval periodCasted = item.As <IDateTimeInterval>();
                    if ((periodCasted != null))
                    {
                        this._parent.Period = periodCasted;
                        return;
                    }
                }
            }