public override void RefreshList(UpdateList <TipiPagamentoScontrino> obj) { try { if (string.IsNullOrEmpty(TestoRicerca)) { TestoRicerca = ""; } var list = new List <TipiPagamentoScontrinoItem>(); using (var uof = new UnitOfWork()) { list = uof.TipiPagamentoScontrinoRepository.Find(a => a.Descrizione.Contains(TestoRicerca) || TestoRicerca == "" ).Take(ViewAllItem ? 100000 : 300).ToList().Select(a => new TipiPagamentoScontrinoItem(a) { }).OrderBy(a => a.Descrizione).ToList(); } DataSource = new View.Utility.MySortableBindingList <TipiPagamentoScontrinoItem>(list); base.RefreshList(obj); } catch (Exception ex) { new Action(() => { ExceptionManager.ManageError(ex); }).BeginInvoke(null, null); } }
// Runs a nested update on the given update list (always manual) private void RunUpdateNested(RoutinePhase inUpdateMode, ref UpdateList ioList) { if (ioList.Dirty) { SortUpdateList(ref ioList); ioList.Dirty = false; } m_NestedUpdate.Start(inUpdateMode, ref ioList); bool bPrevUpdating = ioList.Updating; ioList.Updating = true; { while (m_NestedUpdate.Next != -1 && m_NestedUpdate.Counter-- > 0) { Entry e = m_Entries[m_NestedUpdate.Next]; m_NestedUpdate.Next = e.UpdateNext; if (e.Fiber.PrepareUpdate(inUpdateMode)) { e.Fiber.Update(); } } } ioList.Updating = bPrevUpdating; m_NestedUpdate.Clear(); }
// Adds the Fiber to the end of the given list private void AddLast(Fiber inFiber, ref UpdateList ioList) { int fiberIndex = (int)inFiber.Index; // If there are no free fibers currently, // we can just add this as the first and only entry. if (ioList.Head == -1) { ioList.Head = fiberIndex; m_Entries[fiberIndex].UpdateNext = -1; m_Entries[fiberIndex].UpdatePrev = fiberIndex; } else { Entry firstEntry = m_Entries[ioList.Head]; // Point the old last entry to this one m_Entries[firstEntry.UpdatePrev].UpdateNext = fiberIndex; // Point the new last entry at the previous one m_Entries[fiberIndex].UpdatePrev = firstEntry.UpdatePrev; // Point the new last entry at nothing m_Entries[fiberIndex].UpdateNext = -1; // Point the first entry at this one m_Entries[ioList.Head].UpdatePrev = fiberIndex; } ++ioList.Count; }
void UpdateMyList(string sIP, string sHostName, string bangName) { if (this.InvokeRequired) { UpdateList d = new UpdateList(UpdateMyList); this.Invoke(d, new object[] { sIP, sHostName, bangName }); } else { lock (this) { if (sHostName == "����û����Ӧ") { tssl_Online.Image = TDService.Properties.Resources.Off; tssl_Online.Text = "����"; tssl_Online.ToolTipText = "����"; } else { tssl_Online.Image = TDService.Properties.Resources.On; tssl_Online.Text = "����"; tssl_Online.ToolTipText = "����"; } timer1.Enabled=true; } } }
void UpdateMyList(string sIP, string sHostName, string bangName) { if (this.InvokeRequired) { UpdateList d = new UpdateList(UpdateMyList); this.Invoke(d, new object[] { sIP, sHostName, bangName }); } else { lock (this) { if (sHostName == "主机没有响应") { tssl_Online.Image = TDService.Properties.Resources.Off; tssl_Online.Text = "断网"; tssl_Online.ToolTipText = "断网"; } else { tssl_Online.Image = TDService.Properties.Resources.On; tssl_Online.Text = "联网"; tssl_Online.ToolTipText = "联网"; } timer1.Enabled = true; } } }
// Removes an entry from the Fiber list. private void RemoveEntry(Fiber inFiber, ref UpdateList ioList) { int fiberIndex = (int)inFiber.Index; int nextIndex = m_Entries[fiberIndex].UpdateNext; int prevIndex = m_Entries[fiberIndex].UpdatePrev; // If the list is already empty, we can't do anything about it if (ioList.Head == -1) { return; } // Ensure the next entry is pointing back to our previous index. m_Entries[nextIndex == -1 ? ioList.Head : nextIndex].UpdatePrev = prevIndex; // If we're the first entry, the first entry is now our last if (fiberIndex == ioList.Head) { ioList.Head = nextIndex; } else { // Previous entry should point back to our next entry m_Entries[prevIndex].UpdateNext = nextIndex; } m_Entries[fiberIndex].UpdateNext = -1; m_Entries[fiberIndex].UpdatePrev = -1; --ioList.Count; }
// Removes the first Fiber from the given list. private Fiber RemoveFirst(ref UpdateList ioList) { int fiberIndex = ioList.Head; if (fiberIndex == -1) { return(null); } int nextIndex = m_Entries[fiberIndex].UpdateNext; int prevIndex = m_Entries[fiberIndex].UpdatePrev; // If the table only has one entry, // just remove it and set the table to empty. if (nextIndex == -1) { m_Entries[fiberIndex].UpdatePrev = -1; ioList.Head = -1; --ioList.Count; return(m_Entries[fiberIndex].Fiber); } // Point the next entry at the last entry m_Entries[nextIndex].UpdatePrev = prevIndex; // Clear pointers in the current entry m_Entries[fiberIndex].UpdateNext = -1; m_Entries[fiberIndex].UpdatePrev = -1; // Point to the next entry as the first. ioList.Head = nextIndex; --ioList.Count; return(m_Entries[fiberIndex].Fiber); }
public override void RefreshList(UpdateList <EventLog> obj) { try { var datoRicerca = TestoRicerca; var list = new List <LogItem>(); using (var uof = new UnitOfWork()) { list = uof.EventLogRepository.Find(a => datoRicerca == "" || a.Errore.Contains(datoRicerca) || a.Evento.Contains(datoRicerca) || a.StackTrace.Contains(datoRicerca) || a.InnerException.Contains(datoRicerca) ).OrderByDescending(a => a.DataCreazione).Take(ViewAllItem ? 100000 : 300).ToList().Select(a => new LogItem(a) { Entity = a, }).ToList(); } DataSource = new View.Utility.MySortableBindingList <LogItem>(list); base.RefreshList(obj); } catch (Exception ex) { new Action(() => { ExceptionManager.ManageError(ex); }).BeginInvoke(null, null); } }
private void Compile() { k.RefAssemblies.Clear(); Assembly s = Assembly.LoadFile(@"C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll"); Assembly s1 = Assembly.LoadFile(@"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"); k.RefAssemblies.Add(s); k.RefAssemblies.Add(s1); var AssembliesList = ManiPulateMainClass.GetAssemblyNames(textBox1.Text); foreach (var assembly in AllAssemblyFiles) { foreach (string CodeAssembly in AssembliesList) { if (CodeAssembly != "System") { if (assembly.Contains(CodeAssembly)) { k.RefAssemblies.Add(Assembly.LoadFile(assembly)); } } } } UpdateList update = new UpdateList(UpdateUI); this.Invoke(update, k.RefAssemblies, CompilationClass.Classname(textBox1.Text)); k.CompilationError += new ErrorEventHandler(k_CompilationError); k.CompileCSharp(textBox1.Text, "Sample.exe"); //button1.Enabled = true; }
// Adds the Fiber to the start of the given list private void AddFirst(Fiber inFiber, ref UpdateList ioList) { int fiberIndex = (int)inFiber.Index; // If there are no free fibers currently, // we can just add this as the first and only entry. if (ioList.Head == -1) { ioList.Head = fiberIndex; m_Entries[fiberIndex].UpdateNext = -1; m_Entries[fiberIndex].UpdatePrev = fiberIndex; } else { Entry firstEntry = m_Entries[ioList.Head]; // Point back at the current last entry m_Entries[fiberIndex].UpdatePrev = firstEntry.UpdatePrev; // Point at the old first free entry m_Entries[fiberIndex].UpdateNext = ioList.Head; // Point the old first entry at the new first entry m_Entries[ioList.Head].UpdatePrev = fiberIndex; ioList.Head = fiberIndex; } ++ioList.Count; }
internal Task Update(DiscordClient client, ReadyEventArgs e) { foreach (var key in UpdateList.Select(x => x.Key).Distinct()) { RegisterCommands(UpdateList.Where(x => x.Key == key).Select(x => x.Value), key); } return(Task.CompletedTask); }
private void PreProcess() { SetLevelOrders(); mainIterator = new BehaviorIterator(this, 0); activeTimers = new UpdateList <Timer>(); SetRootIteratorReferences(); }
public void Start(RoutinePhase inPhase, ref UpdateList inList) { Phase = inPhase; Yield = YieldPhase.None; Next = inList.Head; Counter = inList.Count; }
public void ExpectContainsToReturnTrueOnlyIfFunctionWasAdded() { Action <float> func = dt => {}; var updateList = new UpdateList(); Assert.IsFalse(updateList.Contains(func)); updateList.Add(func); Assert.IsTrue(updateList.Contains(func)); }
/// <summary> /// Get list of completed tasks /// </summary> /// <returns>List of completed tasks</returns> public async Task <List <UpdateItem> > GetListAsync() { if (UpdateList == null) { await ReadDataAsync(); } return(UpdateList.ToList()); }
/// <summary> /// Get list of keys of all completed tasks /// </summary> /// <returns>List of keys</returns> public async Task <List <string> > GetKeyListAsync() { if (UpdateList == null) { await ReadDataAsync(); } return(UpdateList.Select(selector: x => x.Key).ToList()); }
public void ExpectContainsToReturnFalseAfterRemoveWasCalled() { Action <float> func = dt => { }; var updateList = new UpdateList(); updateList.Add(func); updateList.Remove(func); Assert.IsFalse(updateList.Contains(func)); }
/// <summary> /// 将封存的数据恢复到当前List,结束停止监控List的改变 /// <para>同时清空InsertList,UpdateList,DeleteList</para> /// </summary> public void RestoreList() { IsMonitChanges = false; //保存当前数据至[初始数据列表] CopyModelList <NotificationModel, NotificationModel>(_initialList, this); InsertList.Clear(); UpdateList.Clear(); DeleteList.Clear(); }
/// <summary> /// Create a new Manage Match Page /// </summary> /// <param name="tourney">The tourney for which to see all of the matches</param> public ManageMatchPage(Tourney tourney) { InitializeComponent(); //Reference the tourney and update the page elements this.tourney = tourney; pageFunctionPointer += new UpdateList(ResizeAndUpdateList); //Link a delegate in list items UpdateListing(); }
/// <summary> /// 结束监控List的改变,并将当前数据封存 /// <para>同时清空InsertList,UpdateList,DeleteList</para> /// </summary> public void EndMoinitChanges() { IsMonitChanges = false; //保存当前数据至[初始数据列表] CopyModelList <NotificationModel, NotificationModel>(this, _initialList); InsertList.Clear(); UpdateList.Clear(); DeleteList.Clear(); }
public void ExpectRemoveToThrowIfFunctionWasNotFound() { Action <float> func = dt => {}; var updateList = new UpdateList(); Assert.Throws <Exception>(() => { updateList.Remove(func); }); }
/// <summary> /// Remove key from list of completed update tasks /// </summary> /// <param name="oldKey">Key to remove</param> /// <returns></returns> public async Task RemoveKeyAsync(string oldKey) { if (!(await GetKeyListAsync()).Contains(item: oldKey)) { return; } UpdateList.Remove(item: UpdateList.FirstOrDefault(x => x.Key == oldKey)); await SaveDataAsync(); }
public void ExpectAddToThrowIfFunctionIsAlreadyAdded() { Action <float> func = dt => {}; var updateList = new UpdateList(); updateList.Add(func); Assert.Throws <Exception>(() => { updateList.Add(func); }); }
private static void AppendUpdateList(UpdateList list, DbmsType dbms, StringBuilder output, DbParameterCollection parameters) { output.Append(" SET "); for (int setExpressionIdx = 0; setExpressionIdx < list.Count - 1; setExpressionIdx++) { list[setExpressionIdx].Render(dbms, output, parameters); output.Append(", "); } list[list.Count - 1].Render(dbms, output, parameters); }
public void TestPreviousKnownBreakingEdgecases() { var updateList = new UpdateList(); // we have to create another ref to the functions so we can self remove within closures Action <float> func2 = null; Action <float> func0 = null; Action <float> update2 = dt => { // Do nothing special }; Action <float> update1 = dt => { updateList.Remove(func2); }; Action <float> update0 = dt => { updateList.Remove(func0); }; func2 = update2; func0 = update0; updateList.Add(update0); updateList.Add(update1); updateList.Add(update2); updateList.Update(0f); Assert.IsFalse(updateList.Contains(update0)); Assert.IsTrue(updateList.Contains(update1)); Assert.IsFalse(updateList.Contains(update2)); // now dead test that index 2 is not marked as dead. by adding new updates, running them and checking they still exist updateList.Remove(update1); Action <float> update3Index0 = dt => { }; Action <float> update4Index1 = dt => { }; Action <float> update5Index2 = dt => { }; updateList.Add(update3Index0); updateList.Add(update4Index1); updateList.Add(update5Index2); updateList.Update(0f); Assert.IsTrue(updateList.Contains(update3Index0)); Assert.IsTrue(updateList.Contains(update4Index1)); Assert.IsTrue(updateList.Contains(update5Index2)); }
private void UpdateListView(string str) { if (listMessages.InvokeRequired) { UpdateList list = new UpdateList(UpdateListView); this.Invoke(list, new object[] { str }); } else { listMessages.Items.Add(str); } }
private void btnSave_Click(object sender, EventArgs e) { if (CheckValidity()) { Save?.Invoke(EditEntity, Original); UpdateList?.Invoke(); if (EditStatus == EditStatus.Alter) { this.Close(); } } }
private void UpdateListThemes(string str) { if (listSolutions.InvokeRequired) { UpdateList list = new UpdateList(UpdateListThemes); this.Invoke(list, new object[] { str }); } else { listSolutions.Items.Add(str); } }
public override void RefreshList(UpdateList <Soggetto> obj) { try { if (string.IsNullOrEmpty(TestoRicerca)) { TestoRicerca = ""; } var list = new List <ClientiItem>(); using (var uof = new UnitOfWork()) { list = uof.SoggettiRepository.Find(a => a.RagioneSociale.Contains(TestoRicerca) || a.Nome.Contains(TestoRicerca) || a.Cognome.Contains(TestoRicerca) || a.PIVA.Contains(TestoRicerca) || a.CodiceFiscale.Contains(TestoRicerca) || a.Telefono.Contains(TestoRicerca) || a.Indirizzo.Citta.Contains(TestoRicerca) || a.Indirizzo.Comune.Contains(TestoRicerca) || a.Cellulare.Contains(TestoRicerca) || a.Indirizzo.IndirizzoConCivico.Contains(TestoRicerca) || TestoRicerca == "" ).OrderBy(a => a.RagioneSociale).Take(ViewAllItem ? 100000 : 300).ToList().Select(a => new ClientiItem(a) { ID = a.ID, Entity = a, }).ToList(); } DataSource = new View.Utility.MySortableBindingList <ClientiItem>(list); base.RefreshList(obj); } catch (Exception ex) { new Action(() => { ExceptionManager.ManageError(ex); }).BeginInvoke(null, null); } }
public OpenWorldGameMode(ViewportAdapter viewPort, IPossibleMovements possibleMovements, string worldName, EntityManager entityManager, StoryEngine storyEngine, EventHandler clickEvent) : base(clickEvent) { _entityManager = entityManager; EntityRenderersDict = new Dictionary <Entity, AbstractEntityRenderer>(); _possibleMovements = possibleMovements; _content = ContentManagerFactory.RequestContentManager(); RenderList = new List <IRenderable>(); Map = _content.Load <TiledMap>($"TopDownRpg/{worldName}"); var graphics = StaticServiceLocator.GetService <GraphicsDevice>(); _mapRenderer = new FullMapRenderer(graphics); _mapRenderer.SwapMap(Map); _tileSize = new Vector2(Map.TileWidth, Map.TileHeight); _moverManager = new MoverManager(); var collisionSystem = new CompositeAbstractCollisionSystem(_possibleMovements); _expiringSpatialHash = new ExpiringSpatialHashCollisionSystem <Entity>(_possibleMovements); _spatialHashMover = new SpatialHashMoverManager <Entity>(collisionSystem, _expiringSpatialHash); AddPlayer(); var entityController = EntityControllerFactory.AddEntityController(PlayerEntity.Instance, _possibleMovements, _moverManager); var texture = _content.Load <Texture2D>("TopDownRpg/Path"); var endTexture = _content.Load <Texture2D>("TopDownRpg/BluePathEnd"); collisionSystem.AddCollisionSystem(new TiledCollisionSystem(_possibleMovements, Map, "Collision-Layer")); collisionSystem.AddCollisionSystem(_expiringSpatialHash); CollisionSystem = collisionSystem; AddClickController(PlayerEntity.Instance); PathRenderer = new PathRenderer(_moverManager, PlayerEntity.Instance, texture, endTexture, _tileSize.ToPoint(), Map.Width, Map.Height); UpdateList.Add(_expiringSpatialHash); UpdateList.Add(entityController); UpdateList.Add(_spatialHashMover); UpdateList.Add(_moverManager); CameraTracker = CameraTrackerFactory.CreateTracker(viewPort, EntityRenderersDict[PlayerEntity.Instance], Map); UpdateList.Add(CameraTracker); LoadEntities(); var dialogFont = _content.Load <SpriteFont>("dialog"); var settings = StaticServiceLocator.GetService <IControllerSettings>(); DialogBox = new EntityStoryBoxDialog(ScreenSize.Size, dialogFont, settings.GamePadEnabled); GuiManager.AddGuiLayer(DialogBox); storyEngine.LoadWorld(AddEntity, RemoveEntity, CollisionSystem.CheckMovementCollision, worldName); InteractEvent += (sender, args) => { var facingDirection = PlayerEntity.Instance.FacingDirection; var interactTarget = (PlayerEntity.Instance.Position + facingDirection).ToPoint(); Interact(interactTarget); }; AddInteractionController(); CameraController.AddCameraZoomController(CameraTracker, ClickController); CameraController.AddCameraMovementController(CameraTracker, ClickController); }
public async Task <int> BulkUpdateAsync(params string[] UpdateColumns) { Check.Exception(UpdateColumns == null, "UpdateColumns is null"); if (_WhereColumnList != null && _WhereColumnList.Any()) { return(await this._Context.Fastest <T>().AS(_AsName).BulkUpdateAsync(UpdateList.Select(it => it.Item).ToList(), _WhereColumnList.Select(it => it.DbColumnName).ToArray(), UpdateColumns)); } else { var pkColumns = this._Context.EntityMaintenance.GetEntityInfo <T>().Columns.Where(it => it.IsPrimarykey).Select(it => it.DbColumnName).ToArray(); Check.Exception(pkColumns.Count() == 0, "need primary key"); return(await this._Context.Fastest <T>().AS(_AsName).BulkUpdateAsync(UpdateList.Select(it => it.Item).ToList(), pkColumns, UpdateColumns)); } }
public Task <int> BulkUpdateAsync() { var isWhereColums = _WhereColumnList != null && _WhereColumnList.Any(); if (isWhereColums) { var updateColumns = this._Context.EntityMaintenance.GetEntityInfo <T>().Columns.Where(it => !it.IsPrimarykey && !it.IsIdentity && !it.IsOnlyIgnoreUpdate && !it.IsIgnore).Select(it => it.DbColumnName ?? it.PropertyName).ToArray(); return(BulkUpdateAsync(updateColumns)); } else { return(this._Context.Fastest <T>().AS(_AsName).BulkUpdateAsync(UpdateList.Select(it => it.Item).ToList())); } }
private static UpdateStatement CreateUpdateLevelStatement(IEntity rootEntity, DbRelation recursiveRelation, UpdateList setExpressions, SearchCondition leafFilter, int level) { // Leaf filter, if provided, must be rendered in UPDATE-WHERE clause, not in SELECT-WHERE clause. // Target table of the subquery will an automatically genereted name - which is not used in leaf filter. IDbTable table = rootEntity.Table; UpdateStatement updateAtLevel = new UpdateStatement(table); updateAtLevel.UpdateList = setExpressions; SelectStatement queryLevel = CreateSelectFromLevelQuery(rootEntity, recursiveRelation, null, level, LevelQuerySelectList.PrimaryKey); foreach (IDbColumn pkPart in table.PrimaryKey) { IDbColumn subQueryPkPart = queryLevel.FromTable.Columns.GetByColumnName(pkPart.ColumnName); queryLevel.Where.Add(PredicateFactory.Compare(pkPart, "=", subQueryPkPart)); } updateAtLevel.Where.Add(PredicateFactory.Exists(queryLevel)); if (leafFilter != null && !leafFilter.IsEmpty) updateAtLevel.Where.Add(leafFilter); return updateAtLevel; }
private static int UpdateAtLevel(IConnectionProvider conn, IEntity rootEntity, DbRelation recursiveRelation, UpdateList setExpressions, int level) { UpdateStatement updateAtLevel = CreateUpdateLevelStatement(rootEntity, recursiveRelation, setExpressions, null, level); int rowsAffected = updateAtLevel.Execute(conn); return rowsAffected; }
private static int UpdateAll(IConnectionProvider conn, IEntity rootEntity, DbRelation recursiveRelation, UpdateList setExpressions, int beginAtLevel, int endAtLevel) { // Stop condition: rowsAffected == 0 int totalRowsAffected = 0; bool isLocalConn = !conn.IsOpen; try { if (isLocalConn) conn.BeginTransaction(); // We need to perform COUNT at least once to determine whether rowsAffacted returned by UPDATE can be trusted. RowsAffectedCredibility trustRowsAffected = RowsAffectedCredibility.NotDetermined; bool reachedEndLevel = false; int level = beginAtLevel; do { // Dependening on DBMS configuration, update statements may automatically return the number of rows affected. int rowsAffectedReturnedByEngine = UpdateAtLevel(conn, rootEntity, recursiveRelation, setExpressions, level); // We need to perform manual counting for as long as rows affected cannot be trusted. int? manualNodeCount = CountNodesAtLevelIfRowsAffectedCannotBeTrusted(conn, rootEntity, trustRowsAffected, recursiveRelation, level); // Evaluation which determines whether rows affected may be trusted takes place only once, ie. if not yet determined. bool evaluateRowsAffectedCredibility = (trustRowsAffected == RowsAffectedCredibility.NotDetermined) && (manualNodeCount.HasValue); if (evaluateRowsAffectedCredibility) { bool engineCountMatchesManualCount = (rowsAffectedReturnedByEngine == manualNodeCount.Value); trustRowsAffected = (engineCountMatchesManualCount) ? RowsAffectedCredibility.Trusted : RowsAffectedCredibility.Untrusted; } // Manual node count is null if we have determined that rows affected value returned by engine is credible. int rowsUpdatedInCurrentLevel = manualNodeCount ?? rowsAffectedReturnedByEngine; totalRowsAffected += rowsUpdatedInCurrentLevel; // Inspect stop condition before level variable is increased. reachedEndLevel = IsEndLevelReached(endAtLevel, level, rowsUpdatedInCurrentLevel); // Next level. level++; } while (!reachedEndLevel); if (isLocalConn) conn.CommitTransaction(); } finally { if (isLocalConn) conn.CloseConnection(); } return totalRowsAffected; }
private static int UpdateWithLeafFilter(IConnectionProvider conn, IEntity rootEntity, DbRelation recursiveRelation, UpdateList setExpressions, SearchCondition leafFilter, int beginAtLevel, int endAtLevel) { // Stop condition: final level reached (tree depth is measured). // It's possible that at some intermediate levels no records satisfy the specified criteria. // Nevertheless, the algorithm must proceed to the next level where it might find matching records. // This behavior simulates the behavior of recursive CTEs. int totalRowsAffected = 0; bool isLocalConn = !conn.IsOpen; try { if (isLocalConn) conn.BeginTransaction(); endAtLevel = GetEndLevel(conn, rootEntity, recursiveRelation, endAtLevel); bool reachedEndLevel = false; int level = beginAtLevel; do { UpdateStatement updateAtLevel = CreateUpdateLevelStatement(rootEntity, recursiveRelation, setExpressions, leafFilter, level); totalRowsAffected += updateAtLevel.Execute(conn); reachedEndLevel = (level >= endAtLevel); level++; } while (!reachedEndLevel); if (isLocalConn) conn.CommitTransaction(); } finally { if (isLocalConn) conn.CloseConnection(); } return totalRowsAffected; }
/// <summary>Updates rows in the hierarchy under the current entity.</summary> /// <param name="conn">Connection-transcation context to use.</param> /// <param name="rootEntity">Root entity.</param> /// <param name="recursiveRelation">Recursive relation which defines a hierarchy.</param> /// <param name="setExpressions">The list of columns to be updated and expressions that compute/contain the new values.</param> /// <param name="leafFilter">The search condition which limits the number of rows that are updated. Often a criteria which filters out deactivated records.</param> /// <param name="beginAtLevel">Zero-based index of the first level to update. Zero indicates that updating starts at current entity, /// one indicates that updating starts at the level directly beneath it etc.</param> /// <param name="endAtLevel">Zero-based index of the last level to update. Zero indicates that updating ends at current entity, /// one indicates that updating ends at the level directly beneath it etc. <see cref="System.Int32.MaxValue"/> indicates that operation ends at leaf nodes.</param> /// <returns>Number of rows affected.</returns> public int UpdateTree(IConnectionProvider conn, IEntity rootEntity, DbRelation recursiveRelation, UpdateList setExpressions, SearchCondition leafFilter, int beginAtLevel, int endAtLevel) { EnsureRecursiveRelation(recursiveRelation); EnsureValidBeginAndEndLevels(beginAtLevel, endAtLevel); int totalRowsAffected; if (SearchCondition.IsNullOrEmpty(leafFilter)) totalRowsAffected = UpdateAll(conn, rootEntity, recursiveRelation, setExpressions, beginAtLevel, endAtLevel); else totalRowsAffected = UpdateWithLeafFilter(conn, rootEntity, recursiveRelation, setExpressions, leafFilter, beginAtLevel, endAtLevel); return totalRowsAffected; }
void UpdateMyList(string sIP, string sHostName, string bangName) { if (this.InvokeRequired) { UpdateList d = new UpdateList(UpdateMyList); this.Invoke(d, new object[] { sIP, sHostName, bangName }); } else { lock (this) { if (sHostName == "����û����Ӧ") { StartPing(bangName, "0"); } else { StartPing(bangName, "1"); } } } }
public int UpdateTree(IConnectionProvider conn, IEntity rootEntity, DbRelation recursiveRelation, UpdateList setExpressions, SearchCondition leafFilter, int beginAtLevel, int endAtLevel) { EnsureRecursiveRelation(recursiveRelation); EnsureValidBeginAndEndLevels(beginAtLevel, endAtLevel); // update target set ... where exists ... and ... RecursiveStatement cte = new RecursiveStatement(rootEntity, recursiveRelation); cte.Update = new UpdateStatement(rootEntity.Table); cte.Update.UpdateList = setExpressions; cte.Update.Where = CreateWhere(rootEntity, cte, leafFilter, beginAtLevel, endAtLevel); int rowsAffected = cte.ExecuteUpdate(conn); return rowsAffected; }