37 lines
1 KiB
C#
37 lines
1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|