จัดระเบียบ Code ใหม่ และเพิ่ม Extension Method

implement GenericRepository Class ใหม่
This commit is contained in:
Suphonchai Phoonsawat 2023-06-26 10:15:50 +07:00
parent e49c6a4aca
commit 89de09d213
21 changed files with 1439 additions and 63 deletions

View file

@ -0,0 +1,44 @@
namespace BMA.EHR.Domain.Extensions
{
public static class IntegerExtension
{
public static string ToThaiMonth(this int value)
{
switch (value)
{
case 1: return "มกราคม";
case 2: return "กุมภาพันธ์";
case 3: return "มีนาคม";
case 4: return "เมษายน";
case 5: return "พฤษภาคม";
case 6: return "มิถุนายน";
case 7: return "กรกฎาคม";
case 8: return "สิงหาคม";
case 9: return "กันยายน";
case 10: return "ตุลาคม";
case 11: return "พฤศจิกายน";
case 12: return "ธันวาคม";
default: return "";
}
}
public static int ToThaiYear(this int value)
{
if (value < 2400)
return value + 543;
else return value;
}
public static int ToCeYear(this int value)
{
if (value >= 2400)
return value - 543;
else return value;
}
public static string ToNumericText(this int number)
{
return number.ToString("#,##0");
}
}
}