/// <summary>
            /// Get the drop and declare tender transaction.
            /// </summary>
            /// <param name="transactionId">The transaction identifier.</param>
            /// <returns>The drop and declare tender transaction.</returns>
            private DropAndDeclareTransaction GetDropAndDeclareTransaction(string transactionId)
            {
                var getDropAndDeclareTransactionDataRequest = new GetDropAndDeclareTransactionDataRequest(transactionId, QueryResultSettings.SingleRecord);
                DropAndDeclareTransaction transaction       = this.Context.Runtime.Execute <EntityDataServiceResponse <DropAndDeclareTransaction> >(getDropAndDeclareTransactionDataRequest, this.Context).PagedEntityCollection.FirstOrDefault();

                var getDropAndDeclareTransactionTenderDetailsDataRequest = new GetDropAndDeclareTransactionTenderDetailsDataRequest(transactionId, QueryResultSettings.AllRecords);
                PagedResult <TenderDetail> tenderDetails = this.Context.Runtime.Execute <EntityDataServiceResponse <TenderDetail> >(getDropAndDeclareTransactionTenderDetailsDataRequest, this.Context).PagedEntityCollection;

                transaction.TenderDetails = tenderDetails.Results;
                return(transaction);
            }
Exemple #2
0
            /// <summary>
            /// Invoke the method to save drop and declare transactions.
            /// </summary>
            /// <param name="request">Request context.</param>
            /// <returns>Returns response for save drop and declare.</returns>
            private static SaveDropAndDeclareServiceResponse SaveDropAndDeclareTransactions(SaveDropAndDeclareServiceRequest request)
            {
                StoreOperationServiceHelper.ValidateTenderDeclarationCountingDifference(request);

                DropAndDeclareTransaction tenderDropAndDeclare = StoreOperationServiceHelper.ConvertTenderDropAndDeclareTransaction(request);

                // If the previously created drop transaction response did not get received due to network connection issue.
                // On client retry, check if it was already saved. If true, returns saved object.
                var getDropAndDeclareTransactionDataRequest = new GetDropAndDeclareTransactionDataRequest(tenderDropAndDeclare.Id, QueryResultSettings.SingleRecord);
                DropAndDeclareTransaction transaction       = request.RequestContext.Runtime.Execute <EntityDataServiceResponse <DropAndDeclareTransaction> >(getDropAndDeclareTransactionDataRequest, request.RequestContext).PagedEntityCollection.FirstOrDefault();

                if (transaction != null)
                {
                    var getDropAndDeclareTransactionTenderDetailsDataRequest = new GetDropAndDeclareTransactionTenderDetailsDataRequest(tenderDropAndDeclare.Id, QueryResultSettings.AllRecords);
                    transaction.TenderDetails = request.RequestContext.Runtime.Execute <EntityDataServiceResponse <TenderDetail> >(getDropAndDeclareTransactionTenderDetailsDataRequest, request.RequestContext).PagedEntityCollection.Results;
                }
                else
                {
                    var saveDropAndDeclareTransactionDataRequest = new SaveDropAndDeclareTransactionDataRequest(tenderDropAndDeclare);
                    transaction = request.RequestContext.Runtime.Execute <SingleEntityDataServiceResponse <DropAndDeclareTransaction> >(saveDropAndDeclareTransactionDataRequest, request.RequestContext).Entity;
                }

                return(new SaveDropAndDeclareServiceResponse(transaction));
            }
Exemple #3
0
            private EntityDataServiceResponse <TenderDetail> GetDropAndDeclareTransactionTenderDetails(GetDropAndDeclareTransactionTenderDetailsDataRequest request)
            {
                ThrowIf.NullOrWhiteSpace(request.DropAndDeclareTransactionId, "request.DropAndDeclareTransactionId");
                ThrowIf.Null(request.QueryResultSettings, "request.QueryResultSettings");

                var query = new SqlPagedQuery(request.QueryResultSettings)
                {
                    From    = DropAndDeclareTendersView,
                    Where   = "TRANSACTIONID = @TransactionId",
                    OrderBy = "LINENUM",
                };

                query.Parameters["@TransactionId"] = request.DropAndDeclareTransactionId;

                PagedResult <TenderDetail> results;

                using (var sqlServerDatabaseContext = new SqlServerDatabaseContext(request))
                {
                    results = sqlServerDatabaseContext.ReadEntity <TenderDetail>(query);
                }

                return(new EntityDataServiceResponse <TenderDetail>(results));
            }