示例#1
0
 /// <summary>
 /// Instancia a classe atrav;es de um tableField
 /// </summary>
 /// <param name="field">Um TableAdapterField</param>
 public QueryParam(TableAdapterField field)
     : this()
 {
     AliasTableName = field.TableAlias;
     AliasName      = field.Alias;
     FieldName      = field.Name;
     DbType         = field.DbType;
     Condition      = eCondition.ecEqual;
     Value1         = field.Value;
 }
 /// <summary>
 /// Cosntrutor padrão
 /// </summary>
 /// <param name="pTableAdapterField"></param>
 public TableAdapterField(TableAdapterField pTableAdapterField)
     : this()
 {
     Alias        = pTableAdapterField.Alias;
     TableAlias   = pTableAdapterField.TableAlias;
     Name         = pTableAdapterField.Name;
     Description  = pTableAdapterField.Description;
     DbType       = pTableAdapterField.DbType;
     Value        = pTableAdapterField.Value;
     DefaultValue = pTableAdapterField.DefaultValue;
     Size         = pTableAdapterField.Size;
     Key          = pTableAdapterField.Key;
     Identity     = pTableAdapterField.Identity;
     Precision    = pTableAdapterField.Precision;
     Scale        = pTableAdapterField.Scale;
     FieldType    = pTableAdapterField.FieldType;
 }
示例#3
0
        /// <summary>
        /// Atribui parametros ao comando
        /// </summary>
        /// <param name="columns">Lista de Colunas</param>
        private List <TableAdapterField> GetParameters(IEnumerable <TableAdapterField> columns)
        {
            var parameters = new List <TableAdapterField>();

            foreach (var column in columns)
            {
                var param = new TableAdapterField
                {
                    Name   = column.Name,
                    DbType = column.DbType,
                    Value  = column.Value ?? DBNull.Value
                };

                parameters.Add(param);
            }

            return(parameters);
        }
示例#4
0
        /// <summary>
        /// Pega uma string com o tipo do SQL Server de Criação
        /// </summary>
        /// <param name="tableAdapterField">o campo</param>
        /// <returns></returns>
        private string GetCreateFieldType(TableAdapterField tableAdapterField)
        {
            string fieldType = null;

            switch (tableAdapterField.DbType)
            {
            case DbType.AnsiString:
                fieldType = " VARCHAR (" + tableAdapterField.Size + ")";
                break;

            case DbType.AnsiStringFixedLength:
                fieldType = " CHAR (" + tableAdapterField.Size + ")";
                break;

            case DbType.String:
                fieldType = " NVARCHAR (" + tableAdapterField.Size + ")";
                break;

            case DbType.StringFixedLength:
                fieldType = " Char (" + tableAdapterField.Size + ")";
                break;

            case DbType.Boolean:
                fieldType = " BIT ";
                break;

            case DbType.Binary:
                fieldType = " VarBinary (MAX)";
                break;

            case DbType.Byte:
                fieldType = " BYTE ";
                break;

            case DbType.Currency:
                fieldType = " MONEY (" + tableAdapterField.Precision + ", " + tableAdapterField.Scale + ")";
                break;

            case DbType.Date:
                fieldType = " DATETIME ";
                break;

            case DbType.DateTime:
                fieldType = " DATETIME ";
                break;

            case DbType.DateTime2:
                fieldType = " DATETIME ";
                break;

            case DbType.DateTimeOffset:
                fieldType = " TIMESTANT ";
                break;

            case DbType.Decimal:
                fieldType = " DECIMAL (" + tableAdapterField.Precision + ", " + tableAdapterField.Scale + ")";
                break;

            case DbType.Double:
                fieldType = " DOUBLE ";
                break;

            case DbType.Guid:
                fieldType = " uniqueidentifier ";
                break;

            case DbType.Int16:
                fieldType = " smallint ";
                break;

            case DbType.Int32:
                fieldType = " int ";
                break;

            case DbType.Int64:
                fieldType = " BigInt ";
                break;

            case DbType.Object:
                fieldType = " VarBinary(MAX) ";
                break;

            case DbType.SByte:
                fieldType = " TINYINT ";
                break;

            case DbType.Single:
                fieldType = " DECIMAL (" + tableAdapterField.Precision + ", " + tableAdapterField.Scale + ")";
                break;

            case DbType.Time:
                fieldType = " DateTime ";
                break;

            case DbType.UInt16:
                fieldType = " SMALLINT  ";
                break;

            case DbType.UInt32:
                fieldType = " INT ";
                break;

            case DbType.UInt64:
                fieldType = " BIGINT ";
                break;

            case DbType.VarNumeric:
                fieldType = " BIGINT ";
                break;

            case DbType.Xml:
                break;
            }

            return(fieldType);
        }
示例#5
0
 /// <summary>
 /// Instancia a classe através do objeto TableField e atribui uma condicional que exige 2 valores.
 /// </summary>
 /// <param name="pField">Um TableAdaterField</param>
 /// <param name="pCondition">Uma condição</param>
 /// <param name="pValue1">Um valor qualquer</param>
 /// <param name="pValue2">Um segundo valor</param>
 public QueryParam(TableAdapterField pField, eCondition pCondition, object pValue1, object pValue2)
     : this(pField, pCondition, pValue1)
 {
     Value2 = pValue2;
 }
示例#6
0
 /// <summary>
 /// Instancia a classe através do objeto TableField e atribui uma condicional que exige valor.
 /// </summary>
 /// <param name="pField">Um TableAdaterField</param>
 /// <param name="pCondition">Uma condição</param>
 /// <param name="pValue1">Um valor qualquer</param>
 public QueryParam(TableAdapterField pField, eCondition pCondition, object pValue1)
     : this(pField, pValue1)
 {
     Condition = pCondition;
     Value1    = pValue1;
 }
示例#7
0
 /// <summary>
 /// Instancia a classe através do objeto TableField e atribui uma condicional que não exige valor.
 /// </summary>
 /// <param name="pField">Um TableAdaterField</param>
 /// <param name="pCondition">Uma condição</param>
 public QueryParam(TableAdapterField pField, eCondition pCondition)
     : this(pField)
 {
     Condition = pCondition;
 }
示例#8
0
 /// <summary>
 ///Instancia a classe e atribui a condiciona de Between
 /// </summary>
 /// <param name="pField">Um TableAdaterField</param>
 /// <param name="pValue1">Primeiro valor, de</param>
 /// <param name="pValue2">Segundo valor, até.</param>
 public QueryParam(TableAdapterField pField, object pValue1, object pValue2)
     : this(pField, pValue1)
 {
     Value2 = pValue2;
     SetConditionValue(pValue1, pValue2);
 }
示例#9
0
 /// <summary>
 /// Instancia a classe e atribui a condiciona de igual ao campo valor
 /// </summary>
 /// <param name="field">Um tableFiel</param>
 /// <param name="pValue1">Um valor</param>
 public QueryParam(TableAdapterField field, object pValue1)
     : this(field)
 {
     Value1 = pValue1;
 }