예제 #1
0
        private void btnCallService_Click(object sender, EventArgs e)
        {
            ///------------------------------------------------------------<endpoint name="TradingServiceConfiguration"
            ITradingService dealProxy = new ChannelFactory<ITradingService>("TradingServiceConfiguration").CreateChannel();

            dealProxy.BeginDeal();

            Trade trade = new Trade();
            trade.Count = 10;
            trade.Symbol = "MSFT";
            trade.Date = DateTime.Now.AddMonths(2);
            dealProxy.AddTrade(trade);

            dealProxy.AddFunction("InterestRateEstimation");
            dealProxy.AddFunction("TechnologyStockEstimation");

            decimal dealValue = dealProxy.Calculate();
            textBox1.Text= "Deal value estimated at ${0}" + dealValue;

            dealProxy.Purchase();

            dealProxy.EndDeal();

            ((IChannel)dealProxy).Close();

        }
예제 #2
0
파일: Program.cs 프로젝트: ssickles/archive
        public static void Main(string[] args)
        {
            Console.WriteLine("Press any key when the  tradeservice is ready.");
            Console.ReadKey();
            ITradeService tradeProxy = new ChannelFactory<ITradeService>("TradeServiceConfiguration").CreateChannel();
            tradeProxy.BeginTrade();
            Trade trade = new Trade();
            trade.Amount = 100;
            trade.Symbol = "ABCX";
            trade.Date = DateTime.Now.AddMonths(1);
            tradeProxy.AddTrade(trade);
            tradeProxy.AddFunct("TradeEstimate");
            tradeProxy.AddFunct("StockEstimate");
            decimal tradeValue = tradeProxy.DoCalc();
            Console.WriteLine(string.Format("Deal value estimated at ${0}", tradeValue));
            tradeProxy.Buy();
            tradeProxy.EndTrade();

            Console.WriteLine();
            Console.WriteLine("Completed");
            Console.ReadKey();
        }