summaryrefslogtreecommitdiff
path: root/RhSolutions.QueryModifiers/Heating
diff options
context:
space:
mode:
authorSerghei Cebotari <serghei@cebotari.ru>2023-10-13 15:04:27 +0300
committerSerghei Cebotari <serghei@cebotari.ru>2023-10-13 15:04:27 +0300
commit60fbfb5e8c27f504aa9971828ac785052a6d0822 (patch)
treef1350cc4c8b15fa4c49bfe0876c6f7e7d79ae3c7 /RhSolutions.QueryModifiers/Heating
parent52543cf7a2ec972923f5d3618dd77b366a73c92a (diff)
Refactoring
Diffstat (limited to 'RhSolutions.QueryModifiers/Heating')
-rw-r--r--RhSolutions.QueryModifiers/Heating/HeatingFittingBase.cs48
-rw-r--r--RhSolutions.QueryModifiers/Heating/SleeveQueryModifier.cs5
2 files changed, 0 insertions, 53 deletions
diff --git a/RhSolutions.QueryModifiers/Heating/HeatingFittingBase.cs b/RhSolutions.QueryModifiers/Heating/HeatingFittingBase.cs
deleted file mode 100644
index 672bd6b..0000000
--- a/RhSolutions.QueryModifiers/Heating/HeatingFittingBase.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-using System.Text.RegularExpressions;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Http.Extensions;
-
-namespace RhSolutions.QueryModifiers.Heating;
-
-public abstract class HeatingFittingBase : IProductQueryModifier
-{
- protected static readonly Regex _diameter =
- new(@"([\b\D]|^)(?<Diameter>16|20|25|32|40|50|63)([\b\D]|$)");
- protected static readonly Regex _angle =
- new(@"([\b\D]|^)(?<Angle>45|90)([\b\D]|$)");
- protected static readonly Regex _thread =
- new(@"(\D|^)(?<Thread>1\s+1/4|1\s+1/2|1/2|3/4|2|1)(\D|$)");
-
- protected virtual string _title { get; } = string.Empty;
-
- public bool TryQueryModify(IQueryCollection collection, out QueryString queryString)
- {
- queryString = QueryString.Empty;
- string query = collection["query"].ToString();
- if (string.IsNullOrEmpty(query))
- {
- return false;
- }
- string? result = BuildRhSolutionsName(query);
- if (result != null)
- {
- QueryBuilder qb = new()
- {
- { "query", result }
- };
- queryString = qb.ToQueryString();
- return true;
- }
- return false;
- }
-
- protected virtual string? BuildRhSolutionsName(string query)
- {
- var match = _diameter.Match(query);
- if (match.Success)
- {
- return $"{_title} {match.Groups["Diameter"]}";
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/RhSolutions.QueryModifiers/Heating/SleeveQueryModifier.cs b/RhSolutions.QueryModifiers/Heating/SleeveQueryModifier.cs
deleted file mode 100644
index 42fe898..0000000
--- a/RhSolutions.QueryModifiers/Heating/SleeveQueryModifier.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-namespace RhSolutions.QueryModifiers.Heating;
-public class SleeveQueryModifier : HeatingFittingBase
-{
- protected override string _title => "Монтажная гильза";
-}