public static int InsertObject(object obj, DALBaseProvider provider, string spName) { try { DbCommand storedProcCommand = ((Database)SqlDatabaseHelper.database).GetStoredProcCommand(spName); SqlDatabaseHelper.AddParameterForObject(obj, provider, storedProcCommand); ((Database)SqlDatabaseHelper.database).ExecuteNonQuery(storedProcCommand); return((int)((Database)SqlDatabaseHelper.database).GetParameterValue(storedProcCommand, SqlDatabaseHelper.GetPrimaryKeyColumn(provider.TableName))); } catch (Exception ex) { throw ex; } }