public void New(ChargingReservation NewChargingReservation) { lock (InternalData) { if (!InternalData.ContainsKey(NewChargingReservation.Id)) { InternalData.Add(NewChargingReservation.Id, new ChargingReservationCollection(NewChargingReservation)); LogIt("new", NewChargingReservation.Id, "reservations", new JArray(NewChargingReservation.ToJSON())); } else { InternalData[NewChargingReservation.Id].Add(NewChargingReservation); LogIt("update", NewChargingReservation.Id, "reservations", new JArray(InternalData[NewChargingReservation.Id].Select(reservation => reservation.ToJSON()))); } } }
public void NewOrUpdate(ChargingSession NewChargingSession, Action <ChargingSession> UpdateFunc = null) { lock (InternalData) { if (!InternalData.ContainsKey(NewChargingSession.Id)) { InternalData.Add(NewChargingSession.Id, NewChargingSession); UpdateFunc?.Invoke(NewChargingSession); LogIt("new", NewChargingSession.Id, "chargingSession", NewChargingSession.ToJSON()); } else { UpdateFunc?.Invoke(NewChargingSession); LogIt("update", NewChargingSession.Id, "chargingSession", NewChargingSession.ToJSON()); } } }
/// <inheritdoc cref="TableWorker{T}.EnsureExists"/> public override void EnsureExists(TableSettingsItem <EventItem> data) { if (!InternalData.Any(i => i.Data.DefName.Equals(data.Data.DefName))) { InternalData.Add(data); } }
public void AddPO(long number) { _manualList.Add(new SerializablePO() { Number = number }); _manualCol.Add(new POWithStatus(number)); InternalData.Add(new POWithStatus(number)); }
public void New(ChargeDetailRecord NewChargeDetailRecord) { lock (InternalData) { InternalData.Add(NewChargeDetailRecord.SessionId, new ChargeDetailRecordCollection(NewChargeDetailRecord)); LogIt("new", NewChargeDetailRecord.SessionId, "chargeDetailRecords", new JArray(NewChargeDetailRecord.ToJSON())); } }
/// <inheritdoc cref="TableWorker{T}.NotifyGlobalDataChanged"/> public override void NotifyGlobalDataChanged() { var wasDirty = false; foreach (EventItem item in ToolkitUtils.Data.Events.Select(item => new { item, existing = InternalData.Find(i => i.Data.Equals(item)) }) .Where(t => t.existing == null) .Select(t => t !.item)) { InternalData.Add(new TableSettingsItem <EventItem> { Data = item }); wasDirty = true; } if (wasDirty) { NotifySortRequested(); } }