/// <summary> /// Find employee based on code /// </summary> static void GetEmployeeByCode() { try { // Find employee by code Console.WriteLine(); Console.WriteLine("Find employee by code : "); Console.Write("Enter employee code to find details : "); var codeToFind = Console.ReadLine(); int matchCode = Convert.ToInt32(codeToFind); using (var svcClient = new ServiceClient()) { var matchData = svcClient.GetEmployeeByCode(matchCode); if (matchData != null) { string msg = string.Format("Name : {0}, Code : {1}, StartDate : {2}", matchData.Name, matchData.EmployeeCode, matchData.StartDate.ToString("dd/MM/yyyy")); Console.WriteLine(msg); } else { Console.WriteLine("No matching data found with the code"); } } } catch (FormatException fe) { Console.WriteLine("Invalid employee code..."); } }