|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tools
{
public class Tools
{
public static int IifInt(object obj)
{
if (obj != null)
{
return Convert.ToInt32(obj);
}
return 0;
}
public static int IifInt(string obj)
{
if (obj == string.Empty)
{
return 0;
}
if (obj != null)
{
return Convert.ToInt32(obj);
}
return 0;
}
public static double IifDbl(object obj)
{
if (obj != null)
{
return Convert.ToDouble(obj);
}
return 0.00;
}
public static double IifDbl(string obj)
{
if (obj != null)
{
return Convert.ToDouble(obj);
}
return 0.00;
}
public static string IifStr(object obj)
{
if (obj != null)
{
return Convert.ToString(obj);
}
return string.Empty;
}
public static DateTime IifDT(object obj)
{
var retVal = Convert.ToDateTime("01/01/01");
if (obj != null)
{
try
{
retVal = Convert.ToDateTime(obj);
}
catch (Exception)
{
return retVal;
}
}
return retVal;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
MCTS - Microsoft Certified Technology Specialist.
An Accountant.
Had been developed Payroll Accounting System Application
Live in: Quezon City, Metro Manila Philippines
Could reached at email address: ag_mojedo@live.com