private GetLatestNumberSequenceDataResponse GetLatestNumberSequenceValue(GetLatestNumberSequenceDataRequest request) { Shift numberSequenceForShift = null; SalesTransaction numberSequenceForSalesTransaction = null; IEnumerable <SalesTransaction> numberSequenceForReceipts = null; var sequenceSeedDataManager = new NumberSequenceSeedDataManager(request.RequestContext); var numberSequenceValue = sequenceSeedDataManager.GetLatestNumberSequenceData(request.TerminalId); if (numberSequenceValue != null) { if (numberSequenceValue.Item1 != null && numberSequenceValue.Item1.Any()) { numberSequenceForShift = numberSequenceValue.Item1.Single(); } if (numberSequenceValue.Item2 != null && numberSequenceValue.Item2.Any()) { numberSequenceForSalesTransaction = numberSequenceValue.Item2.Single(); } if (numberSequenceValue.Item3 != null && numberSequenceValue.Item3.Any()) { numberSequenceForReceipts = numberSequenceValue.Item3; } } return(new GetLatestNumberSequenceDataResponse(numberSequenceForShift, numberSequenceForSalesTransaction, numberSequenceForReceipts)); }
private IEnumerable <NumberSequenceSeedData> GetNumberSequenceFromChannelDatabase(string terminalId) { // Get the next number sequence value by invoking the number sequence data service. var numberSequenceRequest = new GetLatestNumberSequenceDataRequest(terminalId); var response = this.Context.Runtime.Execute <GetLatestNumberSequenceDataResponse>(numberSequenceRequest, this.Context); IList <NumberSequenceSeedData> numberSequenceList = new List <NumberSequenceSeedData>(); // Gets the number sequence value for shift. if (response.NumberSequenceValueForShift != null) { NumberSequenceSeedData numberSequenceSeedDataForShift = GetNumberSequenceDataByShift(response.NumberSequenceValueForShift); AddOrUpdateNumberSequence(numberSequenceList, numberSequenceSeedDataForShift); } // Gets the number sequence value for transaction identifier. if (response.NumberSequenceValueForTransaction != null) { NumberSequenceSeedData numberSequenceSeedDataForTransactionId = this.GetNumberSequenceDataByTransactionId(response.NumberSequenceValueForTransaction); if (numberSequenceSeedDataForTransactionId != null) { AddOrUpdateNumberSequence(numberSequenceList, numberSequenceSeedDataForTransactionId); } } // Gets the number sequence value for the receipt identifier. if (response.NumberSequenceValueForReceipts != null) { foreach (var transItem in response.NumberSequenceValueForReceipts) { NumberSequenceSeedData numberSequenceSeedDataForReceiptId = this.GetNumberSequenceDataByReceiptId(transItem); if (numberSequenceSeedDataForReceiptId != null) { AddOrUpdateNumberSequence(numberSequenceList, numberSequenceSeedDataForReceiptId); } } } return(numberSequenceList); }