private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { if (e.Error == null) { foreach (Service.CH change in e.Result.C) { if (change.P == ResponseParameter.I) { if (change.N != null) { DebugLogger.Instance.LogMsg("Delete relationship transaction completed. ResponseParameter Id - '{0}'; Node ClientId - '{1}'; Returned NodeUid - '{2}';", ResponseParameter.I, Node.ClientId, change.N.N); ServerObjects.Node soNode = MapManager.ServerObjectConverter.ToNode(change.N); MapManager.NodeFactory.DeleteNode(soNode); } if (change.R != null) { DebugLogger.Instance.LogMsg("Delete relationship transaction completed. ResponseParameter Id - '{0}'; Node ClientId - '{1}'; Returned RelationshipUid - '{2}';", ResponseParameter.I, Node.ClientId, change.R.R); ServerObjects.Relationship soRelationship = MapManager.ServerObjectConverter.ToRelationship(change.R); MapManager.RelationshipFactory.DeleteRelationship(soRelationship); } } } } if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, e); } }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { TransactionStatus = ServerStatus.TransactionCompleted; if (e.Error == null) { foreach (Service.CH change in e.Result.C) { if (change.P == ResponseParameter.I) { if (change.N != null) { DebugLogger.Instance.LogMsg("Load node transaction completed. ResponseParameter Id - '{0}'; ClientId - '{1}'; Returned NodeUid - '{2}';", ResponseParameter.I, _inProcessResponse.ClientId, change.N.N); ServerObjects.Node soNode = MapManager.ServerObjectConverter.ToNode(change.N); MapManager.NodeFactory.UpgradeFacade(this, soNode); } } } } if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, e); } }
private void OnCompleteTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { TransactionStatus = ServerStatus.TransactionReceived; if (e.UserState != this) { // This event is for a different object so don't execute. return; } // The following lines must be done so that the transaction isn't executed again. ServiceProxy.CompleteTransactionCompleted -= OnCompleteTransactionCompleted; if (e.Error == null) { TransactionStatus = ServerStatus.TransactionCompleted; } else { TransactionStatus = ServerStatus.TransactionFailed; } if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, e); } }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, e); } }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { DebugLogger.Instance.LogMsg("Update node transaction completed. ResponseParameter Id - '{0}';", ResponseParameter.I); if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, e); } }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { if (TransactionCompleted != null) { System.Diagnostics.Debug.WriteLine(ChainId + " Completed"); TransactionCompleted(sender, e); } }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { TransactionStatus = ServerStatus.TransactionCompleted; if (ResponseParameter != null) { DebugLogger.Instance.LogMsg("Update relationship transaction completed. ResponseParameter Id - '{0}';", ResponseParameter.I); } if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, e); } }
private void OnBeginTransactionCompleted(object sender, Service.BeginTransactionCompletedEventArgs e) { if (e.UserState != this) { // This event is for a different object so don't execute. return; } // The following lines must be done so that the transaction isn't executed again. ServiceProxy.BeginTransactionCompleted -= OnBeginTransactionCompleted; if (e.Error != null) { Service.CompleteTransactionCompletedEventArgs completedEventArgs = new Service.CompleteTransactionCompletedEventArgs(null, e.Error, false, null); if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, completedEventArgs); } return; } ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (executor == null) { throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } Guid sessionId = e.Result; if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } if (IsBulkExecution) { Service.OPS bulkOperations = new Service.OPS(); bulkOperations.O = new System.Collections.ObjectModel.ObservableCollection <object>(); executor.ExecuteBulkTransactions(sessionId, ServiceProxy, ref bulkOperations); } else { executor.ExecuteTransaction(sessionId, ServiceProxy); } }
private void OnAddNodeCompleted(object sender, Service.NACompletedEventArgs e) { if (e.UserState != this) { // This event is for a different object so don't execute. return; } TransactionStatus = ServerStatus.TransactionReceived; // The following lines must be done so that the transaction isn't executed again. ServiceProxy.NACompleted -= OnAddNodeCompleted; if (e.Error != null) { TransactionStatus = ServerStatus.TransactionCompleted; Service.CompleteTransactionCompletedEventArgs completedEventArgs = new Service.CompleteTransactionCompletedEventArgs(null, e.Error, false, null); if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, completedEventArgs); } return; } ResponseParameter = e.Result; ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (executor == null) { DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } TransactionStatus = ServerStatus.TransactionExecuting; if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } DebugLogger.Instance.LogMsg("Executing add node transaction. ResponseParameter Id - '{0}'; ClientId - '{1}';", ResponseParameter.I, _inProcessResponse.ClientId); executor.ExecuteTransaction(SessionId, ServiceProxy); }
private void OnUpdateMetadataCompleted(object sender, Service.MUCompletedEventArgs e) { if (e.UserState != this) { // This event is for a different object so don't execute. return; } // The following lines must be done so that the transaction isn't executed again. ServiceProxy.MUCompleted -= OnUpdateMetadataCompleted; if (e.Error != null) { Service.CompleteTransactionCompletedEventArgs completedEventArgs = new Service.CompleteTransactionCompletedEventArgs(null, e.Error, false, null); if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, completedEventArgs); } return; } ResponseParameter = e.Result; ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (executor == null) { DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } DebugLogger.Instance.LogMsg("Executing update metadata transaction. ResponseParameter Id - '{0}'; Name - '{1}'; Value - '{2}'; MetadataId - '{3}'", ResponseParameter.I, Name, Value, Metadata.Id); executor.ExecuteTransaction(SessionId, ServiceProxy); }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { if (e.Error == null) { foreach (Service.CH change in e.Result.C) { if (change.P == ResponseParameter.I) { if (change.M != null) { DebugLogger.Instance.LogMsg("Load metadata transaction completed. ResponseParameter Id - '{0}'; Name - '{1}'; Value - '{2}'; Returned MetadataId - '{3}'", ResponseParameter.I, Name, Value, change.M.M); ServerObjects.Metadata soMetadata = MapManager.ServerObjectConverter.ToMetadata(change.M); MetadataSetFactory.GetInstance(MapManager).UpgradeFacade(this, soMetadata); } } } } if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, e); } }
private void OnAddRelationshipCompleted(object sender, Service.RACompletedEventArgs e) { if (e.UserState != this) { // This event is for a different object so don't execute. return; } TransactionStatus = ServerStatus.TransactionReceived; // The following line must be done so that the transaction isn't executed again. ServiceProxy.RACompleted -= OnAddRelationshipCompleted; if (e.Error != null) { TransactionStatus = ServerStatus.TransactionCompleted; Service.CompleteTransactionCompletedEventArgs completedEventArgs = new Service.CompleteTransactionCompletedEventArgs(null, e.Error, false, null); if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, completedEventArgs); } return; } ResponseParameter = e.Result; ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (executor == null) { DebugLogger.Instance.LogMsg("Exception: This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); throw new NotSupportedException("The next link in the chain is not a supported type of link or the next link is null. This link does not implement ISoapTransactionLinkExecutor."); } TransactionStatus = ServerStatus.TransactionExecuting; if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } DebugLogger.Instance.LogMsg("Executing add relationship transaction. ResponseParameter Id - '{0}'; ClientId - '{1}';", ResponseParameter.I, CreateInProcessObjects().ClientId); executor.ExecuteTransaction(SessionId, ServiceProxy); }
private void OnBeginTransactionCompleted(object sender, Service.BeginTransactionCompletedEventArgs e) { if (e.UserState != this) { // This event is for a different object so don't execute. return; } // The following lines must be done so that the transaction isn't executed again. ServiceProxy.BeginTransactionCompleted -= OnBeginTransactionCompleted; if (e.Error != null) { Service.CompleteTransactionCompletedEventArgs completedEventArgs = new Service.CompleteTransactionCompletedEventArgs(null, e.Error, false, null); if (InternalTransactionCompleted != null) { InternalTransactionCompleted(this, completedEventArgs); } return; } ISoapTransactionLinkExecutor executor = _firstLink as ISoapTransactionLinkExecutor; if (executor == null) { throw new NotSupportedException("This is not a supported type of link. This link does not implement ISoapTransactionLinkExecutor."); } Guid sessionId = e.Result; if (!_onCompletedBound) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; _onCompletedBound = true; } if (IsBulkExecution) { Service.OPS bulkOperations = new Service.OPS(); bulkOperations.O = new System.Collections.ObjectModel.ObservableCollection<object>(); executor.ExecuteBulkTransactions(sessionId, ServiceProxy, ref bulkOperations); } else { executor.ExecuteTransaction(sessionId, ServiceProxy); } }
private void OnTransactionCompleted(object sender, Service.CompleteTransactionCompletedEventArgs e) { TransactionFramework.ISoapTransactionLinkExecutor executor = null; lock (_executionThreadsLock) { if (e.Error != null) { /// An error occurred so let's retry the transaction. executor = ExecutionThreads.CurrentChain; } while (executor == null && ExecutionThreads.Count > 0) { _isInProcess = true; executor = ExecutionThreads.MoveToNextChain(); executor.UpdateDependencies(); if (executor.Dependencies.IsCompleted) { executor.TransactionFailed += OnTransactionFailed; executor.TransactionCompleted += OnTransactionCompleted; } else { IncompleteExecutionThreads.Add(executor); executor.Dependencies.FacadesCompleted += OnTransactionChainFacadesCompleted; executor = null; } } } if (executor != null) { /// TODO: Remove the following TransactionFramework.TransactionChain chain = executor as TransactionFramework.TransactionChain; if (chain != null) { System.Diagnostics.Debug.WriteLine(chain.ChainId); } /// if (MapManagerActivityStatusUpdated != null) { MapManagerActivityEventArgs status = new MapManagerActivityEventArgs(); status.TransactionsLeft = ExecutionThreads.Count + 1; status.Status = ActivityStatusEnum.Busy; MapManagerActivityStatusUpdated.Invoke(this, status); } executor.ExecuteTransaction(Guid.Empty, ServiceProxy); } else { _isInProcess = false; if (MapManagerActivityStatusUpdated != null) { MapManagerActivityEventArgs status = new MapManagerActivityEventArgs(); status.TransactionsLeft = 0; status.Status = ActivityStatusEnum.Idle; MapManagerActivityStatusUpdated.Invoke(this, status); } } }