Skip to content

Commit e124d57

Browse files
author
kadir.avci
committedNov 1, 2019
Created ServiceLayer, Added more functionalities
1 parent fb2ba1c commit e124d57

File tree

64 files changed

+2720
-1757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2720
-1757
lines changed
 
0 Bytes
Binary file not shown.

‎Common/Helpers/EnumHelper.cs

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace Common.Helpers
8+
{
9+
public class EnumHelper
10+
{
11+
12+
public static int GetValueOfEnum(string name, string value)
13+
{
14+
name = replaceTurkishCharacters(name);
15+
var val = 0;
16+
17+
try
18+
{
19+
val = Convert.ToInt32(Enum.Parse(Type.GetType(name), value));
20+
}
21+
catch (Exception ex)
22+
{
23+
var msg = ex.Message;
24+
}
25+
26+
return val;
27+
}
28+
29+
public static string replaceTurkishCharacters(string text)
30+
{
31+
var message = text;
32+
var oldValue = new char[] { 'ö', 'Ö', 'ü', 'Ü', 'ç', 'Ç', 'İ', 'ı', 'Ğ', 'ğ', 'Ş', 'ş' };
33+
var newValue = new char[] { 'o', 'O', 'u', 'U', 'c', 'C', 'I', 'i', 'G', 'g', 'S', 's' };
34+
35+
for (int i = 0; i < oldValue.Length; i++)
36+
{
37+
message = message.Replace(oldValue[i], newValue[i]);
38+
message = message.Replace(" ", "");
39+
}
40+
41+
string a = message.Substring(0, 1);
42+
43+
message = a.ToUpper() + message.Substring(1, message.Length - 1).ToLower();
44+
45+
return message.Trim();
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)