コード例 #1
0
        public async Task <dto.UpdateContactsResponse> UpdateContacts(dto.UpdateContactsRequestData request)
        {
            var booking = await _bookingService.GetSessionBooking();

            var sessionRoleCode = await _sessionBag.RoleCode();

            if (booking != null)
            {
                // Set customer number for booking contact for new member booking
                if (string.IsNullOrEmpty(booking.RecordLocator) && sessionRoleCode == _newskiesSettings.DefaultMemberRoleCode)
                {
                    request.BookingContactList[0].CustomerNumber = await _sessionBag.CustomerNumber();
                }
                // Set customer number for booking contact for existing booking
                else if (!string.IsNullOrEmpty(booking.RecordLocator))
                {
                    request.BookingContactList[0].CustomerNumber = booking.BookingContacts[0].CustomerNumber;
                }
            }

            var response = await _client.UpdateContactsAsync(new UpdateContactsRequest
            {
                ContractVersion        = _navApiContractVer,
                MessageContractVersion = _navMsgContractVer,
                Signature = await _sessionBag.Signature(),
                EnableExceptionStackTrace = false,
                updateContactsRequestData = Mapper.Map <UpdateContactsRequestData>(request)
            });

            //_navApiContractVer, false, _navMsgContractVer,
            //await _sessionBag.Signature(), Mapper.Map<UpdateContactsRequestData>(request));
            return(Mapper.Map <dto.UpdateContactsResponse>(response));
        }
コード例 #2
0
        public async Task <dto.GetStationListResponse> GetStationList(string cultureCode = null)
        {
            var culture = !string.IsNullOrEmpty(cultureCode) ? cultureCode : await _sessionBag.CultureCode();

            var signature = !string.IsNullOrEmpty(await _sessionBag.Signature())
                    ? await _sessionBag.Signature()
                    : await _userSessionService.GetAnonymousSharedSignature();

            var stationListCacheKey = string.Format("stationList_{0}_{1}", culture, await _sessionBag.RoleCode());

            var cachedStationList = _cache.Get <dto.GetStationListResponse>(stationListCacheKey);

            if (cachedStationList != null)
            {
                return(cachedStationList);
            }
            await _semaphoreSlimStationList.WaitAsync();

            try
            {
                cachedStationList = _cache.Get <dto.GetStationListResponse>(stationListCacheKey);
                if (cachedStationList != null)
                {
                    return(cachedStationList);
                }
                var stationsResp = await _client.GetStationListAsync(new GetStationListRequest
                {
                    ContractVersion        = _navApiContractVer,
                    MessageContractVersion = _navMsgContractVer,
                    Signature = signature,
                    EnableExceptionStackTrace = false,
                    GetStationListRequestData = new GetStationListRequestData {
                        CultureCode = culture
                    }
                });

                //_navApiContractVer, false,
                //_navMsgContractVer, signature, new GetStationListRequestData { CultureCode = culture });
                return(_cache.Set(stationListCacheKey, _mapper.Map <dto.GetStationListResponse>(stationsResp),
                                  _newskiesSettings.ResourcesCachePeriod));
            }
            finally
            {
                _semaphoreSlimStationList.Release();
            }
        }
コード例 #3
0
 public async Task <SessionInfo> GetSessionInfo()
 {
     return(new SessionInfo {
         AgentName = await _sessionBag.AgentName(),
         RoleCode = await _sessionBag.RoleCode(),
         OrganizationCode = await _sessionBag.OrganizationCode()
     });
 }
コード例 #4
0
        public async Task PasswordSet(dto.PasswordSetRequest passwordSetRequest)
        {
            var logonRequestData = new dto.LogonRequestData
            {
                AgentName  = await _sessionBag.AgentName(),
                DomainCode = _newskiesSettings.AgentDomain,
                RoleCode   = await _sessionBag.RoleCode(),
                Password   = await _sessionBag.AgentPassword()
            };
            await _userSessionService.SetPassword(logonRequestData, passwordSetRequest.NewPassword);

            await _sessionBag.SetAgentPassword(passwordSetRequest.NewPassword);
        }