Пример #1
0
        /// <summary>
        /// Creates the enquiry for customer.
        /// </summary>
        /// <param name="integrationEnquiry">The integration enquiry.</param>
        /// <returns>EnquiryResult object.</returns>
        public EnquiryResult CreateEnquiryForCustomer(IntegrationEnquiry integrationEnquiry)
        {
            Logger.InfoFormat("EnquiryFactory.CreateEnquiryForCustomer executing, with params integrationEnquiry, object contains: {0}.", integrationEnquiry.ToString());

            EnquiryResult enquiryResult = null;

            // check for you manual email process engaged
            if (EnquiryMethod.Equals("XML", StringComparison.OrdinalIgnoreCase))
            {
                EnquiryRequest enquiryRequest = BuildSiebelEnquiryRequest(integrationEnquiry);
                EnquiryResponse enquiryResponse = null;

                var xmlPacket = SerializationHelper.ConvertToXml(enquiryRequest);
                Logger.InfoFormat("EnquiryFactory.CreateEnquiryForCustomer executing XML{0}.", xmlPacket);
                try
                {
                    // call enquiry method via the channel factory
                    using (var proxy = new EnquiryProxy(EnquiryEndPoint, EnquiryTimeout))
                    {
                        enquiryResponse = proxy.Enquiry(enquiryRequest);
                    }
                }
                catch (Exception ex)
                {
                    // log error
                    Logger.Error("EnquiryFactory.CreateEnquiryForCustomer threw an exception.", ex);
                }

                enquiryResult = ProcessResponse(enquiryResponse);
            }
            else
            {
                enquiryResult = new EnquiryResult
                {
                    EnquiryNumber = string.Empty,
                    ResultStatus = ResultStatus.EmailRequired  // nothing to do Domain will email
                };
            }

            return enquiryResult;
        }
Пример #2
0
        /// <summary>
        /// Builds the Siebel enquiry request.
        /// </summary>
        /// <param name="integrationEnquiry">The integration enquiry.</param>
        /// <returns>EnquiryRequest contract object for web service call.</returns>
        private EnquiryRequest BuildSiebelEnquiryRequest(IntegrationEnquiry integrationEnquiry)
        {
            Logger.DebugFormat("EnquiryFactory.BuildSiebelEnquiryRequest executing, with params integrationEnquiry, object contains: {0}.", integrationEnquiry.ToString());

            // long-hand copy over properties from the Integration DTO
            var enquiry = new Enquiry
            {
                EnquiryType = integrationEnquiry.EnquiryType,
                ProductService = integrationEnquiry.ProductService,
                EnquiryAbout = integrationEnquiry.EnquiryAbout,
                BookingId = integrationEnquiry.BookingId.Replace("PRIO:", "").Replace("FAST:", ""),
                Connote = integrationEnquiry.Connote,
                CollectionDate = DateHelper.FormatForSiebelDateAndTime(integrationEnquiry.CollectionDate),
                TATLNumber = integrationEnquiry.TATLNumber,
                EnquiryNumber = integrationEnquiry.EnquiryNumber,
                CustomerReference1 = integrationEnquiry.CustomerReference1,
                CustomerReference2 = integrationEnquiry.CustomerReference2,
                EnquiryMessage = integrationEnquiry.EnquiryMessage,
                ExistingCustomer = integrationEnquiry.ExistingCustomer,
                AccountId = integrationEnquiry.AccountId,
                CompanyName = integrationEnquiry.CompanyName,
                ContactFirstName = integrationEnquiry.ContactFirstName,
                ContactLastName = integrationEnquiry.ContactLastName,
                ContactNumber = integrationEnquiry.ContactNumber,
                ContactEmailAddress = integrationEnquiry.ContactEmailAddress,
                Country = integrationEnquiry.Country,
                State = integrationEnquiry.State,
                TownCity = integrationEnquiry.TownCity,
                LocalityProvince = integrationEnquiry.LocalityProvince,
                Locality = integrationEnquiry.Locality,
                ROWCountry = integrationEnquiry.ROWCountry,
            };

            // build the request for the web service call
            var enquiryRequest = new EnquiryRequest
            {
                Enquiry = enquiry,
            };

            return enquiryRequest;
        }