コード例 #1
0
        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())));
                }
            }
        }
コード例 #2
0
        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());
                }
            }
        }
コード例 #3
0
 /// <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);
     }
 }
コード例 #4
0
 public void AddPO(long number)
 {
     _manualList.Add(new SerializablePO()
     {
         Number = number
     });
     _manualCol.Add(new POWithStatus(number));
     InternalData.Add(new POWithStatus(number));
 }
コード例 #5
0
        public void New(ChargeDetailRecord NewChargeDetailRecord)
        {
            lock (InternalData)
            {
                InternalData.Add(NewChargeDetailRecord.SessionId, new ChargeDetailRecordCollection(NewChargeDetailRecord));

                LogIt("new",
                      NewChargeDetailRecord.SessionId,
                      "chargeDetailRecords",
                      new JArray(NewChargeDetailRecord.ToJSON()));
            }
        }
コード例 #6
0
        /// <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();
            }
        }