Example #1
0
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            SessionId    = sessionId;
            ServiceProxy = serviceProxy;

            /// TODO: This may need to be changed so that this update transaction link is called if the NodeType on the INode object is assigned. Need to consider what is the best method.
            Node.NodeType = NodeType;

            ResponseParameter   = new Service.MP();
            ResponseParameter.I = Guid.NewGuid();
            ResponseParameter.S = sessionId;
            ResponseParameter.V = Guid.Empty;
            ResponseParameter.D = true;
            ResponseParameter.T = Service.MapParameterType.Node;

            Service.BNU nodeBulkOperation = new Service.BNU();
            nodeBulkOperation.I  = TransactionLinkId;
            nodeBulkOperation.D  = DomainParameter.GetParameterValue(sessionId);
            nodeBulkOperation.N  = NodeParameter.GetParameterValue(SessionId);
            nodeBulkOperation.T  = MapManager.NodeTypes.ConvertProxyToService(NodeType);
            nodeBulkOperation.RI = ResponseParameter.I;

            bulkOperations.O.Add(nodeBulkOperation);

            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 (bulkOperations.O.Count < 200)
            {
                if (!_onCompletedBound)
                {
                    executor.TransactionFailed    += OnTransactionFailed;
                    executor.TransactionCompleted += OnTransactionCompleted;

                    _onCompletedBound = true;
                }

                DebugLogger.Instance.LogMsg("Executing update node transaction. NodeId - '{0}'; NodeTypeName - '{1}'", Node.Id, NodeType.Name);
                executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations);
            }
            else
            {
                ServiceProxy.BOCCompleted += OnSubmitBulkOperationCompleted;
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
        }
        void ISoapTransactionLinkExecutor.ExecuteBulkTransactions(Guid sessionId, TransactionalMappingToolServiceClient serviceProxy, ref Service.OPS bulkOperations)
        {
            SessionId = sessionId;
            ServiceProxy = serviceProxy;

            /// TODO: This may need to be changed so that this update transaction link is called if the NodeType on the INode object is assigned. Need to consider what is the best method.
            Node.NodeType = NodeType;

            ResponseParameter = new Service.MP();
            ResponseParameter.I = Guid.NewGuid();
            ResponseParameter.S = sessionId;
            ResponseParameter.V = Guid.Empty;
            ResponseParameter.D = true;
            ResponseParameter.T = Service.MapParameterType.Node;

            Service.BNU nodeBulkOperation = new Service.BNU();
            nodeBulkOperation.I = TransactionLinkId;
            nodeBulkOperation.D = DomainParameter.GetParameterValue(sessionId);
            nodeBulkOperation.N = NodeParameter.GetParameterValue(SessionId);
            nodeBulkOperation.T = MapManager.NodeTypes.ConvertProxyToService(NodeType);
            nodeBulkOperation.RI = ResponseParameter.I;

            bulkOperations.O.Add(nodeBulkOperation);

            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 (bulkOperations.O.Count < 200)
            {
                if (!_onCompletedBound)
                {
                    executor.TransactionFailed += OnTransactionFailed;
                    executor.TransactionCompleted += OnTransactionCompleted;

                    _onCompletedBound = true;
                }

                DebugLogger.Instance.LogMsg("Executing update node transaction. NodeId - '{0}'; NodeTypeName - '{1}'", Node.Id, NodeType.Name);
                executor.ExecuteBulkTransactions(SessionId, ServiceProxy, ref bulkOperations);
            }
            else
            {
                ServiceProxy.BOCCompleted += OnSubmitBulkOperationCompleted;
                ServiceProxy.SubmitBulkOperationsAsync(CallingUrl.Url, SessionId, bulkOperations, this);
            }
        }