public static double GetLambdaValue(Node item) { DbConnection.Initialise(StringConnection); Int64 ID = item.ID_Type; string col = "ID_Type"; { if (ID == 0) { if (item.ID_Scroll == 0) { ID = item.ID_Class; col = "ID_Class"; } else { ID = item.ID_Scroll; col = "ID_Scroll"; } } } using (var value = TableAdapter <Lambda> .Open()) return(value.Select().Where(Where.Equal(col, Convert.ToInt64(ID))).ToList()[0].Value * Math.Pow(10, -6)); }
private void AlterTable(TableAdapter tableLog) { var script = new ScriptWizard.SqlServerScriptWizard(); var query = script.GetAlterTableCommand(tableLog); Connection.Instance.SqlServerExecute(query); }
public static T Read(params object[] args) { using (TableAdapter <T> adapter = TableAdapter <T> .Open()) { return(adapter.Read(args)); } }
public virtual void Save() { using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0])) { adapter.CreateUpdate(new object[] { this }); } }
private void CopyFields(TableAdapter tableLog) { foreach (var collumn in tableLog.Collumns) { _tableLog.Collumns.Add(CloneTableField(collumn)); } }
public static void Delete(params object[] args) { using (TableAdapter <T> adapter = TableAdapter <T> .Open()) { adapter.Delete(args); } }
private void Init() { RectOffset margin = new RectOffset(4, 4, 4, 4); RectOffset padding = new RectOffset(3, 3, 3, 3); mCustomFieldTextStyle = new GUIStyle(EditorStyles.textField); mCustomFieldTextStyle.margin = margin; mCustomFieldTextStyle.padding = padding; mCustomFieldTextStyle.alignment = TextAnchor.MiddleRight; mPlaceHolderTextStyle = new GUIStyle(EditorStyles.textField); mPlaceHolderTextStyle.alignment = TextAnchor.MiddleLeft; mPlaceHolderTextStyle.fontStyle = FontStyle.Italic; mCollectionDataTextStyle = new GUIStyle(EditorStyles.textField); mCollectionDataTextStyle.alignment = TextAnchor.MiddleLeft; mCollectionNameButtonStyle = new GUIStyle(EditorStyles.miniButtonMid); mCollectionNameButtonStyle.fontSize = 11; mCollectionNameButtonStyle.alignment = TextAnchor.MiddleLeft; mAssetManager = ScriptableObject.CreateInstance("AssetManager") as AssetManager; mSelectedTypeIndex = -1; mAdapter = new TableAdapter(mAssetManager, this, 2); RefreshVersions(); }
public static void Do(Action <TableAdapter <T> > action) { using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0])) { action(adapter); } }
private async void GetTables() { tableList = await tableService.RefreshDataAsync(); adapter = new TableAdapter(this, tableList); listViewTableView.Adapter = adapter; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Sources); // Adding Toolbar to Main screen Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); toolbar.Title = "Srautai"; SetSupportActionBar(toolbar); TabLayout tabs = FindViewById <TabLayout>(Resource.Id.tabs); TableAdapter adapter = new TableAdapter(SupportFragmentManager); ViewPager viewPager = FindViewById <ViewPager>(Resource.Id.viewpager); adapter.AddFragment(new SubscribedSourcesFragment(), "Subscribed"); adapter.AddFragment(new AllSourcesFragment(), "All"); adapter.AddFragment(new CreatedSourcesFragment(), "Created"); viewPager.Adapter = adapter; tabs.SetupWithViewPager(viewPager); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += Fab_Click; }
private static void CheckIfOnlyOneKey(TableAdapter tableAdapter) { if (!tableAdapter.KeyFields.Any()) { throw new Exception( "Para habilitar o autoLog deve haver ao menos uma chave: Tabela [{0}.{1}]" .Fmt(tableAdapter.DBName, tableAdapter.TableName)); } }
public static string GetDefDesign(Node item) { DbConnection.Initialise(StringConnection); using (var rows = TableAdapter <Class> .Open()) { return(rows.Select().First(tbl => (tbl.ID == item.ID_Class)).DefDesign); } }
public IList <ProductCategory> SelectList() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <ProductCategory> adapter = TableAdapter <ProductCategory> .Open()) { return(adapter.Select().ToList()); } } }
public static T Read(params object[] args) { T t; using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0])) { t = adapter.Read(args); } return(t); }
private TableAdapter GetTableLogUsingThis(IEnumerable <TableAdapterField> fields) { var tableLog = new TableAdapter(); tableLog.CopyBy(_tableLog); tableLog.Collumns.Clear(); tableLog.Collumns.AddRange(fields); return(tableLog); }
public IList <ExtractValueName> SelectList() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <ExtractValueName> adapter = TableAdapter <ExtractValueName> .Open()) { return(adapter.Select().ToList()); } } }
public IList <SensorType> SelectList() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <SensorType> adapter = TableAdapter <SensorType> .Open()) { return(adapter.Select().ToList()); } } }
public IList <DataFilter> SelectList() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <DataFilter> adapter = TableAdapter <DataFilter> .Open()) { return(adapter.Select().ToList()); } } }
public System.Collections.Generic.IList <TableFieldInfo> SelectList() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <TableFieldInfo> adapter = TableAdapter <TableFieldInfo> .Open()) { return(adapter.Select().ToList()); } } }
public IList <FormulaInfo> SelectList() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <FormulaInfo> adapter = TableAdapter <FormulaInfo> .Open()) { return(adapter.Select().ToList()); } } }
static User() { _adapter = new Mong.DatabaseSetTableAdapters.�ϥΪ�TableAdapter(); _userTypeMapping = new Dictionary<int, UserType>(); _userTypeMapping.Add(User.Administrator, UserType.Administrator); _userTypeMapping.Add(User.Manager, UserType.Manager); _userTypeMapping.Add(User.Ganger, UserType.Ganger); _userTypeMapping.Add(User.QA, UserType.QA); _userTypeMapping.Add(User.Guest, UserType.Guest); }
public IList <ExtractionConfig> SelectConfigs() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <ExtractionConfig> adapter = TableAdapter <ExtractionConfig> .Open()) { return(adapter.Select().ToList()); } } }
public IList <PacketsToSend> SelectAllCacheDataPackets() { using (DbConnection conn = new DbConnection()) { using (TableAdapter <PacketsToSend> adapter = TableAdapter <PacketsToSend> .Open()) { return(adapter.Select().ToList()); } } }
/// <summary> /// Pega o comando de alteração da tabela /// </summary> /// <param name="pTable">Um Table Adapter</param> /// <returns>Um string com o comando de alteração</returns> public string GetAlterTableCommand(TableAdapter pTable) { var stringBulder = new StringBuilder(); stringBulder.AppendLine(" ALTER TABLE "); stringBulder.Append(GetTableName(pTable.DBName, pTable.TableName, string.Empty, false)); stringBulder.Append(GetAddColumns(pTable.Collumns)); return(stringBulder.ToString()); }
public static TReturn Get <TReturn>(Func <TableAdapter <T>, TReturn> action) where TReturn : class { TReturn tReturn; using (TableAdapter <T> adapter = TableAdapter <T> .Open(new object[0])) { tReturn = action(adapter); } return(tReturn); }
private async void GetTables() { tableList = await tableService.RefreshDataAsync(); tableList = (from Table t in tableList where t.StaffId == null select t).ToList(); adapter = new TableAdapter(this, tableList); listviewStartTable.Adapter = adapter; }
public ChangeLogForm(TableAdapter pTableAdapter) { if (!pTableAdapter.AutoLog) { throw new Exception(string.Format("Entidade {0} não controla log", pTableAdapter.TableName)); } _tableAdapter = new TableAdapterLog(pTableAdapter); InitializeComponent(); InitilizeForm(); SetEvents(); }
public virtual int Save() { using (TableAdapter <T> adapter = TableAdapter <T> .Open()) { Int64 i = adapter.CreateUpdate(this); if (i > 0) { return((int)i); } return(0); } }
/// <summary> /// Instanciar o TableLog /// </summary> /// <param name="tableAdapter">Tabela Base de Criação de Log</param> public TableAdapterLog(TableAdapter tableAdapter) { CheckIfOnlyOneKey(tableAdapter); CopyFields(tableAdapter); AddLogFields(); _tableLogBase = tableAdapter; _tableLogBase.OnAfterAdd += tableAdpterBaser_OnAfterAdd; _tableLogBase.OnAfterUpdate += tableAdpterBase_OnAfterUpdate; _tableLogBase.OnAfterCreate += tableAdpterBase_OnAfterCreate; _tableLogBase.OnAfterAlterTable += tableAdpterBase_OnAfterAlterTable; }
private void Dado_uma_tabela_com_mais_de_uma_chave_e_log_ativado() { _tableWith2Keys = new TableAdapter(new DbTesteNampula().DataBaseName, "Fke2Keys"); _tableWith2Keys.Collumns.Add(new TableAdapterField("Key1", "Key1", DbType.Int32, 11, null, true, false)); _tableWith2Keys.Collumns.Add(new TableAdapterField("Key2", "Key2", DbType.Int32, 11, null, true, false)); _tableWith2Keys.Collumns.Add(new TableAdapterField("Record", "Record", 120)); _tableWith2Keys.KeyFields.Add(_tableWith2Keys.Collumns[0]); _tableWith2Keys.KeyFields.Add(_tableWith2Keys.Collumns[1]); _tableWith2Keys.SetAutoLog(); _tableWith2Keys.Create(); }
public static string GetName(Int64 ID) { DbConnection.Initialise(StringConnection); /* List<Scroll> row; * using (var name = TableAdapter<Scroll>.Open()) * row = name.Select().Where(tbl => tbl.ID == Convert.ToInt64(ID)).ToList(); * if (row == null) * return null; * else * return row[0].Name;*/ using (var name = TableAdapter <Scroll> .Open()) return(name.Select().FirstOrDefault(tbl => tbl.ID == Convert.ToInt64(ID)).Name); }
private void Init() { RectOffset margin = new RectOffset(4, 4, 4, 4); RectOffset padding = new RectOffset(3, 3, 3, 3); mCustomFieldTextStyle = new GUIStyle(EditorStyles.textField); mCustomFieldTextStyle.margin = margin; mCustomFieldTextStyle.padding = padding; mCustomFieldTextStyle.alignment = TextAnchor.MiddleRight; mPlaceHolderTextStyle = new GUIStyle(EditorStyles.textField); mPlaceHolderTextStyle.alignment = TextAnchor.MiddleLeft; mPlaceHolderTextStyle.fontStyle = FontStyle.Italic; mCollectionDataTextStyle = new GUIStyle(EditorStyles.textField); mCollectionDataTextStyle.alignment = TextAnchor.MiddleLeft; mCollectionNameButtonStyle = new GUIStyle(EditorStyles.miniButtonMid); mCollectionNameButtonStyle.fontSize = 11; mCollectionNameButtonStyle.alignment = TextAnchor.MiddleLeft; mAssetManager = ScriptableObject.CreateInstance("AssetManager") as AssetManager; mSelectedTypeIndex = -1; mAdapter = new TableAdapter(mAssetManager, this, 2); RefreshVersions(); }
public TableView(TableAdapter adapter) { mAdapter = adapter; }
public void SetAdapter(TableAdapter adapter) { mAdapter = adapter; }
private void OnGUI() { mRect = new Rect(MARGIN, MARGIN, CELL_WIDTH, CELL_HEIGHT); VersionsGUI(); if (!mTypesLoaded && !mAssetsLoaded) { mRect.width = CELL_WIDTH * 3; EditorGUI.LabelField(mRect, isEditCollectionName ? "Collection saving..." : "Loading collections and assets..."); } else if (!mTypesLoaded && mAssetsLoaded) { mRect.width = CELL_WIDTH * 3; EditorGUI.LabelField(mRect, isEditCollectionName ? "Collection saving..." : "Assets loaded. Waiting for collections..."); } else if (mTypesLoaded) { if (isEditCollectionName) { EditCollectionUI(); } else { CollectionsGUI(); } if (!mAssetsLoaded) { EditorGUI.LabelField(mRect, isEditCollectionName ? "Collection saving..." : "Loading assets..."); } else { if (mAssetManager.CurrentAssetType != null) { mRect.width = Screen.width; EditorGUI.LabelField(mRect, "Assets for Collection " + mAssetManager.CurrentAssetType, mSelectionLabelStyle); mRect.x = MARGIN; mRect.y += mRect.height * 1.5f; mRect.width = CELL_WIDTH; Vector2 maxTableSize = new Vector2(Screen.width - mRect.x - MARGIN, Screen.height - mRect.y - MARGIN - CELL_HEIGHT * 5); if (mAdapter == null) { mAdapter = new TableAdapter(mAssetManager, this, 2); } if (mAssetsTable == null) { mAssetsTable = new TableView(mAdapter); } else { mAssetsTable.SetAdapter(mAdapter); } mAssetsTable.UpdateLocation(new Vector2(mRect.x, mRect.y), CELL_WIDTH, CELL_HEIGHT); mAssetsTable.OnGUI(); mAssetsTable.MaxSize = maxTableSize; mRect.y = mAssetsTable.PositionRect.y + mAssetsTable.PositionRect.height; ManagerCommandsGUI(); mRect.y += (mAssetManager.NumEntries + 1) * CELL_HEIGHT; } } Repaint(); } mRect.y += mRect.height; if (mWindowResizeSwitch) { ResizeAndFitRectOnScreen(mRect); mWindowResizeSwitch = false; } if (Event.current.type == EventType.Repaint && forceFocusControl != null) { GUI.FocusControl(forceFocusControl); forceFocusControl = null; } }