Пример #1
0
 internal void RaiseAfeterAlterTable(TableAdapter tableAdapterForAlter)
 {
     if (OnAfterAlterTable != null)
     {
         OnAfterAlterTable(tableAdapterForAlter, new TableAdapterEventArgs());
     }
 }
Пример #2
0
        /// <summary>
        /// Altera uma tabela
        /// </summary>
        /// <param name="pTable">Tabela</param>
        /// <param name="pFields">Campos as ser aterado</param>
        public void AlterTable(TableAdapter pTable, IEnumerable <TableAdapterField> pFields)
        {
            var script = new SqlServerScriptWizard();

            var table = new TableAdapter(pTable.DBName, pTable.TableName);

            table.Collumns.AddRange(pFields.ToList());

            Connection.Instance.SqlServerExecute(script.GetAlterTableCommand(table));

            pTable.RaiseAfeterAlterTable(table);
        }
Пример #3
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;
        }
Пример #4
0
        /// <summary>
        /// Instancia um objeto e atribui as chaves como compos de condição
        /// </summary>
        /// <param name="pTableAdapter">Um table adapter</param>
        /// <param name="pKeysAsWhere"></param>
        public TableQuery(TableAdapter pTableAdapter, bool pKeysAsWhere = false)
            : this()
        {
            Fields.AddRange(pTableAdapter.Collumns);
            DbName         = pTableAdapter.DBName;
            TableName      = pTableAdapter.TableName;
            SchemaTable    = pTableAdapter.SchemaTable;
            WithoutNotLock = pTableAdapter.WithoutNotLock;

            if (!pKeysAsWhere)
            {
                return;
            }

            foreach (var myItem in pTableAdapter.KeyFields)
            {
                Where.Add(new QueryParam(myItem));
            }
        }
Пример #5
0
 public Navigation(TableAdapter pTableAdapter)
 {
     _tableObj = pTableAdapter;
 }