|
using System;
using System.ServiceModel;
using System.Collections.Generic;
using System.Threading;
using System.Runtime.Serialization;
namespace Service
{
[ServiceContract(CallbackContract = typeof(IClientCallBack))]
public interface IDemoService
{
[OperationContract(IsOneWay = true)]
void PlaceOrder(OrderItem item);
}
public interface IClientCallBack
{
[OperationContract(IsOneWay = true)]
void ISOrerPlaceSuccessfully(bool issuccess, float total);
}
[DataContract]
public class OrderItem
{
float price;
string name;
int qty;
[DataMember]
public float Price
{
get { return price; }
set { price = value;}
}
[DataMember]
public string Name
{
get { return name; }
set { name = value; }
}
[DataMember]
public int Quantity
{
get { return qty; }
set { qty = value; }
}
}
public class DemoService : IDemoService
{
public void PlaceOrder(OrderItem item)
{
IClientCallBack callback = OperationContext.Current.GetCallbackChannel<IClientCallBack>();
bool success = true;
//process order
float total = item.Price * item.Quantity;
callback.ISOrerPlaceSuccessfully(success, total);
}
}
}
|
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.
Microsoft C# MVP (12-13)
Hey, I am Pranay Rana, working as a Team Leadin MNC. Web development in Asp.Net with C# and MS sql server are the experience tools that I have had for the past 5.5 years now.
For me def. of programming is : Programming is something that you do once and that get used by multiple for many years
StackOverFlow - http://stackoverflow.com/users/314488/pranay
My CV :- http://careers.stackoverflow.com/pranayamr
Awards: