Esempio n. 1
0
        /// <summary>
        /// Instancie o objeto e clona
        /// </summary>
        /// <param name="pTableQuery">Objeto table query</param>
        public TableQuery(TableQuery pTableQuery)
            : this()
        {
            DbName      = pTableQuery.DbName;
            TableName   = pTableQuery.TableName;
            FieldName   = pTableQuery.FieldName;
            Alias       = pTableQuery.Alias;
            SchemaTable = pTableQuery.SchemaTable;
            Top         = pTableQuery.Top;
            Distinct    = pTableQuery.Distinct;

            Fields = new TableAdapterFieldCollection(pTableQuery.Fields);

            foreach (OrderBy myItem in pTableQuery.OrderBy)
            {
                OrderBy.Add(new OrderBy(myItem));
            }

            pTableQuery.Wheres.ForEach(
                w => Wheres.Add(new WhereCollection(w)));

            if (pTableQuery.Joins != null)
            {
                pTableQuery.Joins.ForEach(
                    j => Joins.Add(new Join(j)));
            }

            if (pTableQuery.Union != eUnionType.eutNone)
            {
                pTableQuery.InternalQuery.ForEach(
                    c => InternalQuery.Add(new TableQuery(c)));
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="pTableAdapterFieldCollection"></param>
        public TableAdapterFieldCollection(TableAdapterFieldCollection pTableAdapterFieldCollection)
        {
            AllFields = pTableAdapterFieldCollection.AllFields;

            foreach (var myItem in pTableAdapterFieldCollection)
            {
                Add(new TableAdapterField(myItem));
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Construtor padrão
 /// </summary>
 public TableQuery()
 {
     Fields        = new TableAdapterFieldCollection();
     Wheres        = new List <WhereCollection>();
     OrderBy       = new List <OrderBy>();
     Union         = eUnionType.eutAll;
     InternalQuery = new List <TableQuery>();
     Joins         = new List <Join>();
     Top           = -1;
 }
Esempio n. 4
0
        /// <summary>
        /// Instancia um objeto TableAdapter
        /// </summary>
        public TableAdapter()
        {
            Collumns               = new TableAdapterFieldCollection();
            KeyFields              = new TableAdapterFieldCollection();
            InicialValues          = new List <TableAdapter>();
            PropertyChangedNotify  = new List <string>();
            PropertyChangingNotify = new List <string>();
            LogCollection          = new List <Log>();

            FillCollumns();
        }
Esempio n. 5
0
        /// <summary>
        /// Instancia um objeto e atribui um alias para uma pesquisa mais complexa.
        /// </summary>
        /// <param name="pTableAdapter">Um TableAdpter</param>
        /// <param name="pWithFields">Chaves como clásula where</param>
        /// <param name="pAlias">Alias da tabela</param>
        public TableQuery(TableAdapter pTableAdapter, bool pWithFields, string pAlias)
            : this(pTableAdapter, false)
        {
            if (!pWithFields)
            {
                Fields = new TableAdapterFieldCollection();
            }

            foreach (var item in pTableAdapter.Collumns)
            {
                item.TableAlias = pAlias;
            }

            Alias = pAlias;
        }
Esempio n. 6
0
        /// <summary>
        /// Pega as colunas de um objeto DataObjec
        /// </summary>
        /// <param name="pObject">Um Objeto</param>
        /// <returns>Uma lista de campis</returns>
        public static TableAdapterFieldCollection GetCollumns(DataObject pObject)
        {
            var fields = new TableAdapterFieldCollection();

            foreach (var property in GetFields(pObject.GetType()))
            {
                var prop = property.GetValue(pObject) as TableAdapterField;

                if (prop == null)
                {
                    continue;
                }
                prop.TableAdapter = pObject as TableAdapter;
                fields.Add(prop);
            }

            return(fields);
        }