Initial commit: JDE Scoping Tool migration project
Set up repository with legacy .NET Framework 4.8 source (OLD/), new .NET 10 Blazor solution (NEW/), OpenSpec specifications, documentation, and project configuration.
This commit is contained in:
Executable
+53
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace DataModel.Helpers
|
||||
{
|
||||
/// <summary>
|
||||
/// SQL server ADO helpers
|
||||
/// </summary>
|
||||
public static class SqlHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Binds the parameter to the command
|
||||
/// </summary>
|
||||
/// <param name="command">Command to bind parameter to</param>
|
||||
/// <param name="parameterName">Name of parameter</param>
|
||||
/// <param name="parameterValue">Value of parameter</param>
|
||||
/// <returns>Bound parameter</returns>
|
||||
public static SqlParameter Bind(this SqlCommand command, string parameterName, object parameterValue)
|
||||
{
|
||||
return parameterValue != null
|
||||
? command.Parameters.AddWithValue(parameterName, parameterValue)
|
||||
: command.Parameters.AddWithValue(parameterName, DBNull.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds the parameter to the command
|
||||
/// </summary>
|
||||
/// <param name="command">Command to bind parameter to</param>
|
||||
/// <param name="parameterName">Name of parameter</param>
|
||||
/// <param name="parameterValue">Value of parameter</param>
|
||||
/// <returns>Bound parameter</returns>
|
||||
public static SqlParameter Bind(this SqlCommand command, string parameterName, string parameterValue)
|
||||
{
|
||||
return !string.IsNullOrEmpty(parameterValue) ?
|
||||
command.Parameters.AddWithValue(parameterName, parameterValue) :
|
||||
command.Parameters.AddWithValue(parameterName, DBNull.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds the parameter to the command
|
||||
/// </summary>
|
||||
/// <param name="command">Command to bind parameter to</param>
|
||||
/// <param name="parameterName">Name of parameter</param>
|
||||
/// <param name="parameterValue">Value of parameter</param>
|
||||
/// <returns>Bound parameter</returns>
|
||||
public static SqlParameter Bind(this SqlCommand command, string parameterName, byte[] parameterValue)
|
||||
{
|
||||
return parameterValue != null ?
|
||||
command.Parameters.AddWithValue(parameterName, parameterValue) :
|
||||
command.Parameters.AddWithValue(parameterName, DBNull.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user