コード例 #1
0
        /// <summary>
        /// Example: Obtaining a lock and getting lock information
        /// </summary>
        private static void LoanLock()
        {
            if (_accessToken == null)
            {
                Authenticate();
            }
            ResourceLocksApi lockApiClient = ApiClientProvider.GetApiClient <ResourceLocksApi>(_accessToken);

            Console.Write("Enter the LoanId: ");
            var loanId = Console.ReadLine();
            //This contract will get us lock on a loan and this will be a forced lock.
            var request = new ResourceLockContract
            {
                Resource = new ResourceLockContractResource
                {
                    EntityType = "loan",
                    EntityId   = loanId
                },
                LockType = "shared"
            };
            var createResponse = lockApiClient.CreateResourceLockWithHttpInfo("false", "id", request);

            //Example of pasrsing the URL
            _lockId = createResponse.Headers["Location"].Split('/')[3];
            var getResponse = lockApiClient.GetResourceLockByLockId(_lockId, "loan", loanId);

            Console.WriteLine("Lock ID: {0}", getResponse.Id);
        }
コード例 #2
0
        private static Task <IDisposable> AcquireSharedLock(IApiSession session, string loanId)
        {
            var resourceLockApi      = session.GetApi <ResourceLocksApi>();
            var resourceLockApiInput = new ResourceLockContract()
            {
                LockType = ResourceLockType.NGSharedLock,
                Resource = new EncompassEntityRef()
                {
                    EntityId   = loanId,
                    EntityType = EncompassEntityType.Loan
                }
            };

            return(resourceLockApi.CreateResourceLock(resourceLockApiInput));
        }