/// <summary> /// This is a sample specific finder method for Entity1. /// If you want to delete or rename the method think about changing the xml in the BDC model file as well. /// </summary> /// <param name="id"></param> /// <returns>Entity1</returns> public static EntityEmployeeData ReadItem(string PersonalNumber) { EmployeeBasic basicInfo = null; EmployeeDetail detailedInfo = null; EntityEmployeeData ret = new EntityEmployeeData(); SharePointLogger logger = new SharePointLogger(); TestConfigTh config = new TestConfigTh(); TestLicense license = new TestLicense(); using (EmployeeRepositorySAPDotNet rep = new EmployeeRepositorySAPDotNet(config, logger, license)) { List <EmployeeBasic> empList = rep.getEmployeeBasicList(); foreach (EmployeeBasic emp in empList) { if (emp.PersonalNumber.ToLower().Trim().Equals(PersonalNumber.ToLower().Trim())) { basicInfo = emp; } } if (basicInfo != null) { detailedInfo = rep.getEmployeeDetailedInfo(PersonalNumber); } } if (basicInfo != null) { ret = new EntityEmployeeData(basicInfo, detailedInfo); } return(ret); }
static void Main(string[] args) { Console.WriteLine("Start - Test Theobald Connector"); ConsoleLogger logger = new ConsoleLogger(); TestConfigTh config = new TestConfigTh(); TestLicense license = new TestLicense(); using (EmployeeRepositoryTh rep = new EmployeeRepositoryTh(config, logger, license)) { List <EmployeeBasic> empList = rep.getEmployeeBasicList(); foreach (var emp in empList) { Console.WriteLine(emp.PersonalNumber); } EmployeeDetail det = rep.getEmployeeDetailedInfo("00001000"); Console.WriteLine(det.LastName); } Console.WriteLine("End Test Theobald Connector"); Console.ReadLine(); Console.WriteLine("Start - Test SAP.NET Connector"); ConsoleLogger loggers = new ConsoleLogger(); TestConfigTh configs = new TestConfigTh(); TestLicense licenses = new TestLicense(); using (EmployeeRepositorySAPDotNet rep = new EmployeeRepositorySAPDotNet(configs, loggers, licenses)) { List <EmployeeBasic> empList = rep.getEmployeeBasicList(); foreach (var emp in empList) { Console.WriteLine(emp.PersonalNumber); } EmployeeDetail det = rep.getEmployeeDetailedInfo("00001000"); Console.WriteLine(det.LastName); } Console.WriteLine("End Test SAP.NET Connector"); Console.ReadLine(); }