public static bool IsKeyConflicted(int configObjectType, string key) { string sql = "SELECT * FROM RiMEConfig.dbo.Config WHERE iConfigObjectType = @configObjectType AND vcKey = @key"; return(SqlServerHelper.Query(sql, new SqlParameter("configObjectType", configObjectType), new SqlParameter("key", key)).Rows.Count > 0); }
/// <summary> /// Gets the maximum key value allocated in the [RiMEConfig].[dbo].[Config] table for a special type. /// </summary> /// <param name="configObjectType">A integer value that represents the type of the config object.</param> /// <returns>The maximum key value.</returns> public static string GetMaxKeyOfConfig(int configObjectType) { string sql = "SELECT TOP 1 vcKey FROM RiMEConfig.dbo.Config WHERE iConfigObjectType = @configObjectType ORDER BY CAST(vcKey AS INT) DESC"; return((string)SqlServerHelper.QueryScaler(sql, new SqlParameter("configObjectType", configObjectType))); }