Checking in latest SDALEO changes optimizing Advantage really only.

This commit is contained in:
2016-07-25 14:48:03 -04:00
parent 122796eaa3
commit 4a683f3443
114 changed files with 1173 additions and 372 deletions

83
Systems/DataRet.cs Normal file
View File

@@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Sdaleo.Systems
{
/// <summary>
/// To Deal with Data Return Type validaton / retrieval
/// </summary>
public static class DataRet
{
/// <summary>
/// Quickly retrieve a value for a given type
/// Will use default value of the type if object is null
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="oToRetrieve"></param>
/// <returns></returns>
public static T Retrieve<T>(object oToRetrieve)
{
// Create a Default Type T
T retVal = default(T);
if (oToRetrieve != null)
return ObjTool.ConvertStringToObj<T>(oToRetrieve.ToString());
return retVal;
}
/// <summary>
/// Quickly retrieve a value for a given type
/// Will use default value passed in, if object is null
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="oToRetrieve"></param>
/// <returns></returns>
public static T Retrieve<T>(object oToRetrieve, T defaultValue)
{
// Create a Default Type T
T retVal = default(T);
if (ObjTool.IsNotNullAndNotEmpty(oToRetrieve))
return ObjTool.ConvertStringToObj<T>(oToRetrieve.ToString());
else
retVal = defaultValue;
return retVal;
}
/// <summary>
/// Quickly retrieve a string value
/// Will use default value passed in, if string is null
/// </summary>
/// <param name="oToRetrieve"></param>
/// <param name="bTrim">set to true to Trim() the string</param>
/// <returns></returns>
public static string Retrieve(object oToRetrieve, string defaultValue, bool bTrim)
{
string retVal = String.Empty;
if (ObjTool.IsNotNullAndNotEmpty(oToRetrieve))
{
retVal = oToRetrieve.ToString();
if (bTrim)
retVal = retVal.Trim();
return retVal;
}
else
{
retVal = defaultValue;
}
return retVal;
}
/// <summary>
/// Quickly retrieve a string value
/// Will use "", if string is null.
/// Will automatically call Trim().
/// </summary>
/// <returns></returns>
public static string Retrieve(object oToRetrieve)
{
return Retrieve(oToRetrieve, String.Empty, true);
}
}
}