0
0
RhSolutions-Api/RhSolutions.QueryModifiers/DrinkingWaterHeatingFittings/Coupling.cs

27 lines
766 B
C#

namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class Coupling : DrinkingWaterHeatingFitting
{
protected override string _title => "Муфта соединительная";
protected override string? BuildRhSolutionsName(string query)
{
var diametersMatches = _diameter.Matches(query);
if (diametersMatches.Count == 0)
{
return null;
}
var diameters = diametersMatches.Select(x => x.Groups["Diameter"].Value)
.Take(2)
.OrderByDescending(x => int.Parse(x))
.ToArray();
if (diameters.Length == 1 || diameters[0] == diameters[1])
{
return $"{_title} равнопроходная {diameters[0]}";
}
else
{
return $"{_title} переходная {diameters[0]}-{diameters[1]}";
}
}
}