Example #1
0
        protected static DbParameter CreateOutputParameter(string name, SqlDbType paramType)
        {
            var parameter = SqlDbFactory.CreateParameter(paramType);

            parameter.ParameterName = name;
            parameter.Direction     = ParameterDirection.Output;
            return(parameter);
        }
Example #2
0
        protected static DbCommand GetDbSprocCommand(string storedProcedureName)
        {
            var command = SqlDbFactory.CreateCommand(storedProcedureName);

            command.Connection  = GetDbConnection();
            command.CommandType = CommandType.StoredProcedure;
            return(command);
        }
Example #3
0
        protected static DbParameter CreateNullParameter(string name, SqlDbType paramType, int size)
        {
            var parameter = SqlDbFactory.CreateParameter(paramType);

            parameter.ParameterName = name;
            parameter.Size          = size;
            parameter.Value         = null;
            parameter.Direction     = ParameterDirection.Input;
            return(parameter);
        }
Example #4
0
 protected static DbParameter CreateParameter(string name, Guid?value)
 {
     if (!value.HasValue)
     {
         return(CreateNullParameter(name, SqlDbType.UniqueIdentifier));
     }
     else
     {
         var parameter = SqlDbFactory.CreateParameter(SqlDbType.UniqueIdentifier);
         parameter.ParameterName = name;
         parameter.Value         = value.Value;
         parameter.Direction     = ParameterDirection.Input;
         return(parameter);
     }
 }
Example #5
0
 protected static DbParameter CreateParameter(string name, string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         return(CreateNullParameter(name, SqlDbType.NVarChar));
     }
     else
     {
         var parameter = SqlDbFactory.CreateParameter(SqlDbType.NVarChar);
         parameter.ParameterName = name;
         parameter.Value         = value;
         parameter.Direction     = ParameterDirection.Input;
         return(parameter);
     }
 }
Example #6
0
 public static DbConnection GetDbConnection()
 {
     return(SqlDbFactory.CreateConnection(ConnectionString));
 }