public TradeViewModel(Trade trade, TradeServiceClient client, IPermissionService permissions) { History = new ObservableCollection <Trade>(); tradeClient = client; Trade = trade; IsEditable = permissions.IsEditable(trade); }
public static void Main() { // Create a proxy for the client using (TradeServiceClient proxy = new TradeServiceClient()) { //Create a transaction scope. This is the only line of code required to enable transactions in WCF using MSMQ using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { proxy.DoTrade("MSFT", "IBM", 60); Console.WriteLine("Begining Transaction ...."); Console.WriteLine("Selling 1000 stocks of ACN and Buying IBM "); Console.WriteLine(""); //Mark the begining of the second transaction.. proxy.DoTrade("ACN", "ABN", 100); Console.WriteLine("Selling 100 stocks of ABN and Buying ACN "); Console.WriteLine("Ending Transaction ...."); // Complete the transaction. scope.Complete(); } } Console.WriteLine(); Console.WriteLine("Press <ENTER> to terminate client."); Console.ReadLine(); }
public static void Main() { // Create a proxy for the client using (TradeServiceClient proxy = new TradeServiceClient()) { //Create a transaction scope. This is the only line of code required to enable transactions in WCF using MSMQ using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { proxy.DoTrade("MSFT", "IBM", 60); Console.WriteLine("Begining Transaction ...."); Console.WriteLine("Selling 1000 stocks of ACN and Buying IBM "); Console.WriteLine(""); //Mark the begining of the second transaction.. proxy.DoTrade("ACN", "ABN", 100); Console.WriteLine("Selling 100 stocks of ABN and Buying ACN "); Console.WriteLine("Ending Transaction ...."); // Complete the transaction. scope.Complete(); } } Console.WriteLine(); Console.WriteLine("Press <ENTER> to terminate client."); Console.ReadLine(); }
static void Main(string[] args) { TradeServiceClient proxy = new TradeServiceClient(); Quote msftQuote = new Quote(); msftQuote.Ticker = "MSFT"; msftQuote.Bid = 30.25M; msftQuote.Ask = 32.00M; msftQuote.Publisher = "PracticalWCF"; Quote ibmQuote = new Quote(); ibmQuote.Ticker = "IBM"; ibmQuote.Bid = 80.50M; ibmQuote.Ask = 81.00M; ibmQuote.Publisher = "PracticalWCF"; proxy.PublishQuote(msftQuote); proxy.PublishQuote(ibmQuote); Quote result; result = proxy.GetQuote("MSFT"); Console.WriteLine("Ticker: {0} Ask: {1} Bid: {2}", result.Ticker, result.Ask, result.Bid); result = proxy.GetQuote("IBM"); Console.WriteLine("Ticker: {0} Ask: {1} Bid: {2}", result.Ticker, result.Ask, result.Bid); try { result = proxy.GetQuote("ATT"); } catch (Exception ex) { Console.WriteLine(ex.Message); } if (result == null) { Console.WriteLine("Ticker ATT not found!"); } Console.WriteLine("Done! Press return to exit"); Console.ReadLine(); }
static void Main() { TradeServiceClient proxy = new TradeServiceClient(); Quote msftQuote = new Quote(); msftQuote.Ticker = "MSFT"; msftQuote.Bid = 30.25M; msftQuote.Ask = 32.00M; msftQuote.Publisher = "PracticalWCF"; Quote ibmQuote = new Quote(); ibmQuote.Ticker = "IBM"; ibmQuote.Bid = 80.50M; ibmQuote.Ask = 81.00M; ibmQuote.Publisher = "PracticalWCF"; proxy.PublishQuote(msftQuote); proxy.PublishQuote(ibmQuote); Quote result; result = proxy.GetQuote("MSFT"); Console.WriteLine("Ticker: {0} Ask: {1} Bid: {2}", result.Ticker, result.Ask, result.Bid); result = proxy.GetQuote("IBM"); Console.WriteLine("Ticker: {0} Ask: {1} Bid: {2}", result.Ticker, result.Ask, result.Bid); try { result = proxy.GetQuote("ATT"); } catch (Exception ex) { Console.WriteLine(ex.Message); } if (result == null) { Console.WriteLine("Ticker ATT not found!"); } Console.WriteLine("Done! Press return to exit"); Console.ReadLine(); }
private void Initialise() { var referenceDataClient = new ReferenceDataServiceClient(); Securities = new ObservableCollection <Security>(referenceDataClient.GetSecurities().ToList()); Counterparties = new ObservableCollection <Counterparty>(referenceDataClient.GetCounterparties().ToList()); tradeClient = new TradeServiceClient(new InstanceContext(null, this)); tradeClient.Subscribe(); rawTrades = new ObservableCollection <TradeViewModel>(tradeClient.GetTrades().Select(TransformTrade).ToList()); trades = CollectionViewSource.GetDefaultView(rawTrades); trades.Filter = Filter; trades.SortDescriptions.Add(new SortDescription("Trade.Created", ListSortDirection.Descending)); trades.Refresh(); }
static void Main() { // Create a client using either wsat or oletx endpoint configurations TradeServiceClient client = new TradeServiceClient("WSAtomicTransaction_endpoint"); // TradeServiceClient client = new TradeServiceClient("OleTransactions_endpoint"); // Start a transaction scope using (TransactionScope tx = new TransactionScope(TransactionScopeOption.RequiresNew)) { Console.WriteLine("Starting transaction"); // Call the Add service operation // - generatedClient will flow the required active transaction int qty; int price; int result; // Call the CalculateTradeValue service operation // - generatedClient will not flow the active transaction qty = 100; price = 15; result = client.CalculateTradeValue(qty, price); Console.WriteLine(" Sold ACN Qantity {0}, For$ {1} With a Total Value of ${2}", qty, price, result); // Complete the transaction scope Console.WriteLine(" Completing transaction"); tx.Complete(); } Console.WriteLine("Transaction committed"); // Closing the client gracefully closes the connection and cleans up resources client.Close(); Console.WriteLine("Press <ENTER> to terminate client."); Console.ReadLine(); }
static void Main() { // Create a client using either wsat or oletx endpoint configurations TradeServiceClient client = new TradeServiceClient("WSAtomicTransaction_endpoint"); // TradeServiceClient client = new TradeServiceClient("OleTransactions_endpoint"); // Start a transaction scope using (TransactionScope tx = new TransactionScope(TransactionScopeOption.RequiresNew)) { Console.WriteLine("Starting transaction"); // Call the Add service operation // - generatedClient will flow the required active transaction int qty; int price; int result; // Call the CalculateTradeValue service operation // - generatedClient will not flow the active transaction qty = 100; price = 15; result = client.CalculateTradeValue(qty, price); Console.WriteLine(" Sold ACN Qantity {0}, For$ {1} With a Total Value of ${2}", qty, price, result); // Complete the transaction scope Console.WriteLine(" Completing transaction"); tx.Complete(); } Console.WriteLine("Transaction committed"); // Closing the client gracefully closes the connection and cleans up resources client.Close(); Console.WriteLine("Press <ENTER> to terminate client."); Console.ReadLine(); }
static void Main() { // Create a proxy for the client using (TradeServiceClient proxy = new TradeServiceClient()) { //Create a transaction scope. using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { proxy.DoTrade("MSFT", "IBM", 60); Console.WriteLine("Selling 60 stocks of IBM and Buying MSFT "); proxy.DoTrade("ACN","ABN", 100); Console.WriteLine("Selling 60 stocks of ABN and Buying ACN "); // Complete the transaction. scope.Complete(); } } Console.WriteLine(); Console.WriteLine("Press <ENTER> to terminate client."); Console.ReadLine(); }
static void Main() { // Create a proxy for the client using (TradeServiceClient proxy = new TradeServiceClient()) { //Create a transaction scope. using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required)) { proxy.DoTrade("MSFT", "IBM", 60); Console.WriteLine("Selling 60 stocks of IBM and Buying MSFT "); proxy.DoTrade("ACN", "ABN", 100); Console.WriteLine("Selling 60 stocks of ABN and Buying ACN "); // Complete the transaction. scope.Complete(); } } Console.WriteLine(); Console.WriteLine("Press <ENTER> to terminate client."); Console.ReadLine(); }