/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="value"></param> public void Add(string key, MsDatParameter value) { if (HasKey(key) == true) { this[key] = value; } else { BaseAdd(key, value); } }
/// <summary> /// /// </summary> /// <param name="value"></param> /// <returns></returns> public bool IsNullValue(MsDatParameter value) { var _result = true; if (value != null && value.Value != null) { if (String.IsNullOrEmpty(value.Value.ToString()) == false) { _result = false; } } return(_result); }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <returns></returns> public MsDatParameter this[string key] { get { var _result = (MsDatParameter)BaseGet(key); if (_result == null) { _result = new MsDatParameter(); } return(_result); } set { BaseSet(key, value); } }
/// <summary> /// /// </summary> /// <param name="db_param"></param> /// <returns></returns> public static DateTime ToDateTime(this MsDatParameter db_param) { DateTime _result = DateTime.MinValue; if (db_param != null && db_param.Value != null) { if (db_param.Value is DateTime) { _result = (DateTime)db_param.Value; } else if (db_param.Value is String && db_param.Type == SqlDbType.DateTime) { _result = Convert.ToDateTime(db_param.Value); } } return(_result); }
/// <summary> /// /// </summary> /// <param name="db_param"></param> /// <returns></returns> public static Double ToDouble(this MsDatParameter db_param) { Double _result = 0; if (db_param != null && db_param.Value != null) { if (db_param.Value is Double) { _result = (Double)db_param.Value; } else { _result = Convert.ToDouble(db_param.Value); } } return(_result); }
/// <summary> /// /// </summary> /// <param name="db_param"></param> /// <returns></returns> public static bool ToBoolean(this MsDatParameter db_param) { var _result = false; if (db_param != null && db_param.Value != null) { if (db_param.Value is Boolean) { _result = (bool)db_param.Value; } else if (db_param.Value is String && db_param.Type == SqlDbType.NVarChar) { _result = db_param.Value.ToString() == "T"; } } return(_result); }
/// <summary> /// /// </summary> /// <param name="db_param"></param> /// <returns></returns> public static Int64 ToInt64(this MsDatParameter db_param) { Int64 _result = 0; if (db_param != null && db_param.Value != null) { if (db_param.Value is Int64) { _result = (Int64)db_param.Value; } else if (db_param.Value is Int16 || db_param.Value is Int32 || db_param.Value is Int64) { _result = Convert.ToInt64(db_param.Value); } else if (db_param.Value is String && db_param.Type == SqlDbType.Decimal) { _result = Convert.ToInt64(db_param.Value); } } return(_result); }
/// <summary> /// /// </summary> /// <param name="value"></param> public void Add(MsDatParameter value) { Add(value.Name, value.FieldType, value.Type, value.Direction, value.Value); }