|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.ServiceModel;
using TestService;
namespace TestClient
{
public partial class Form1 : Form
{
IService1 patientSvc = null;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
EndpointAddress address = new EndpointAddress(new Uri("net.tcp://localhost:2202/PatientService"));
NetTcpBinding binding = new NetTcpBinding();
ChannelFactory<IService1> factory = new ChannelFactory<IService1>(binding, address);
patientSvc = factory.CreateChannel();
}
private void button1_Click(object sender, EventArgs e)
{
Patient patient = patientSvc.GetPatient(Convert.ToInt32(textBox1.Text));
if (patient != null)
{
textBox2.Text = patient.FirstName;
textBox3.Text = patient.LastName;
}
}
private void button2_Click(object sender, EventArgs e)
{
Patient patient = new Patient();
patient.FirstName = textBox2.Text;
patient.LastName = textBox3.Text;
patientSvc.SetPatient(Convert.ToInt32(textBox1.Text), patient);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I have been a professional developer since 1996. I live in Illinois, in the USA. I am married and have four children.