init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
37
Kreta.BusinessLogic/Classes/Hacks.cs
Normal file
37
Kreta.BusinessLogic/Classes/Hacks.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
|
||||
namespace Kreta.BusinessLogic.Classes
|
||||
{
|
||||
public static class Hacks
|
||||
{
|
||||
/// <summary>
|
||||
/// Not a proper extension, just a hack.
|
||||
/// </summary>
|
||||
/// <param name="str">T or F from db</param>
|
||||
/// <returns>true if string is "T"</returns>
|
||||
public static bool AsBool(this string str)
|
||||
{
|
||||
return str == "T";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not a proper extension, just a hack.
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns>Oracle compatiblr boolean.</returns>
|
||||
public static string AsString(this bool value)
|
||||
{
|
||||
return value ? "T" : "F";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Next level hack.
|
||||
/// </summary>
|
||||
/// <param name="value">Any enum you need to persist.</param>
|
||||
/// <returns>Value of the given enum.Integer</returns>
|
||||
public static int AsInt(this Enum value)
|
||||
{
|
||||
return Convert.ToInt32(value);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue