private void OnUpdateRelationshipCompleted(object sender, Service.RUCompletedEventArgs 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.RUCompleted -= OnUpdateRelationshipCompleted;
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("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 update relationship transaction. ResponseParameter Id - '{0}'; ClientId - '{1}';", ResponseParameter.I, Relationship.ClientId);
executor.ExecuteTransaction(SessionId, ServiceProxy);
}