/// <summary> /// Updates download session status in database. /// </summary> /// <param name="activityId">The activity identifier associated with the request.</param> /// <param name="downloadSession">The download session.</param> public void UpdateDownloadSessionStatus(Guid activityId, DM.DownloadSession downloadSession) { using (RetailRealTimeServiceContractChannel channel = this.clientFactory.CreateTransactionServiceClient()) using (var contextScope = new OperationContextScope(channel)) { this.SetActivityIdInHttpHeader(activityId); CP.DownloadSessionUpdateStatus session = ConvertDownloadSessionsUpdateStatus(downloadSession); CP.UpdateDownloadSessionStatus request = new CP.UpdateDownloadSessionStatus() { downloadSession = session }; channel.UpdateDownloadSessionStatus(request); channel.Close(); } }
/// <summary> /// Gets upload interval for data store. /// </summary> /// <param name="activityId">The activity identifier associated with the request.</param> /// <param name="dataStoreName">Data store name.</param> /// <returns>Upload interval.</returns> public int GetUploadInterval(Guid activityId, string dataStoreName) { int uploadInterval = 0; using (RetailRealTimeServiceContractChannel channel = this.clientFactory.CreateTransactionServiceClient()) using (var contextScope = new OperationContextScope(channel)) { this.SetActivityIdInHttpHeader(activityId); CP.GetUploadInterval request = new CP.GetUploadInterval() { dataStoreName = dataStoreName }; uploadInterval = channel.GetUploadInterval(request).result; channel.Close(); } return(uploadInterval); }
/// <summary> /// Gets data store name for terminal. /// </summary> /// <param name="activityId">The activity identifier associated with the request.</param> /// <param name="terminalId">Terminal id.</param> /// <returns>Data store name.</returns> public string GetTerminalDataStoreName(Guid activityId, string terminalId) { string dataStoreName = string.Empty; using (RetailRealTimeServiceContractChannel channel = this.clientFactory.CreateTransactionServiceClient()) using (var contextScope = new OperationContextScope(channel)) { this.SetActivityIdInHttpHeader(activityId); CP.GetTerminalDataStoreName request = new CP.GetTerminalDataStoreName() { terminalId = terminalId }; dataStoreName = channel.GetTerminalDataStoreName(request).result; channel.Close(); } return(dataStoreName); }
/// <summary> /// Gets upload job Definitions for terminal. /// </summary> /// <param name="activityId">The activity identifier associated with the request.</param> /// <param name="dataStoreName">The data store name.</param> /// <returns>Upload job Definitions collection.</returns> public IReadOnlyCollection <string> GetUploadJobDefinitions(Guid activityId, string dataStoreName) { IReadOnlyCollection <string> jobDefinitions; using (RetailRealTimeServiceContractChannel channel = this.clientFactory.CreateTransactionServiceClient()) using (var contextScope = new OperationContextScope(channel)) { this.SetActivityIdInHttpHeader(activityId); CP.GetUploadJobDefinitions request = new CP.GetUploadJobDefinitions() { dataStoreName = dataStoreName }; jobDefinitions = channel.GetUploadJobDefinitions(request).result; channel.Close(); } return(jobDefinitions); }
/// <summary> /// Validates data store and user name. /// </summary> /// <param name="activityId">The activity identifier associated with the request.</param> /// <param name="dataStoreName">Data store name.</param> /// <param name="userName">User name.</param> /// <returns>Is data store valid.</returns> public bool ValidateDataStore(Guid activityId, string dataStoreName, string userName) { bool isDataStoreValid = false; using (RetailRealTimeServiceContractChannel channel = this.clientFactory.CreateTransactionServiceClient()) using (var contextScope = new OperationContextScope(channel)) { this.SetActivityIdInHttpHeader(activityId); CP.ValidateDataStore request = new CP.ValidateDataStore() { dataStoreName = dataStoreName, userName = userName }; isDataStoreValid = channel.ValidateDataStore(request).result; channel.Close(); } return(isDataStoreValid); }
/// <summary> /// Gets download sessions for data store. /// </summary> /// <param name="activityId">The activity identifier associated with the request.</param> /// <param name="dataStoreName">Data store name.</param> /// <param name="settings">The query result setting.</param> /// <returns>Download session collection.</returns> public PagedResult <DM.DownloadSession> GetDownloadSessions(Guid activityId, string dataStoreName, QueryResultSettings settings) { System.Collections.ObjectModel.ReadOnlyCollection <DM.DownloadSession> sessions; using (RetailRealTimeServiceContractChannel channel = this.clientFactory.CreateTransactionServiceClient()) using (var contextScope = new OperationContextScope(channel)) { this.SetActivityIdInHttpHeader(activityId); CP.GetDownloadSessions request = new CP.GetDownloadSessions() { dataStoreName = dataStoreName }; sessions = ConvertDownloadSessions(channel.GetDownloadSessions(request).result); channel.Close(); } // paginate results here return(sessions.AsPagedResult(settings)); }
/// <summary> /// Gets download link for session. /// </summary> /// <param name="activityId">The activity identifier associated with the request.</param> /// <param name="dataStoreName">Data store name.</param> /// <param name="downloadSessionId">Download session id.</param> /// <returns>Download link.</returns> public string GetDownloadLink(Guid activityId, string dataStoreName, long downloadSessionId) { string downloadUri = string.Empty; using (RetailRealTimeServiceContractChannel channel = this.clientFactory.CreateTransactionServiceClient()) using (var contextScope = new OperationContextScope(channel)) { this.SetActivityIdInHttpHeader(activityId); CP.GetDownloadUri request = new CP.GetDownloadUri() { dataStoreName = dataStoreName, downloadSessionId = downloadSessionId }; downloadUri = channel.GetDownloadUri(request).result; channel.Close(); } return(downloadUri); }