Пример #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.SensitivityPriceCurve == null))
     {
         ISensitivityPriceCurve sensitivityPriceCurveCasted = item.As <ISensitivityPriceCurve>();
         if ((sensitivityPriceCurveCasted != null))
         {
             this._parent.SensitivityPriceCurve = sensitivityPriceCurveCasted;
             return;
         }
     }
     if ((this._parent.ReserveReqCurve == null))
     {
         IReserveReqCurve reserveReqCurveCasted = item.As <IReserveReqCurve>();
         if ((reserveReqCurveCasted != null))
         {
             this._parent.ReserveReqCurve = reserveReqCurveCasted;
             return;
         }
     }
     if ((this._parent.MarketProduct == null))
     {
         IMarketProduct marketProductCasted = item.As <IMarketProduct>();
         if ((marketProductCasted != null))
         {
             this._parent.MarketProduct = marketProductCasted;
             return;
         }
     }
 }
Пример #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)
            {
                IMarket marketsCasted = item.As <IMarket>();

                if ((marketsCasted != null))
                {
                    this._parent.Markets.Add(marketsCasted);
                }
                IMarketProduct marketProductsCasted = item.As <IMarketProduct>();

                if ((marketProductsCasted != null))
                {
                    this._parent.MarketProducts.Add(marketProductsCasted);
                }
                IMeter metersCasted = item.As <IMeter>();

                if ((metersCasted != null))
                {
                    this._parent.Meters.Add(metersCasted);
                }
                if ((this._parent.Pnode == null))
                {
                    IPnode pnodeCasted = item.As <IPnode>();
                    if ((pnodeCasted != null))
                    {
                        this._parent.Pnode = pnodeCasted;
                        return;
                    }
                }
                if ((this._parent.Organisation == null))
                {
                    IErpOrganisation organisationCasted = item.As <IErpOrganisation>();
                    if ((organisationCasted != null))
                    {
                        this._parent.Organisation = organisationCasted;
                        return;
                    }
                }
                IResourceGroup resourceGroupsCasted = item.As <IResourceGroup>();

                if ((resourceGroupsCasted != null))
                {
                    this._parent.ResourceGroups.Add(resourceGroupsCasted);
                }
            }
Пример #3
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)
            {
                IMarket marketItem = item.As <IMarket>();

                if (((marketItem != null) &&
                     this._parent.Markets.Remove(marketItem)))
                {
                    return(true);
                }
                IMarketProduct marketProductItem = item.As <IMarketProduct>();

                if (((marketProductItem != null) &&
                     this._parent.MarketProducts.Remove(marketProductItem)))
                {
                    return(true);
                }
                IMeter meterItem = item.As <IMeter>();

                if (((meterItem != null) &&
                     this._parent.Meters.Remove(meterItem)))
                {
                    return(true);
                }
                if ((this._parent.Pnode == item))
                {
                    this._parent.Pnode = null;
                    return(true);
                }
                if ((this._parent.Organisation == item))
                {
                    this._parent.Organisation = null;
                    return(true);
                }
                IResourceGroup resourceGroupItem = item.As <IResourceGroup>();

                if (((resourceGroupItem != null) &&
                     this._parent.ResourceGroups.Remove(resourceGroupItem)))
                {
                    return(true);
                }
                return(false);
            }
Пример #4
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.Bid == null))
     {
         IBid bidCasted = item.As <IBid>();
         if ((bidCasted != null))
         {
             this._parent.Bid = bidCasted;
             return;
         }
     }
     if ((this._parent.ProductBidClearing == null))
     {
         IProductBidClearing productBidClearingCasted = item.As <IProductBidClearing>();
         if ((productBidClearingCasted != null))
         {
             this._parent.ProductBidClearing = productBidClearingCasted;
             return;
         }
     }
     if ((this._parent.BidPriceCurve == null))
     {
         IBidPriceCurve bidPriceCurveCasted = item.As <IBidPriceCurve>();
         if ((bidPriceCurveCasted != null))
         {
             this._parent.BidPriceCurve = bidPriceCurveCasted;
             return;
         }
     }
     if ((this._parent.MarketProduct == null))
     {
         IMarketProduct marketProductCasted = item.As <IMarketProduct>();
         if ((marketProductCasted != null))
         {
             this._parent.MarketProduct = marketProductCasted;
             return;
         }
     }
 }