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

30 lines
812 B
C#
Raw Permalink Normal View History

2023-10-13 15:04:27 +03:00
namespace RhSolutions.QueryModifiers.DrinkingWaterHeatingFittings;
public class Coupling : DrinkingWaterHeatingFitting
{
protected override string _title => "Муфта соединительная";
2023-10-22 13:43:18 +03:00
public override bool TryQueryModify(string input, out string output)
2023-10-13 15:04:27 +03:00
{
2023-10-22 13:43:18 +03:00
output = string.Empty;
var diametersMatches = _diameter.Matches(input);
if (diametersMatches.Count == 0)
2023-10-13 15:04:27 +03:00
{
2023-10-22 13:43:18 +03:00
return false;
2023-10-13 15:04:27 +03:00
}
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])
2023-10-22 13:43:18 +03:00
{
output = $"{_title} равнопроходная {diameters[0]}";
}
else
{
output = $"{_title} переходная {diameters[0]}-{diameters[1]}";
}
return true;
2023-10-13 15:04:27 +03:00
}
}