/// <summary>
/// 判断警单是否存在
/// </summary>
/// <typeparam name="T">对象类型</typeparam>
/// <param name="ajbh">案件编号</param>
/// <param name="obj">对象实例(T1,T2,T3)</param>
/// <returns>true为存在,false为不存在</returns>
public bool GetCase<T>( string ajbh, T obj )
{
if (string.IsNullOrEmpty( ajbh ))
{
return true;
}
if (obj is Nullable)
{
return true;
}
int count = 0;
string sql = string.Empty;
switch (obj.GetType().Name.ToLower())
{
case "t1":
sql = string.Format( "select count(*) from t_case_1 t where t.bh='{0}'", ajbh );
break;
case "t2":
sql = string.Format( "select count(*) from t_case_2 t where t.bh='{0}'", ajbh );
break;
case "t3":
sql = string.Format( "select count(*) from t_case_3 t where t.bh='{0}'", ajbh );
break;
}
if (string.IsNullOrEmpty( sql ))
{
return true;
}
using (DbCommand cmd = database.GetSqlStringCommand( sql ))
{
count = Convert.ToInt32( database.ExecuteScalar( cmd ) );
}
if (count > 0)
{
return true;
}
else
{
return false;
}
}