public static bool DeleteBySite(int siteId) { DBMediaFile.DeleteBySite(siteId); StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_MediaTrack "); sqlCommand.Append("WHERE "); sqlCommand.Append("PlayerID IN (SELECT PlayerID FROM mp_MediaPlayer WHERE ModuleID IN ( "); sqlCommand.Append("SELECT ModuleID FROM mp_Modules WHERE SiteID = @SiteID)) "); sqlCommand.Append(";"); FbParameter[] arParams = new FbParameter[1]; arParams[0] = new FbParameter("@SiteID", FbDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; int rowsAffected = FBSqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), sqlCommand.ToString(), arParams); return(rowsAffected > -1); }
public static bool DeleteBySite(int siteId) { DBMediaFile.DeleteBySite(siteId); StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("DELETE FROM mp_mediatrack "); sqlCommand.Append("WHERE "); sqlCommand.Append("playerid IN (SELECT playerid FROM mp_mediaplayer WHERE moduleid IN ( "); sqlCommand.Append("SELECT moduleid FROM mp_modules WHERE siteid = :siteid)) "); sqlCommand.Append(";"); NpgsqlParameter[] arParams = new NpgsqlParameter[1]; arParams[0] = new NpgsqlParameter("siteid", NpgsqlTypes.NpgsqlDbType.Integer); arParams[0].Direction = ParameterDirection.Input; arParams[0].Value = siteId; int rowsAffected = NpgsqlHelper.ExecuteNonQuery( ConnectionString.GetWriteConnectionString(), CommandType.Text, sqlCommand.ToString(), arParams); return(rowsAffected > -1); }