TextBox1.Focus();
}
protected
void Button1_Click(object
sender, EventArgs e)
{
try
{
if (TextBox1.Text ==
"" || TextBox2.Text ==
"")
{
Label4.Text =
"Please Enter Some Values";
Label5.Text = "";
Label4.Visible = true;
Label5.Visible = true;
}
else
{
var objBinding =
new BasicHttpBinding();
var objEndpoint =
new EndpointAddress("http://localhost:52424/Service1.svc");
var objChannelFactory =
new ChannelFactory<IService1>(objBinding,
objEndpoint);
//Now Let's Get Ready By Creating First Channel For Addition
IService1 objService1 =
objChannelFactory.CreateChannel();
Label4.Text = "The Addition of 
<b>" + TextBox1.Text + "</b>  and  <b>"
+ TextBox2.Text + "</b>  from First Channel is  <b>"
+ objService1.Add(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text)) +
"</b>";
Label4.Visible = true;
((IClientChannel)objService1).Close();
// Now Let's Get Ready By Creating Second Channel For Addition
IService1 objService2 =
objChannelFactory.CreateChannel();
Label5.Text = "The Addition of 
<b>" + TextBox1.Text + "</b>  and  <b>"
+ TextBox2.Text + "</b>  from
Second Channel is  <b>" + objService2.Add(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text));
Label5.Visible = true;
((IClientChannel)objService1).Close();
objChannelFactory.Close();
TextBox1.Text = "";
TextBox2.Text = "";
}
}
catch (Exception
ex)
{
ex.Message.ToString();
}
}
protected
void Button2_Click(object
sender, EventArgs e)
{
try
{
if (TextBox1.Text ==
"" || TextBox2.Text ==
"")
{
Label4.Text = "Please Enter Some
Values";
Label5.Text = "";
Label4.Visible = true;
Label5.Visible = true;
}
else
{
var objBinding =
new BasicHttpBinding();
var objEndpoint =
new EndpointAddress("http://localhost:52424/Service1.svc");
var objChannelFactory =
new ChannelFactory<IService1>(objBinding,
objEndpoint);
//Now Let's Get Ready By Creating First Channel For Substraction
IService1 objService1 =
objChannelFactory.CreateChannel();
Label4.Text = "The Substraction
of  <b>" + TextBox1.Text + "</b>  and
 <b>" + TextBox2.Text + "</b>  from
First Channel is  <b>" + objService1.Sub(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text)) +
"</b>";
Label4.Visible = true;
((IClientChannel)objService1).Close();
// Now Let's Get Ready By Creating Second Channel For Substraction
IService1 objService2 =
objChannelFactory.CreateChannel();
Label5.Text = "The Substraction
of  <b>" + TextBox1.Text + "</b>  and
 <b>" + TextBox2.Text + "</b>  from
Second Channel is  <b>" + objService2.Sub(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text));
Label5.Visible = true;
((IClientChannel)objService1).Close();
objChannelFactory.Close();
TextBox1.Text = "";
TextBox2.Text = "";
}
}
catch (Exception
ex)
{
ex.Message.ToString();
}
}
protected
void Button3_Click(object
sender, EventArgs e)
{
try
{
if (TextBox1.Text ==
"" || TextBox2.Text ==
"")
{
Label4.Text = "Please Enter Some
Values";
Label5.Text = "";
Label4.Visible = true;
Label5.Visible = true;
}
else
{
var objBinding =
new BasicHttpBinding();
var objEndpoint =
new EndpointAddress("http://localhost:52424/Service1.svc");
var objChannelFactory =
new ChannelFactory<IService1>(objBinding,
objEndpoint);
//Now Let's Get Ready By Creating First Channel For Multiplication
IService1 objService1 =
objChannelFactory.CreateChannel();
Label4.Text = "The
Multiplication of  <b>" + TextBox1.Text +
"</b>  and  <b>" + TextBox2.Text +
"</b> 
from First Channel is  <b>" + objService1.Mul(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text)) +
"</b>";
Label4.Visible = true;
((IClientChannel)objService1).Close();
// Now Let's Get Ready By Creating Second Channel For Multiplication
IService1 objService2 =
objChannelFactory.CreateChannel();
Label5.Text = "The
Multiplication of  <b>" + TextBox1.Text +
"</b>  and  <b>" + TextBox2.Text +
"</b>  from Second Channel is  <b>" + objService2.Mul(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text));
Label5.Visible = true;
((IClientChannel)objService1).Close();
objChannelFactory.Close();
TextBox1.Text =
"";
TextBox2.Text = "";
}
}
catch (Exception
ex)
{
ex.Message.ToString();
}
}
protected
void Button4_Click(object
sender, EventArgs e)
{
try
{
if (TextBox1.Text ==
"" || TextBox2.Text ==
"")
{
Label4.Text = "Please Enter Some
Values";
Label5.Text = "";
Label4.Visible = true;
Label5.Visible = true;
}
else
{
var objBinding =
new BasicHttpBinding();
var objEndpoint =
new EndpointAddress("http://localhost:52424/Service1.svc");
var objChannelFactory =
new ChannelFactory<IService1>(objBinding,
objEndpoint);
//Now Let's Get Ready By Creating First Channel For Division
IService1 objService1 =
objChannelFactory.CreateChannel();
Label4.Text = "The Division of 
<b>" + TextBox1.Text + "</b>  and  <b>"
+ TextBox2.Text + "</b>  from First Channel is  <b>"
+ objService1.Div(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text)) +
"</b>";
Label4.Visible = true;
((IClientChannel)objService1).Close();
// Now Let's Get Ready By Creating Second Channel For Division
IService1 objService2 =
objChannelFactory.CreateChannel();
Label5.Text = "The Division of 
<b>" + TextBox1.Text + "</b>  and  <b>"
+ TextBox2.Text + "</b>  from Second Channel is
 <b>" + objService2.Div(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(TextBox2.Text));
Label5.Visible = true;
((IClientChannel)objService1).Close();
objChannelFactory.Close();