/// <summary> /// Get Inbound Service object /// </summary> /// <returns></returns> public static InboundService GetService() { if (_inboundService != null) { return(_inboundService); } if (!RightNowConfigService.IsConfigured()) { return(null); } try { lock (_sync) { if (_inboundService == null) { var inboundWsdlUrl = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.ToaInboundServiceUrl); EndpointAddress endpoint = new EndpointAddress(inboundWsdlUrl); BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); _inboundService = new InboundService(); _inboundService._inboundInterfaceService = new InboundInterfacePortClient(binding, endpoint); _inboundService._log = ToaLogService.GetLog(); } } } catch (Exception e) { _inboundService = null; MessageBox.Show(ToaExceptionMessages.InboudServiceNotInitialized, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_inboundService); }
/// <summary> /// Get instance of CapacityService Object /// </summary> /// <returns></returns> public static ICapacityService GetService() { if (!RightNowConfigService.IsConfigured()) { return(null); } CapacityService service = null; try { string endPointUrl = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.ToaCapacityServiceUrl); service = new CapacityService(); service._toaCapacityInterface = new toa_capacity_interface(endPointUrl); service._log = ToaLogService.GetLog(); } catch (Exception e) { service = null; service._log.Error("Unable to create CapacityService Object"); service._log.Error("Exception: " + e.StackTrace); MessageBox.Show(ToaExceptionMessages.CapacityServiceNotInitialized, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(service); }
/// <summary> /// Get Inbound Service object /// </summary> /// <returns></returns> public static IOpportunityService GetService() { if (_opportunityService != null) { return(_opportunityService); } if (!RightNowConfigService.IsConfigured()) { return(null); } try { lock (_sync) { if (_opportunityService == null) { var opptyServiceUrl = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.OSCOpptyServiceUrl); EndpointAddress endpoint = new EndpointAddress(opptyServiceUrl); BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; //honoring config verb's value only if it is greater than 0 bytes. string maxResponseSize = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.SalesMaxReceivedMessageSize); if (!String.IsNullOrEmpty(maxResponseSize) && Convert.ToInt32(maxResponseSize) > 0) { binding.MaxReceivedMessageSize = Convert.ToInt32(maxResponseSize); } _opportunityService = new OpportunityService(); _opportunityService._opportunityClient = new OpportunityServiceClient(binding, endpoint); _opportunityService._opportunityClient.ClientCredentials.UserName.UserName = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.UserName); _opportunityService._opportunityClient.ClientCredentials.UserName.Password = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.Password); _opportunityService._opportunityClient.Endpoint.Behaviors.Add(new EmptyElementBehavior()); //_inboundService._log = ToaLogService.GetLog(); } } } catch (Exception e) { _opportunityService = null; MessageBox.Show(OSCExceptionMessages.OpportunityServiceNotInitialized, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_opportunityService); }
/// <summary> /// Get Inbound Service object /// </summary> /// <returns></returns> public static IAccountService GetService() { if (_accountService != null) { return(_accountService); } if (!RightNowConfigService.IsConfigured()) { return(null); } try { lock (_sync) { if (_accountService == null) { var accountServiceUrl = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.OSCAcctServiceUrl); EndpointAddress endpoint = new EndpointAddress(accountServiceUrl); BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.Transport; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; _accountService = new AccountService(); _accountService._accountClient = new AccountServiceClient(binding, endpoint); _accountService._accountClient.ClientCredentials.UserName.UserName = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.UserName); _accountService._accountClient.ClientCredentials.UserName.Password = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.Password); //_accountService._log = ToaLogService.GetLog(); } } } catch (Exception e) { _accountService = null; MessageBox.Show(OSCExceptionMessages.AccountServiceNotInitialized, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_accountService); }
/// <summary> /// Get Lead Service object /// </summary> /// <returns></returns> public static ILeadService GetService() { if (_leadService != null) { return(_leadService); } if (!RightNowConfigService.IsConfigured()) { return(null); } try { lock (_sync) { if (_leadService == null) { var leadServiceUrl = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.OSCLeadServiceUrl); EndpointAddress endpoint = new EndpointAddress(leadServiceUrl); BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; _leadService = new LeadService(); _leadService._leadClient = new LeadIntegrationServiceClient(binding, endpoint); _leadService._leadClient.ClientCredentials.UserName.UserName = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.UserName); _leadService._leadClient.ClientCredentials.UserName.Password = RightNowConfigService.GetConfigValue(RightNowConfigKeyNames.Password); _leadService._leadClient.Endpoint.Behaviors.Add(new EmptyElementBehavior()); // TODO: Need to work on this while working on SCLog story. //_inboundService._log = ToaLogService.GetLog(); } } } catch (Exception e) { _leadService = null; MessageBox.Show(OSCExceptionMessages.LeadServiceNotInitialized, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_leadService); }