/// <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.ErpInvoiceLineItem == item)) { this._parent.ErpInvoiceLineItem = null; return(true); } IErpPayment erpPaymentItem = item.As <IErpPayment>(); if (((erpPaymentItem != null) && this._parent.ErpPayments.Remove(erpPaymentItem))) { return(true); } if ((this._parent.ErpPayable == item)) { this._parent.ErpPayable = null; return(true); } IErpJournalEntry erpJournalEntryItem = item.As <IErpJournalEntry>(); if (((erpJournalEntryItem != null) && this._parent.ErpJournalEntries.Remove(erpJournalEntryItem))) { return(true); } if ((this._parent.Status == item)) { this._parent.Status = null; return(true); } return(false); }
/// <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.ErpInvoiceLineItem == null)) { IErpInvoiceLineItem erpInvoiceLineItemCasted = item.As <IErpInvoiceLineItem>(); if ((erpInvoiceLineItemCasted != null)) { this._parent.ErpInvoiceLineItem = erpInvoiceLineItemCasted; return; } } IErpPayment erpPaymentsCasted = item.As <IErpPayment>(); if ((erpPaymentsCasted != null)) { this._parent.ErpPayments.Add(erpPaymentsCasted); } if ((this._parent.ErpPayable == null)) { IErpPayable erpPayableCasted = item.As <IErpPayable>(); if ((erpPayableCasted != null)) { this._parent.ErpPayable = erpPayableCasted; return; } } IErpJournalEntry erpJournalEntriesCasted = item.As <IErpJournalEntry>(); if ((erpJournalEntriesCasted != null)) { this._parent.ErpJournalEntries.Add(erpJournalEntriesCasted); } if ((this._parent.Status == null)) { IStatus statusCasted = item.As <IStatus>(); if ((statusCasted != null)) { this._parent.Status = statusCasted; return; } } }