Логика создания шаблонов
This commit is contained in:
15
PARR.BLL/Helpers/SqlHelpers.cs
Normal file
15
PARR.BLL/Helpers/SqlHelpers.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace PARR.BLL.Helpers
|
||||
{
|
||||
public static class SqlHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Преобразует Regex в Like для SQL
|
||||
/// </summary>
|
||||
/// <param name="regexPattern"></param>
|
||||
/// <returns></returns>
|
||||
public static string RegexToLike(string regexPattern)
|
||||
{
|
||||
return regexPattern.Replace("*", "%").ToLower();
|
||||
}
|
||||
}
|
||||
}
|
||||
21
PARR.BLL/Helpers/TemplateHelpers.cs
Normal file
21
PARR.BLL/Helpers/TemplateHelpers.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
namespace PARR.BLL.Helpers
|
||||
{
|
||||
public static class TemplateHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Генерация имени шаблона
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
/// <param name="ek"></param>
|
||||
/// <param name="work"></param>
|
||||
/// <returns></returns>
|
||||
public static string GenerateTemplateName(string prefix, string ek, string work)
|
||||
{
|
||||
if (string.IsNullOrEmpty(prefix))
|
||||
prefix = "ПАРР-PREFIX";
|
||||
|
||||
var splitter = "__";
|
||||
return prefix + splitter + ek + splitter + work.Replace(" ", "-").ToUpper();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user