Advertisement
Guest User

Untitled

a guest
Aug 14th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.32 KB | None | 0 0
  1. *-- Old E9.05 code--*
  2.  
  3. public static async Task<Customer> GetCustomer(int id)
  4.         {
  5.             Logger.LogInformation("Getting Customer {0} from EPICOR", id);
  6.             EndpointAddress custAddress = new EndpointAddress("https://tenpttest.mwcloud.co/EpicorWCFServices/CustomerService.svc");
  7.  
  8.             CustomerService.GetRowsResponse getRowsResp = null;
  9.             using (var custClient = new CustomerService.CustomerServiceClient("WSHttpBinding_ICustomerService", custAddress))
  10.             {
  11.                 custClient.ClientCredentials.UserName.UserName = Environment.GetEnvironmentVariable("EPICOR_USERNAME");
  12.                 custClient.ClientCredentials.UserName.Password = Environment.GetEnvironmentVariable("EPICOR_PASSWORD");
  13.  
  14.                 var shortTimeout = new TimeSpan(0, 2, 0);
  15.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).SendTimeout = shortTimeout;
  16.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).ReceiveTimeout = shortTimeout;
  17.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).OpenTimeout = shortTimeout;
  18.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).CloseTimeout = shortTimeout;
  19.  
  20.                 CustomerService.CallContextDataSetType callCtxIn = new CustomerService.CallContextDataSetType();
  21.  
  22.                 var custNumWhere = String.Format("CustNum='{0}'", id);
  23.                 CustomerService.GetRowsRequest getRowsReq = new CustomerService.GetRowsRequest("", custNumWhere, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, 1, callCtxIn);
  24.                 getRowsResp = await custClient.GetRowsAsync(getRowsReq);
  25.             }
  26.             Logger.LogInformation("Got Customer from EPICOR");
  27.  
  28. ---------------------------------------------------------------------------------------------------------------------------
  29. *-- E10 Exposed API/WCF --*
  30.  
  31. public static async Task<Customer> GetCustomer(int id)
  32.         {
  33.             Logger.LogInformation("Getting Customer {0} from EPICOR", id);
  34.             EndpointAddress custAddress = new EndpointAddress("https://api.tenpointcrossbows.com/epicor10test/Erp/BO/Customer.svc?sinleWsdl");
  35.  
  36.             CustomerService.GetRowsResponse getRowsResp = null;
  37.             using (var custClient = new CustomerService.CustomerServiceClient("WSHttpBinding_ICustomerService", custAddress))
  38.             {
  39.                 custClient.ClientCredentials.UserName.UserName = Environment.GetEnvironmentVariable("EPICOR_USERNAME");
  40.                 custClient.ClientCredentials.UserName.Password = Environment.GetEnvironmentVariable("EPICOR_PASSWORD");
  41.  
  42.                 var shortTimeout = new TimeSpan(0, 2, 0);
  43.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).SendTimeout = shortTimeout;
  44.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).ReceiveTimeout = shortTimeout;
  45.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).OpenTimeout = shortTimeout;
  46.                 ((WSHttpBinding)custClient.ChannelFactory.Endpoint.Binding).CloseTimeout = shortTimeout;
  47.  
  48.                 CustomerService.CallContextDataSetType callCtxIn = new CustomerService.CallContextDataSetType();
  49.  
  50.                 var custNumWhere = String.Format("CustNum='{0}'", id);
  51.                 CustomerService.GetRowsRequest getRowsReq = new CustomerService.GetRowsRequest("", custNumWhere, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, 1, callCtxIn);
  52.                 getRowsResp = await custClient.GetRowsAsync(getRowsReq);
  53.             }
  54.             Logger.LogInformation("Got Customer from EPICOR");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement