|
@@ -1576,12 +1576,13 @@ internal partial class ProfileHandler
|
|
|
{
|
|
|
logger.LogTrace("*********************");
|
|
|
}
|
|
|
- var foundConfig = configure.Find(x => x.ConfigureName == item.key);
|
|
|
|
|
|
+ var foundConfig = configure.Find(x => x.ConfigureName == item.key);
|
|
|
+ var updateValue = string.IsNullOrEmpty(item.value) ? string.Empty : item.value;
|
|
|
|
|
|
if (foundConfig == null)
|
|
|
{
|
|
|
- await mainDbService.AddMachineConfiguration(session.ChargeBoxId, item.key, item.value, item.IsReadOnly);
|
|
|
+ await mainDbService.AddMachineConfiguration(session.ChargeBoxId, item.key, updateValue, item.IsReadOnly);
|
|
|
}
|
|
|
else if (item.value != foundConfig.ConfigureSetting)
|
|
|
{
|
|
@@ -1595,7 +1596,7 @@ internal partial class ProfileHandler
|
|
|
oldValue = foundConfig.ConfigureSetting;
|
|
|
}
|
|
|
|
|
|
- await mainDbService.UpdateMachineConfiguration(session.ChargeBoxId, item.key, item.value, item.IsReadOnly);
|
|
|
+ await mainDbService.UpdateMachineConfiguration(session.ChargeBoxId, item.key, updateValue, item.IsReadOnly);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1607,82 +1608,15 @@ internal partial class ProfileHandler
|
|
|
var foundConfig = configure.Find(x => x.ConfigureName == item);
|
|
|
if (foundConfig != null)
|
|
|
{
|
|
|
- await mainDbService.UpdateMachineConfiguration(session.ChargeBoxId, item, string.Empty, true, isExists: false);
|
|
|
+ await mainDbService.UpdateMachineConfiguration(session.ChargeBoxId, item, string.Empty, isReadOnly: true, isExists: false);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- await mainDbService.AddMachineConfiguration(session.ChargeBoxId, item, string.Empty, true, isExist: false);
|
|
|
+ await mainDbService.AddMachineConfiguration(session.ChargeBoxId, item, string.Empty, isReadOnly: true, isExist: false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //var configure = await db.MachineConfigurations.Where(x => x.ChargeBoxId == session.ChargeBoxId).ToListAsync();
|
|
|
-
|
|
|
- //if (_confirm.configurationKey != null)
|
|
|
- //{
|
|
|
- // foreach (var item in _confirm.configurationKey)
|
|
|
- // {
|
|
|
- // string oldValue = string.Empty;
|
|
|
- // if (item.key == null)
|
|
|
- // {
|
|
|
- // logger.LogTrace("*********************");
|
|
|
- // }
|
|
|
- // var foundConfig = configure.Find(x => x.ConfigureName == item.key);
|
|
|
-
|
|
|
-
|
|
|
- // if (foundConfig != null)
|
|
|
- // {
|
|
|
- // if (foundConfig.ConfigureName == null)
|
|
|
- // {
|
|
|
- // logger.LogTrace("*********************");
|
|
|
- // }
|
|
|
-
|
|
|
- // if (foundConfig.ConfigureName == "SecurityProfile")
|
|
|
- // {
|
|
|
- // oldValue = foundConfig.ConfigureSetting;
|
|
|
- // }
|
|
|
-
|
|
|
- // foundConfig.ReadOnly = item.IsReadOnly;
|
|
|
- // foundConfig.ConfigureSetting = string.IsNullOrEmpty(item.value) ? string.Empty : item.value;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // await db.MachineConfigurations.AddAsync(new MachineConfigurations()
|
|
|
- // {
|
|
|
- // ChargeBoxId = session.ChargeBoxId,
|
|
|
- // ConfigureName = item.key,
|
|
|
- // ReadOnly = item.IsReadOnly,
|
|
|
- // ConfigureSetting = string.IsNullOrEmpty(item.value) ? string.Empty : item.value,
|
|
|
- // Exists = true
|
|
|
- // });
|
|
|
- // }
|
|
|
-
|
|
|
-
|
|
|
- // }
|
|
|
- //}
|
|
|
- //if (_confirm.unknownKey != null)
|
|
|
- //{
|
|
|
-
|
|
|
- // foreach (var item in _confirm.unknownKey)
|
|
|
- // {
|
|
|
- // var foundConfig = configure.Find(x => x.ConfigureName == item);
|
|
|
- // if (foundConfig != null)
|
|
|
- // {
|
|
|
- // foundConfig.ReadOnly = true;
|
|
|
- // foundConfig.ConfigureSetting = string.Empty;
|
|
|
- // foundConfig.Exists = false;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // await db.MachineConfigurations.AddAsync(new MachineConfigurations()
|
|
|
- // {
|
|
|
- // ChargeBoxId = session.ChargeBoxId,
|
|
|
- // ConfigureName = item
|
|
|
- // });
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
using (var db = await maindbContextFactory.CreateDbContextAsync())
|
|
|
{
|
|
|
var operation = await db.MachineOperateRecord.Where(x => x.SerialNo == requestId &&
|