Skip to content

Commit

Permalink
#604_concatenation_in_loop (#619)
Browse files Browse the repository at this point in the history
* feature/604_concatenation_in_loop

* modification_langue

Co-authored-by: crib <[email protected]>
Co-authored-by: salim ben ahben <[email protected]>
  • Loading branch information
3 people authored Apr 22, 2022
1 parent 0c90453 commit b2c7de5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/AzureIoTHub.Portal/Server/Services/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ namespace AzureIoTHub.Portal.Server.Services
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Extensions;
using Microsoft.Azure.Devices;
Expand Down Expand Up @@ -100,10 +102,13 @@ public async Task RollOutDeviceConfiguration(
newConfiguration.Labels.Add("created-by", "Azure IoT hub Portal");
newConfiguration.Labels.Add("configuration-id", configurationId);

var targetCondition = string.Empty;
var culture = CultureInfo.CreateSpecificCulture("en-En");
var targetCondition = new StringBuilder();

foreach (var item in targetTags)
{
targetCondition += $" and tags.{item.Key} = '{item.Value}'";
_ = targetCondition.AppendFormat(culture, " and tags.{0}", item.Key);
_ = targetCondition.AppendFormat(culture, " = '{0}'", item.Value);
}

newConfiguration.TargetCondition = $"tags.modelId = '{modelId}'" + targetCondition;
Expand Down

0 comments on commit b2c7de5

Please sign in to comment.