C# • Design the UI

Listing 2. This client-side code adds two Label controls, two Textbox controls, and one Button control that sends a request to the PL/SQL Web service.

using System.Windows.Forms;
using com.plsqlpackage.EmployeeWService.wsdl.types;

namespace WCF_Employee_Win
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private int prvGetInt(string strValue)
		{
			int nResult = 0;

			try
			{
				nResult = 
					System.Convert.ToInt32(strValue);
			}
			catch (Exception)
			{ }

			return nResult;
		}

			private void button1_Click(
				object sender, EventArgs e)
		{
			int nEmpNo = 
				this.prvGetInt(
				this.m_tbEmpNo.Text.Trim());

			if (nEmpNo != 0)
			{
			EmployeeWServiceClient objProxy 
					= new EmployeeWServiceClient();
			EmployeeWServiceUser_spselectemployeebyid_Out 
				objResponse = 
				objProxy.spselectemployeebyid(
				nEmpNo);

			this.m_tbResult.Text = 
				String.Format("Name={0} HireDate={1} 
				Job={2}", objResponse.venameOut, 
				objResponse.vhiredateOut, 
				objResponse.vjobOut); 
				objProxy.Close();
			}
		}
	}
}