private hrmgt_PortClient Hrmgt_PortClientService() { credential.UserName = User.Identity.GetUserName(); credential.Password = User.Identity.GetPassword(); credential.Domain = config.Integration_Setup.Domain; config.Default_Config.Company_Name = User.Identity.GetCompanyName(); var integrationService = config.Integration_Services .Where(x => x.Integration_Type == "HrMgt" && x.Company_Name == config.Default_Config.Company_Name) .FirstOrDefault(); config.Default_Config.Type = integrationService.Type; string URL = ConfigJSON.GetURL(config, integrationService.Service_Name); EndpointAddress endpoint = new EndpointAddress(URL); var client = new hrmgt_PortClient(basicHttpBinding, endpoint); client.ClientCredentials.Windows.ClientCredential = credential; client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; return(client); }
public companies_PortClient Companies_PortClientService() { credential.UserName = config.Default_Config.Username; credential.Password = config.Default_Config.Password; credential.Domain = config.Integration_Setup.Domain; var integrationService = config.Default_Config.Integration_Services .Where(x => x.Integration_Type == "Company") .FirstOrDefault(); config.Default_Config.Type = integrationService.Type; string URL = ConfigJSON.GetURL(config, integrationService.Service_Name); EndpointAddress endpoint = new EndpointAddress(URL); var client = new companies_PortClient(basicHttpBinding, endpoint); client.ClientCredentials.Windows.ClientCredential = credential; client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; return(client); }