Пример #1
0
        private ControlNumbers GetControlNumbers(IPublicVacancy channel, long vacancyId)
        {
            const string method = "GetControlNumbers";

            var request = new GetVacancyDetailsRequestMessage
            {
                Body = new GetVacancyDetailsRequestBody {
                    vacancyID = vacancyId
                }
            };

            SetSecurity(request);

            GetVacancyDetailsResponseMessage response;

            try
            {
                response = channel.GetVacancyDetails(request);
            }
            catch (Exception)
            {
                _channelManager.Abort(channel);
                throw;
            }

            if (response.Header.executionStatus == EsiExecutionStatus.Failed)
            {
                #region Log
                Logger.Raise(Event.Error, method, "Unable to get the control numbers.",
                             Event.Arg("vacancyId", vacancyId),
                             Event.Arg("messages", Array.ConvertAll(response.Header.Messages, m => m.text)));
                #endregion
                _channelManager.Close(channel);
                throw new InvalidOperationException("Unable to get the control numbers.");
            }

            return(new ControlNumbers
            {
                agentIntegrityControlNumber = response.Body.agentIntegrityControlNumber,
                contactAddressIntegrityControlNumber = response.Body.contactAddressIntegrityControlNumber,
                contactIntegrityControlNumber = response.Body.contactIntegrityControlNumber,
                detailsIntegrityControlNumber = response.Body.detailsIntegrityControlNumber,
                integrityControlNumber = response.Body.integrityControlNumber,
            });
        }
Пример #2
0
 private void SetSecurity(GetVacancyDetailsRequestMessage request)
 {
     request.Security = new Security {
         UsernameToken = _usernameToken
     };
 }