Exemplo 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)
            {
                IViolationLimit violationLimitItem = item.As <IViolationLimit>();

                if (((violationLimitItem != null) &&
                     this._parent.ViolationLimits.Remove(violationLimitItem)))
                {
                    return(true);
                }
                ISeasonDayTypeSchedule seasonDayTypeScheduleItem = item.As <ISeasonDayTypeSchedule>();

                if (((seasonDayTypeScheduleItem != null) &&
                     this._parent.SeasonDayTypeSchedules.Remove(seasonDayTypeScheduleItem)))
                {
                    return(true);
                }
                ICapacityBenefitMargin capacityBenefitMarginItem = item.As <ICapacityBenefitMargin>();

                if (((capacityBenefitMarginItem != null) &&
                     this._parent.CapacityBenefitMargin.Remove(capacityBenefitMarginItem)))
                {
                    return(true);
                }
                return(false);
            }
Exemplo 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)
            {
                IViolationLimit violationLimitsCasted = item.As <IViolationLimit>();

                if ((violationLimitsCasted != null))
                {
                    this._parent.ViolationLimits.Add(violationLimitsCasted);
                }
                ISeasonDayTypeSchedule seasonDayTypeSchedulesCasted = item.As <ISeasonDayTypeSchedule>();

                if ((seasonDayTypeSchedulesCasted != null))
                {
                    this._parent.SeasonDayTypeSchedules.Add(seasonDayTypeSchedulesCasted);
                }
                ICapacityBenefitMargin capacityBenefitMarginCasted = item.As <ICapacityBenefitMargin>();

                if ((capacityBenefitMarginCasted != null))
                {
                    this._parent.CapacityBenefitMargin.Add(capacityBenefitMarginCasted);
                }
            }