Пример #1
0
        // Get the staging information such as batch status and the error information.
        // In this example returns the batch id for the specified batch tag.
        private static int GetStagingInformation(string modelName, string batchTag)
        {
            int batchId = -1;

            try
            {
                // Set model object.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier {
                    Name = modelName
                };

                // Create the request object.
                // Get batch information for the specified model.
                MDSTestService.EntityStagingGetRequest getInfoRequest = new EntityStagingGetRequest();
                EntityStagingGetCriteria getCriteria = new EntityStagingGetCriteria();
                getCriteria.ModelId = modelId;
                getCriteria.IncludeClearedBatches = false;
                getInfoRequest.GetCriteria        = getCriteria;

                MDSTestService.EntityStagingGetResponse getInfoResponse = clientProxy.EntityStagingGet(getInfoRequest);

                HandleOperationErrors(getInfoResponse.OperationResult);

                // Find the batch id (the last one) for the specified batch tag.
                foreach (EntityStagingBatch aBatch in getInfoResponse.Batches)
                {
                    if (string.Equals(aBatch.BatchTag, batchTag, StringComparison.OrdinalIgnoreCase))
                    {
                        batchId = aBatch.BatchId.Value;
                        // You can also access the error information or the batch status.
                        // aBatch.ErrorView
                        // aBatch.Status
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }

            return(batchId);
        }
Пример #2
0
        // Get the staging information such as batch status and the error information.
        // In this example returns the batch id for the specified batch tag.
        private static int GetStagingInformation(string modelName, string batchTag)
        {
            int batchId = -1;

            try
            {
                // Set model object.
                MDSTestService.Identifier modelId = new MDSTestService.Identifier { Name = modelName };

                // Create the request object.
                // Get batch information for the specified model.
                MDSTestService.EntityStagingGetRequest getInfoRequest = new EntityStagingGetRequest();
                EntityStagingGetCriteria getCriteria = new EntityStagingGetCriteria();
                getCriteria.ModelId = modelId;
                getCriteria.IncludeClearedBatches = false;
                getInfoRequest.GetCriteria = getCriteria;

                MDSTestService.EntityStagingGetResponse getInfoResponse = clientProxy.EntityStagingGet(getInfoRequest);

                HandleOperationErrors(getInfoResponse.OperationResult);

                // Find the batch id (the last one) for the specified batch tag.
                foreach (EntityStagingBatch aBatch in getInfoResponse.Batches)
                {
                    if (string.Equals(aBatch.BatchTag, batchTag, StringComparison.OrdinalIgnoreCase))
                    {
                        batchId = aBatch.BatchId.Value;
                        // You can also access the error information or the batch status.
                        // aBatch.ErrorView
                        // aBatch.Status
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex);
            }

            return batchId;
        }