public void AddOrUpdateCSInfo(String ChargingStationXMLId,
                                      EVSE_Id EVSEId)
        {
            var ExCSInfos = ChargingStationXMLId.IsNotNullOrEmpty()
                                ? _ChargingStations.
                            FirstOrDefault(CSInfo => CSInfo.StationXMLId == ChargingStationXMLId)
                                : _ChargingStations.
                            FirstOrDefault(CSInfo => CSInfo.StationId == WWCP.ChargingStation_Id.Create(EVSEId.ToWWCP().Value));

            if (ChargingStationXMLId.IsNullOrEmpty())
            {
            }

            if (ExCSInfos == null)
            {
                AddCSInfo(ChargingStationXMLId.IsNotNullOrEmpty()
                              ? ChargingStationXMLId
                              : WWCP.ChargingStation_Id.Create(EVSEId.ToWWCP().Value).ToString(),
                          EVSEId);
            }

            else
            {
                ExCSInfos.AddEVSEId(EVSEId);
                Check();
            }
        }
Пример #2
0
        public void AddOrUpdateCPInfo(WWCP.ChargingPool_Id ChargingPoolId,
                                      Address Address,
                                      GeoCoordinate?PoolLocation,
                                      String ChargingStationXMLId,
                                      EVSE_Id EVSEId)
        {
            ChargingPoolInfo _ChargingPoolInfo = null;

            // Existing charging pool...
            if (_ChargingPools.TryGetValue(ChargingPoolId, out _ChargingPoolInfo))
            {
                _ChargingPoolInfo.AddOrUpdateCSInfo(ChargingStationXMLId, EVSEId);
            }

            // ...or a new one!
            else
            {
                _ChargingPoolInfo = new ChargingPoolInfo(this, ChargingPoolId, Address, PoolLocation);
                _ChargingPoolInfo.AddOrUpdateCSInfo(ChargingStationXMLId.IsNotNullOrEmpty()
                                                        ? ChargingStationXMLId
                                                        : WWCP.ChargingStation_Id.Create(EVSEId.ToWWCP().Value).ToString(),
                                                    EVSEId);

                _ChargingPools.Add(_ChargingPoolInfo.PoolId, _ChargingPoolInfo);
            }
        }