/// <summary> /// Convert a WWCP charge detail record into a corresponding eMIP charge detail record. /// </summary> /// <param name="ChargeDetailRecord">A WWCP charge detail record.</param> /// <param name="WWCPChargeDetailRecord2ChargeDetailRecord">A delegate which allows you to modify the convertion from WWCP charge detail records to eMIP charge detail records.</param> public static ChargeDetailRecord ToEMIP(this WWCP.ChargeDetailRecord ChargeDetailRecord, CPO.WWCPChargeDetailRecord2ChargeDetailRecordDelegate WWCPChargeDetailRecord2ChargeDetailRecord = null) { var CDR = new ChargeDetailRecord( CDRNature: CDRNatures.Final, ServiceSessionId: ServiceSession_Id.Parse(ChargeDetailRecord.SessionId.ToString()), RequestedServiceId: Service_Id.GenericChargeService, EVSEId: ChargeDetailRecord.EVSEId.Value.ToEMIP().Value, UserId: ChargeDetailRecord.AuthenticationStart.ToEMIP().Value, StartTime: ChargeDetailRecord.SessionTime.StartTime, EndTime: ChargeDetailRecord.SessionTime.EndTime.Value, UserContractIdAlias: null, ExecPartnerSessionId: null, ExecPartnerOperatorId: null, SalesPartnerSessionId: null, //ChargeDetailRecord.GetCustomDataAs<PartnerSession_Id?>("eMIP.PartnerSessionId"), SalesPartnerOperatorId: null, PartnerProductId: ChargeDetailRecord.ChargingProduct?.Id.ToEMIP(), MeterReports: new MeterReport[] { MeterReport.Create(ChargeDetailRecord.Duration.HasValue ? ChargeDetailRecord.Duration.Value.TotalMinutes.ToString("0.##").Replace(',', '.') : (ChargeDetailRecord.EnergyMeteringValues.Last().Timestamp - ChargeDetailRecord.EnergyMeteringValues.First().Timestamp).TotalMinutes.ToString("0.##").Replace(',', '.'), "min", MeterTypes.TotalDuration), MeterReport.Create(ChargeDetailRecord.ConsumedEnergy.HasValue ? ChargeDetailRecord.ConsumedEnergy.Value.ToString("0.##").Replace(',', '.') : (ChargeDetailRecord.EnergyMeteringValues.Last().Value - ChargeDetailRecord.EnergyMeteringValues.First().Value).ToString("0.##").Replace(',', '.'), "kWh", MeterTypes.TotalEnergy), }, InternalData: new Dictionary <String, Object> { { WWCP_CDR, ChargeDetailRecord } }); if (WWCPChargeDetailRecord2ChargeDetailRecord != null) { CDR = WWCPChargeDetailRecord2ChargeDetailRecord(ChargeDetailRecord, CDR); } return(CDR); }
/// <summary> /// Create a new charge detail record. /// </summary> /// <param name="CDRNature">State of the charging session.</param> /// <param name="ServiceSessionId">GIREVE session id for this charging session.</param> /// <param name="RequestedServiceId">The unique identification of the requested service for this charging session.</param> /// <param name="EVSEId">The unique identification of the EVSE used for charging.</param> /// <param name="UserContractIdAlias">Alias of the contract id between the end-user and the eMSP. This alias may have been anonymised by the eMSP.</param> /// <param name="UserId">The unique identification of the user.</param> /// <param name="StartTime">Start time of the charging session.</param> /// <param name="EndTime">End time of the charging session, or the timestamp of the meter reading for intermediate charge detail records.</param> /// /// <param name="ExecPartnerSessionId">Charging session identification at the operator.</param> /// <param name="ExecPartnerOperatorId">The unique identification of the charging operator.</param> /// <param name="SalesPartnerSessionId">Charging session identification at the e-mobility provider.</param> /// <param name="SalesPartnerOperatorId">The unique identification of the e-mobility provider.</param> /// <param name="PartnerProductId">The unique identification of the charging product.</param> /// <param name="MeterReports">An optional enumeration of meter reports.</param> /// /// <param name="InternalData">An optional dictionary of customer-specific data.</param> public ChargeDetailRecord(CDRNatures CDRNature, ServiceSession_Id ServiceSessionId, Service_Id RequestedServiceId, EVSE_Id EVSEId, User_Id UserId, DateTime StartTime, DateTime EndTime, Contract_Id?UserContractIdAlias = null, ServiceSession_Id?ExecPartnerSessionId = null, Operator_Id?ExecPartnerOperatorId = null, ServiceSession_Id?SalesPartnerSessionId = null, Provider_Id?SalesPartnerOperatorId = null, PartnerProduct_Id?PartnerProductId = null, IEnumerable <MeterReport> MeterReports = null, IReadOnlyDictionary <String, Object> InternalData = null) : base(InternalData) { this.CDRNature = CDRNature; this.ServiceSessionId = ServiceSessionId; this.RequestedServiceId = RequestedServiceId; this.EVSEId = EVSEId; this.UserContractIdAlias = UserContractIdAlias; this.UserId = UserId; this.StartTime = StartTime; this.EndTime = EndTime; this.ExecPartnerSessionId = ExecPartnerSessionId; this.ExecPartnerOperatorId = ExecPartnerOperatorId; this.SalesPartnerSessionId = SalesPartnerSessionId; this.SalesPartnerOperatorId = SalesPartnerOperatorId; this.PartnerProductId = PartnerProductId; this.MeterReports = MeterReports ?? new MeterReport[0]; }
public static ChargingSession_Id ToWWCP(this ServiceSession_Id ServiceSessionId) => ChargingSession_Id.Parse(ServiceSessionId.ToString());
public static ServiceSession_Id?ToEMIP(this ChargingSession_Id?ChargingSessionId) => ChargingSessionId.HasValue ? ServiceSession_Id.Parse(ChargingSessionId.ToString()) : new ServiceSession_Id?();
public static ServiceSession_Id ToEMIP(this ChargingSession_Id ChargingSessionId) => ServiceSession_Id.Parse(ChargingSessionId.ToString());